Skip to content

Commit

Permalink
DebianAutomatedInstall
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasstauffer666 committed Sep 16, 2024
1 parent 0abfffa commit 396a6b6
Show file tree
Hide file tree
Showing 4 changed files with 265 additions and 0 deletions.
40 changes: 40 additions & 0 deletions DebianAutomatedInstall/grub.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
font=$prefix/font.pf2
fi

if loadfont $font ; then
set gfxmode=800x600
set gfxpayload=keep
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod gfxterm
insmod png
terminal_output gfxterm
fi

if background_image /isolinux/splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
elif background_image /splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
else
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
fi

set default=0
set timeout=10

insmod play
play 960 440 1 0 4 440 1
set theme=/boot/grub/theme/1
menuentry --hotkey=i 'Digitale Gesellschaft Install' {
set background_color=black
linux /install.amd/vmlinuz auto=true vga=788 --- quiet preseed/file=/cdrom/preseed.cfg
initrd /install.amd/initrd.gz
}
68 changes: 68 additions & 0 deletions DebianAutomatedInstall/preseed.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

d-i debconf/priority string critical

d-i debian-installer/locale string en_US

d-i keyboard-configuration/xkb-keymap select ch

d-i netcfg/enable boolean true

# if "debconf/priority" is != "critical" then a dialog is shown
d-i netcfg/wireless_show_essids select manual
d-i netcfg/wireless_essid string MY-SSID
d-i netcfg/wireless_security_type select wpa
d-i netcfg/wireless_wpa string MY-PASSWORD

d-i netcfg/get_hostname string
d-i netcfg/get_domain string
d-i netcfg/hostname string debian

d-i mirror/country string manual
d-i mirror/http/hostname string debian.ethz.ch
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string

d-i passwd/root-login boolean false
d-i passwd/user-fullname string Digitale Gesellschaft
d-i passwd/username string digiges
d-i passwd/user-password password digiges
d-i passwd/user-password-again password digiges

d-i time/zone string Europe/Zurich

d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true

# without "partman-auto/disk string" a dialog is shown
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select home
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

d-i base-installer/install-recommends boolean true
d-i base-installer/kernel/image select linux-image-amd64

d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/non-free-firmware boolean true
d-i apt-setup/non-free boolean true

# only work with "tasksel tasksel/first" but not "d-i tasksel/first"
tasksel tasksel/first multiselect standard, cinnamon-desktop

d-i pkgsel/include string mc syncthing
#d-i pkgsel/include string mc syncthing blender krita gimp mypaint geany geany-plugins vim emacs arduino audacity build-essential python3 nodejs npm meld

d-i pkgsel/upgrade select full-upgrade

d-i popularity-contest/participate boolean true

d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true

d-i finish-install/keep-consoles boolean true
d-i finish-install/reboot_in_progress note

d-i preseed/late_command string cp /cdrom/setup.sh /target/root/; chmod +x /target/root/setup.sh; in-target /bin/sh /root/setup.sh
38 changes: 38 additions & 0 deletions DebianAutomatedInstall/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

# Setup UEFI USB Stick

- Download Debian Image
- https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.7.0-amd64-netinst.iso
- https://www.debian.org/releases/bookworm/debian-installer/
- Mount CD-ROM ISO
- Prepare USB Stick
- `parted --script /dev/sdX mklabel msdos`
- `parted --script /dev/sdX mkpart primary fat32 0% 100%`
- `mkfs.vfat /dev/sdX1`
- `mount /dev/sdX1 /mnt/usbstick`
- Copy CD-ROM -> USB-Stick
- `rsync -av /mnt/cdrom/ /mnt/usbstick`
- Copy grub.cfg
- `cp grub.cfg /mnt/usbstick/boot/grub/grub.cfg`
- Adjust preseed.cfg
- MY-SSID
- MY-PASSWORD
- Copy preseed.cfg and setup.sh
- `cp preseed.cfg /mnt/usbstick/preseed.cfg`
- `cp preseed.cfg /mnt/usbstick/setup.sh`
- Unmount USB Stick
- `umount /mnt/usbstick`

# Setup Laptop

- Insert USB-Stick
- Boot from USB-Stick
- Wait (ca. 30 Minutes)
- Login digiges/digiges
- Configure User
- `curl -sS https://digitalegesellschaft.github.io/JugendHackt/DebianAutomatedInstall/setup.sh | sh`

# Additional Documentation

- https://wiki.debian.org/DebianInstaller/WritableUSB-Stick
- https://www.debian.org/releases/bookworm/amd64/apb.en.html
119 changes: 119 additions & 0 deletions DebianAutomatedInstall/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/bin/sh

# All steps in this script have to be written in a way that the script can be
# executed several times and the end result is always the same (idempotent).
# E.g. overwriting a file is fine, while adding just a few lines to a file is
# not a good idea. The reason for this is that people who use this script do not
# have to remember if they already execute it once.
#
# This script is also written to it work on an existing installation, but also
# as final step for an automated install (via Debian pressed). This is reason
# why it assumed that this script runs as root. During the automated install,
# the user never logged in so far, which means various directories and files are
# not yet existing inside the user directory.

# Exit on the first error.
set -e

USER=digiges

if [ $(id -u) != 0 ]; then
echo "Run as Root"
exit
fi

# Allow current user to access /dev/ttyUSB* and /dev/ttyACM*. This is
# necessary to access an Arduino from e.g. the Arduino IDE. Logout/login
# is necessary, to see the effect.
usermod -a -G dialout $USER

# Some Arduino boards identify themselves wrongly as modems and are then
# taken hostage by modemmanager. Simplest idea is to just remove
# modemmanger, assuming using a modem is unlikely to happen.
apt-get remove --yes modemmanager

apt-get autoclean --yes

su - $USER << EOS
mkdir --parents ~/Desktop
cat << EOF > ~/Desktop/Digitale-Gesellschaft.desktop
[Desktop Entry]
Name=Digitale Gesellschaft
Type=Link
URL=https://www.digitale-gesellschaft.ch
Icon=text-html
EOF
cat << EOF > ~/Desktop/Projekte.desktop
[Desktop Entry]
Name=Projekte
Type=Link
URL=https://pad.medialepfade.net/PJ1jn_5HQ4OPHvBBR7-pqw
Icon=text-html
EOF
cat << EOF > ~/Desktop/Links.desktop
[Desktop Entry]
Name=Tools
Type=Link
URL=https://pad.medialepfade.net/deNW2fTCT--BK0lWh8zikQ#
Icon=text-html
EOF
cat << EOF > ~/Desktop/Syncthing.desktop
[Desktop Entry]
Name=Syncthing
Exec=/usr/bin/syncthing -browser-only
Icon=syncthing
Terminal=false
Type=Application
EOF
cat << EOF > ~/Desktop/Terminal.desktop
[Desktop Entry]
Name=Terminal
Exec=gnome-terminal
Icon=org.gnome.Terminal
Terminal=false
Type=Application
EOF
cat << EOF > ~/Desktop/Firefox.desktop
[Desktop Entry]
Name=Firefox
Exec=firefox -new-window
Icon=firefox-esr
Terminal=false
Type=Application
EOF
# .desktop files only execute an application if they are marked as executable.
chmod +x ~/Desktop/*.desktop
mkdir --parents ~/.config/autostart
cat << EOF > ~/.config/autostart/Syncthing.desktop
[Desktop Entry]
Name=Start Syncthing
Exec=/usr/bin/syncthing serve --no-browser --logfile=default
Icon=syncthing
Terminal=false
Type=Application
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
X-GNOME-Autostart-Delay=0
EOF
# gsettings only works with a logged in session, maybe create a run-once at startup script? autostart which deletes itself?
# gsettings set org.gnome.desktop.interface monospace-font-name 'Monospace 12'
# TODO nemo default config? panes? date, ...
# TODO nicer icon set? from mint?
# http://ftp.ch.debian.org/debian/pool/main/m/mint-y-icons/mint-y-icons_1.7.7-1_all.deb
# TODO configure syncthing?
EOS

echo "Logout and Login"

0 comments on commit 396a6b6

Please sign in to comment.