10 PACKAGES := apt bilibop-lockfs btrfs-tools busybox-static bzip2 ca-certificates cron deborphan extlinux gzip htop ifupdown init iputils-ping irqbalance isc-dhcp-client less live-boot live-boot-initramfs-tools make man-db nbd-client net-tools nmap ntpdate openssh-client openssh-server p7zip-full pciutils rsync squashfs-tools sshfs sudo systemd unace unrar-free unzip vim wget wireless-tools wpasupplicant xz-utils zip
14 stretch_%_root/bin/sh:
15 btrfs subvolume create "$(subst bin/sh,,$@)" || mkdir "$(subst bin/sh,,$@)"
16 chmod 755 "$(subst bin/sh,,$@)"
17 debootstrap --arch=${ARCH} --variant=minbase stretch "$(subst bin/sh,,$@)"
19 stretch_%_root/: stretch_%_root/bin/sh ${CONFIG} permissions .FORCE
20 for tree in ${CONFIG}; do for file in apt default timezone; do cp -av "$$tree/etc/$$file" "$@/etc/" || true; done; done
21 chroot "$@" ln -sf /bin/true /usr/local/sbin/invoke-rc.d
22 chroot "$@" sh -c 'apt-mark showmanual |xargs apt-mark auto || true'
23 chroot "$@" apt-get update
24 chroot "$@" umount /proc /dev || true
25 chroot "$@" mount -t devtmpfs udev /dev
26 chroot "$@" mount -t proc proc /proc
27 chroot "$@" apt-get --yes install ${PACKAGES}
28 chroot "$@" apt-get --yes --auto-remove purge
29 chroot "$@" apt-get --yes --auto-remove upgrade
30 chroot "$@" rm /usr/local/sbin/invoke-rc.d
31 chroot "$@" umount /proc /dev
32 chroot "$@" apt-get clean
35 stretch_%_config/: stretch_%_root/ ${CONFIG} permissions .FORCE
36 btrfs subvolume delete "$@" || rm -r "$@" || true
37 btrfs subvolume snapshot "$<" "$@" || cp -rlv "$<" "$@"
38 cp -av $(addsuffix /*, ${CONFIG}) "$@"
39 chroot "$@" locale-gen
40 chroot "$@" update-locale
41 chroot "$@" useradd -M -p "$$(printf %s\\n '${PASS}' |mkpasswd -m sha-256 -s)" '${USER}'
42 for g in ${GROUPS}; do chroot "$@" adduser '${USER}' "$$g"; done
45 stretch_%.squashfs: stretch_%_config/
47 mksquashfs "$<" "$@" -comp xz
49 /dev/sd%: partitions .FORCE
50 sfdisk ${@} <partitions
51 dd of=${@} if=/usr/lib/syslinux/mbr/mbr.bin
53 /dev/sd%1: /dev/sd% vmlinuz initrd.img syslinux.cfg .FORCE
55 mkfs.ext3 -FL SQUASHBOOT ${@}
56 mount -t ext3 ${@} mount
57 cp -L vmlinuz initrd.img *.squashfs syslinux.cfg Makefile partitions mount/
58 cp $(addprefix /usr/lib/syslinux/modules/bios/, menu.c32 libutil.c32) mount/
63 /dev/sd%2: /dev/sd% .FORCE
65 mkfs.btrfs -fL SQUASHCLIENT ${@}
66 mount -t btrfs ${@} mount
67 btrfs subvolume create mount/home
72 /dev/sd%3: /dev/sd% .FORCE