subvol=/mnt/bookworm
release=bookworm
+mainuser=...
+fsuid=...
+
define SOURCES :=
deb http://deb.debian.org/debian bullseye main
deb http://deb.debian.org/debian ${release} main
modules=xfce,gimp #,approx
## Packages
-packages=alsa-utils ark audacity blender blueman brasero brasero-cdrkit breeze-icon-theme ca-certificates chromium chromium-sandbox cifs-utils claws-mail claws-mail-pgpinline claws-mail-pgpmime claws-mail-vcalendar-plugin clementine cron cryptsetup cups cups-browsed deborphan dosfstools dvdauthor dvd+rw-tools eject exfat-fuse exfatprogs file firefox-esr/bullseye firefox-esr-l10n-de/bullseye firmware-linux-free fonts-liberation fonts-liberation2 frei0r-plugins gdebi gimp gparted gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-x gtk3-engines-breeze gvfs-backends gvfs-fuse gwenview hplip hplip-gui hunspell hunspell-de-de hyphen-de inkscape irqbalance isc-dhcp-client k3b k3b-i18n kate kbd kcalc kdenlive kde-spectacle kde-style-breeze krita krita-l10n mousepad libnss3-tools libpam-mount libpam-script libreoffice libreoffice-gnome libreoffice-gtk3 libreoffice-l10n-de libreoffice-style-breeze live-boot live-boot-initramfs-tools locales lvm2 lightdm make man-db marble mdadm mesa-utils mumble nbd-client net-tools netcat-openbsd nis nmap nscd ntfs-3g ntpdate obs-studio okular openssh-client openssh-server p7zip-full pavucontrol pciutils pdfchain plymouth plymouth-themes policykit-1 policykit-1-gnome pulseaudio pulseaudio-module-bluetooth recordmydesktop rsync samba-common-bin squashfs-tools sshfs sudo syslinux syslinux-common syslinux-efi systemd thunar-volman thunderbird thunderbird-l10n-de tmux unace unrar-free unzip usermode va-driver-all vdpau-driver-all vim vlc wget wireless-tools wpasupplicant x11-xserver-utils x264 xauth xdotool xfce4 xfce4-goodies xfce4-power-management-plugins xfce4-terminal xfce4-whiskermenu-plugin xscreensaver xserver-xorg-core xserver-xorg-input-all xserver-xorg-input-wacom xserver-xorg-video-all xz-utils yt-dlp zenity
+packages=alsa-utils ark audacity blender blueman brasero brasero-cdrkit breeze-icon-theme ca-certificates chromium chromium-sandbox cifs-utils claws-mail claws-mail-pgpinline claws-mail-pgpmime claws-mail-vcalendar-plugin clementine cron cryptsetup cups cups-browsed deborphan dosfstools dvdauthor dvd+rw-tools eject exfat-fuse exfatprogs file firefox-esr firefox-esr-l10n-de firmware-linux-free fonts-liberation fonts-liberation2 frei0r-plugins gdebi gimp git gparted gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-x gtk3-engines-breeze gvfs-backends gvfs-fuse gwenview hplip hplip-gui hunspell hunspell-de-de hyphen-de inkscape irqbalance isc-dhcp-client k3b k3b-i18n kate kbd kcalc kdenlive kde-spectacle kde-style-breeze krita krita-l10n mousepad libnss3-tools libpam-mount libpam-script libreoffice libreoffice-gnome libreoffice-gtk3 libreoffice-l10n-de libreoffice-style-breeze live-boot live-boot-initramfs-tools locales lvm2 lightdm make man-db marble mdadm mesa-utils mumble nbd-client net-tools netcat-openbsd nis nmap nscd ntfs-3g ntpdate obs-studio okular openssh-client openssh-server p7zip-full pavucontrol pciutils pdfchain plymouth plymouth-themes policykit-1 policykit-1-gnome pulseaudio pulseaudio-module-bluetooth recordmydesktop rsync samba-common-bin squashfs-tools sshfs sudo synaptic syslinux syslinux-common syslinux-efi systemd thunar-volman thunderbird thunderbird-l10n-de tmux unace unrar-free unzip usermode va-driver-all vdpau-driver-all vim vlc wget wireless-tools wpasupplicant x11-xserver-utils x264 xauth xdotool xfce4 xfce4-goodies xfce4-power-manager-plugins xfce4-terminal xfce4-whiskermenu-plugin xscreensaver xserver-xorg-core xserver-xorg-input-all xserver-xorg-input-wacom xserver-xorg-video-all xz-utils yt-dlp zenity
# Hardware Spcific
packages += linux-image-amd64 grub-pc xserver-xorg-video-intel
# packages += 0ad flare-game openarena
## Hostname for the generated machine
-hostname=debian
+hostname=${mainuser}-debian
## Root password will be salted and encrypted in image
# rootpass=topsecret
## Comma separated list of users to be set up.
## User logins will start out with an empty password
## If the live module is in use, users will also be added to the sudo group
-users=adam,steve
+# users=adam,steve
+users=${mainuser}
## Wifi configuration, if a Wifi password is given, WPA encryption will be used
## without the password, the system will try to connect to an open wifi
## can be choosen to install packages from
## See modules/approx.mk if you need more flexibility
# approx=http://localhost:9000/debian
+
+CFGROOT = cfg_root/
+
+.PHONY: _fstab _sudo
+_target: _fstab _sudo
+
+_sudo: _config cfg_root
+ chroot cfg_root adduser ${mainuser} sudo
+
+_fstab: _config cfg_root
+ mkdir -p cfg_root/mnt/fsroot
+ printf '%s 0 0\n' \
+ 'UUID=${fsuid} / btrfs auto,rw,subvol=bookworm' \
+ 'UUID=${fsuid} /home btrfs auto,rw,subvol=home' \
+ 'UUID=${fsuid} /mnt/fsroot btrfs auto,rw,nofail' \
+ 'LABEL=SYSTEM /boot/efi vfat auto,ro,nofail' \
+ 'LABEL=SWAP swap swap sw,nofail' \
+ >cfg_root/etc/fstab