SQUASH := ${squash}
SYSROOT := sys_root/
CFGROOT := cfg_root/
+
+ PACKAGES += squashfs-tools nbd-client
_target: _squash _install _config
_bootstrap:
_install: _bootstrap
_copy: _install
- _config: _copy
- _squash: _config _squash_modules
+ _config: _copy _squash_modules
+ _squash: _config
else ifdef raspi
VOLUME := ${raspi}
deb http://archive.raspberrypi.org/debian stretch main
endef
-PACKAGES := ${PACKAGES} firmware-brcm80211 libraspberrypi-bin libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel
+ PACKAGES += firmware-brcm80211 libraspberrypi-bin libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel
_target: _umount _partcopy _config _install
export SOURCES SYSROOT CFGROOT VOLUME PBOOT PROOT SQUASH ARCH KEYRING BOOTSTRAP
sys_root/:
- btrfs subvol create "$@" || mkdir -p "$@"
+ btrfs subvol create "$@" || mkdir "$@"
chmod 755 "$@"
cfg_root/: sys_root/ _install
- btrfs sub snap "$<" "$@" || mkdir -p "$@"
+ -btrfs sub del "$@" || rm -r "$@"
+ btrfs sub snap "$<" "$@" || mkdir "$@"
chmod 755 "$@"
rpi_root/:
- btrfs subvol create "$@" || mkdir -p "$@"
+ btrfs subvol create "$@" || mkdir "$@"
chmod 755 "$@"
img_mount/:
_copy: ${SYSROOT} ${CFGROOT}
cp -au "$${SYSROOT}/." "$${CFGROOT}/"
-.PHONY: _common_config
-_config: _common_config
-_common_config: ${CFGROOT}
+_config: ${CFGROOT}
ln -sf /dev/null "$${CFGROOT}/etc/systemd/network/99-default.link"
printf '\nsession optional pam_mkhomedir.so umask=0027\n' >>"$${CFGROOT}/etc/pam.d/common-session"
printf 'LABEL=FSROOT / ext4 auto,nofail,rw 0 0\nLABEL=BOOT /boot vfat auto,nofail,ro 0 0\n' \
>"$${CFGROOT}/etc/fstab"
+ chroot "$${CFGROOT}" update-initramfs -u
-${SQUASH}: ${CFGROOT}
+${SQUASH}: ${CFGROOT} .FORCE
-rm "$${SQUASH}"
mksquashfs "$${CFGROOT}" "$${SQUASH}" -comp xz
-PACKAGES += bilibop-lockfs
+PACKAGES += bilibop-lockfs live-boot live-boot-initramfs-tools
-.PHONY: _live _live_sudo _live_sudo_users
+.PHONY: _live_lockfs _live_sudo _live_sudo_users _live_modules
ifdef users
_config: _live_sudo_users
endif
-_umount: _live
-_live: ${CFGROOT} _bootloader
- grep -x aufs "$${CFGROOT}/etc/initramfs-tools" || printf 'aufs\n' >>"$${CFGROOT}/etc/initramfs-tools/modules"
- sed -i 's; root=; lockfs=1G root=;' "$${CFGROOT}/boot/bootmenu.cfg" "$${CFGROOT}/boot/grub.cfg"
+_live_modules: ${CFGROOT}
+ printf 'aufs\n' >>"$${CFGROOT}/etc/initramfs-tools/modules"
+ sed -i 's;^MODULES=.*$$;MODULES=netboot;' "$${CFGROOT}/etc/initramfs-tools/initramfs.conf"
-_config: _live_sudo
+_umount: _live_lockfs
+_live_lockfs: ${CFGROOT} _bootloader
+ sed -i 's; root=; lockfs=1G root=;' "$${CFGROOT}/boot/bootmenu.cfg" "$${CFGROOT}/boot/grub.cfg" \
+ || sed -i 's; root=; lockfs=1G root=;' "$${CFGROOT}/boot/cmdline.txt"
+
+_config: _live_sudo _live_modules
_live_sudo: ${CFGROOT}/etc/sudoers.d/nopassword
_live_sudo: ${CFGROOT}/var/lib/polkit-1/localauthority/50-local.d/disable-passwords.pkla