diff options
author | u <u@billy> | 2023-11-17 18:49:37 -0500 |
---|---|---|
committer | u <u@billy> | 2023-11-19 07:14:19 -0500 |
commit | 3bbb985b7f95a7c39f272bb716cfcc1bfe906c63 (patch) | |
tree | d198b6b2756914f42ca6dcaf9b671b26279cdb54 | |
parent | d8c6be3b252ccb6379442d1ff3dd41e96290b3b6 (diff) |
remove more samizdat-paths cruft
-rw-r--r-- | Makefile | 39 | ||||
-rwxr-xr-x | initramfs-tools/hooks/samizdat | 19 | ||||
-rw-r--r-- | src/btrfs-send-root.sh | 45 | ||||
-rw-r--r-- | src/dnsmasq-dhcp-script.sh | 82 | ||||
-rw-r--r-- | src/samizdat-paths.in | 13 | ||||
-rw-r--r-- | src/samizdat-paths.sh | 13 |
6 files changed, 17 insertions, 194 deletions
@@ -12,7 +12,7 @@ INSTALL_SUBMODULES = fsmgr | |||
12 | NO_INSTALL_SUBMODULES = cryptonomic-dyndns-server | 12 | NO_INSTALL_SUBMODULES = cryptonomic-dyndns-server |
13 | SUBMODULES = $(INSTALL_SUBMODULES) $(NO_INSTALL_SUBMODULES) | 13 | SUBMODULES = $(INSTALL_SUBMODULES) $(NO_INSTALL_SUBMODULES) |
14 | 14 | ||
15 | all: samizdat-paths.sh ${compiled_programs} ${SUBMODULES} | 15 | all: ${compiled_programs} ${SUBMODULES} |
16 | 16 | ||
17 | .PHONY: stack install-stack | 17 | .PHONY: stack install-stack |
18 | install-stack: | 18 | install-stack: |
@@ -37,24 +37,21 @@ wait_for_files: src/wait_for_files.c | build-deps | |||
37 | %: src/%.c | build-deps | 37 | %: src/%.c | build-deps |
38 | $(CC) $(CFLAGS) $< -o $@ | 38 | $(CC) $(CFLAGS) $< -o $@ |
39 | 39 | ||
40 | src_bin_programs = btrfs-functions.sh var.sh dnsmasq-dhcp-script.sh usb partvi | 40 | src_bin_programs = btrfs-functions.sh var.sh usb partvi |
41 | 41 | ||
42 | bin_programs=$(addprefix src/, $(src_bin_programs)) samizdat-paths.sh ${cc_files} ${btrfs_utils} | 42 | bin_programs=$(addprefix src/, $(src_bin_programs)) ${cc_files} ${btrfs_utils} |
43 | 43 | ||
44 | btrfs_utils=$(addprefix src/btrfs-utils/, btarfs with-btrfs-seed) | 44 | btrfs_utils=$(addprefix src/btrfs-utils/, btarfs with-btrfs-seed) |
45 | 45 | ||
46 | initrd_files:=$(wildcard src/initrd/*) dynmenu samizdat-pinentry wait_for_files | 46 | initrd_files:=$(wildcard src/initrd/*) dynmenu wait_for_files |
47 | initramfs_conf_files:=$(wildcard initramfs-tools/*) | 47 | initramfs_conf_files:=$(wildcard initramfs-tools/*) |
48 | 48 | ||
49 | isolinux_files:=$(wildcard isolinux/*) | 49 | isolinux_files:=$(wildcard isolinux/*) |
50 | 50 | ||
51 | clean: | 51 | clean: |
52 | rm -f samizdat-paths.sh ${compiled_programs} | 52 | rm -f ${compiled_programs} |
53 | 53 | ||
54 | .PHONY: all clean | 54 | .PHONY: all clean |
55 | samizdat-paths.sh: src/samizdat-paths.in | ||
56 | @sed -e "s?PREFIX?$(prefix)?g" $< > $@ | ||
57 | include samizdat-paths.sh | ||
58 | 55 | ||
59 | install-nested-kvm: conf/kvm.conf | 56 | install-nested-kvm: conf/kvm.conf |
60 | install -m0644 conf/kvm.conf ${instdir}/etc/modprobe.d/ | 57 | install -m0644 conf/kvm.conf ${instdir}/etc/modprobe.d/ |
@@ -149,23 +146,6 @@ boot: rootfs | |||
149 | sudo update-initramfs -u | 146 | sudo update-initramfs -u |
150 | sudo ROOTFS=$(rootfs) ./src/parted-usb.sh | 147 | sudo ROOTFS=$(rootfs) ./src/parted-usb.sh |
151 | 148 | ||
152 | fastboot: rootfs | ||
153 | sudo qemu.sh | ||
154 | |||
155 | samizdat.netinst.iso: | $(rootfs) | ||
156 | exit 1; sudo initrd.sh | ||
157 | sudo xorriso-usb.sh $(reuse_child) --bootloader --out $@ | ||
158 | |||
159 | cleantest: | ||
160 | make testclean | ||
161 | make isotest | ||
162 | |||
163 | isotest: samizdat.iso | ||
164 | USE_ISO=y SLOW_BOOT=y NO_NET=y qemu.sh $^ | ||
165 | |||
166 | isotest-netinst: samizdat.netinst.iso | ||
167 | USE_ISO=y SLOW_BOOT=y qemu.sh $^ | ||
168 | |||
169 | samizdat_btrfs_patch_size=256M | 149 | samizdat_btrfs_patch_size=256M |
170 | 150 | ||
171 | get_loop_dev="$$(sudo losetup -n -O name -j $@~tmp)" | 151 | get_loop_dev="$$(sudo losetup -n -O name -j $@~tmp)" |
@@ -229,23 +209,22 @@ build-submodules-stamp: build-submodules | |||
229 | install-submodules-stamp: install-submodules | 209 | install-submodules-stamp: install-submodules |
230 | touch $@ | 210 | touch $@ |
231 | 211 | ||
212 | bindir = /usr/local/bin | ||
213 | |||
232 | install-bin-programs: ${bin_programs} | 214 | install-bin-programs: ${bin_programs} |
233 | install -D -p -t ${instdir}${samizdat_bindir} ${bin_programs} | 215 | install -D -p -t ${instdir}${bindir} ${bin_programs} |
234 | 216 | ||
235 | CP=cp --preserve=timestamps -r | 217 | CP=cp --preserve=timestamps -r |
236 | 218 | ||
237 | defaults_conf_files = conf/grub.default | 219 | defaults_conf_files = conf/grub.default |
238 | initramfs_conf_files = $(addprefix initramfs-tools/,hooks/samizdat scripts/samizdat) | 220 | initramfs_conf_files = $(addprefix initramfs-tools/,hooks/samizdat scripts/samizdat) |
239 | install-stamp: install-bin-programs samizdat-paths.sh ${compiled_programs} | 221 | install-stamp: install-bin-programs ${compiled_programs} |
240 | install -m644 --backup=t -t /etc/apt/sources.list.d -- conf/bookworm.list | 222 | install -m644 --backup=t -t /etc/apt/sources.list.d -- conf/bookworm.list |
241 | install -m644 --backup=t -T -- conf/grub.default /etc/default/grub | 223 | install -m644 --backup=t -T -- conf/grub.default /etc/default/grub |
242 | install -t /etc/initramfs-tools/hooks -- initramfs-tools/hooks/samizdat | 224 | install -t /etc/initramfs-tools/hooks -- initramfs-tools/hooks/samizdat |
243 | install -t /etc/initramfs-tools/scripts -- initramfs-tools/scripts/samizdat | 225 | install -t /etc/initramfs-tools/scripts -- initramfs-tools/scripts/samizdat |
244 | touch $@ | 226 | touch $@ |
245 | 227 | ||
246 | bootclean: | ||
247 | rm -f samizdat.disk.img boot-disk.template.img boot-disk.img | ||
248 | |||
249 | .PHONY: update upgrade up upgrade-key initrd | 228 | .PHONY: update upgrade up upgrade-key initrd |
250 | 229 | ||
251 | initrd: install | 230 | initrd: install |
diff --git a/initramfs-tools/hooks/samizdat b/initramfs-tools/hooks/samizdat index b6451eb..1d4c1fe 100755 --- a/initramfs-tools/hooks/samizdat +++ b/initramfs-tools/hooks/samizdat | |||
@@ -1,32 +1,29 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # TODO: check samizdat source to see what it copies | ||
3 | [ "$1" = prereqs ] && { echo; exit; } | 2 | [ "$1" = prereqs ] && { echo; exit; } |
4 | 3 | ||
4 | . /usr/share/initramfs-tools/hook-functions | ||
5 | |||
5 | die() { printf 'Error: generating initramfs: %s\n' "$*" >&2; exit 1; } | 6 | die() { printf 'Error: generating initramfs: %s\n' "$*" >&2; exit 1; } |
6 | 7 | ||
7 | CopyExec() { copy_exec "$@" || die "failed to copy_exec $*"; } | 8 | CopyExec() { copy_exec "$@" || die "failed to copy_exec $*"; } |
8 | CopyExecE() { [ "$2" ] || die "cannot find binary to copy: $1"; shift; CopyExec "$@"; } | 9 | CopyExecE() { [ "$2" ] || die "cannot find binary to copy: $1"; shift; CopyExec "$@"; } |
9 | 10 | ||
10 | . /usr/share/initramfs-tools/hook-functions | 11 | SAMIZDAT_INITRD_PATH=/usr/local/lib/samizdat-rhizome/initrd |
11 | PATH=/usr/local/lib/samizdat-rhizome/initrd:/usr/local/bin:$PATH | 12 | |
12 | . samizdat-paths.sh | 13 | PATH=${SAMIZDAT_INITRD_PATH}:/usr/local/bin:$PATH |
13 | 14 | ||
14 | repo_execs=$(echo "${samizdat_initrd_files_dir}"/*) | 15 | repo_execs=$(echo "${SAMIZDAT_INITRD_PATH}"/*) |
15 | 16 | ||
16 | path_execs=' | 17 | path_execs=' |
17 | mountpoint openvt rsync gpg2 pinentry-curses truncate dmsetup | 18 | mountpoint openvt rsync gpg2 pinentry-curses truncate dmsetup |
18 | dmstats cryptsetup mkfs.btrfs btrfs fsck.hfsplus wait_for_files | 19 | dmstats cryptsetup mkfs.btrfs btrfs fsck.hfsplus wait_for_files |
19 | samizdat-pinentry dynmenu samizdat-password-agent samizdat-gpg-agent | 20 | dynmenu parted fallocate strace btrfstune sfdisk |
20 | parted fallocate strace btrfstune sfdisk | ||
21 | ' | 21 | ' |
22 | 22 | ||
23 | graft_paths=" | 23 | graft_paths=" |
24 | /bin/OpenVT=/bin/openvt | 24 | /bin/OpenVT=/bin/openvt |
25 | /bin/LoSetup=/sbin/losetup | 25 | /bin/LoSetup=/sbin/losetup |
26 | /patchroot/patchroot.sh=${samizdat_initrd_files_dir}/patchroot.sh | 26 | /patchroot/patchroot.sh=${SAMIZDAT_INITRD_PATH}/patchroot.sh |
27 | /patchroot/sources.list=/etc/apt/sources.list | ||
28 | /patchroot/initrd-dependencies.txt=${samizdat_initrd_files_dir}/initrd-dependencies.txt | ||
29 | /lib/samizdat/vol_id.txt=${samizdat_initrd_files_dir}/vol_id.txt | ||
30 | " | 27 | " |
31 | 28 | ||
32 | absolute_path_copies='/lib/terminfo/l/linux /usr/bin/gpg-agent' | 29 | absolute_path_copies='/lib/terminfo/l/linux /usr/bin/gpg-agent' |
diff --git a/src/btrfs-send-root.sh b/src/btrfs-send-root.sh deleted file mode 100644 index 8a3a513..0000000 --- a/src/btrfs-send-root.sh +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | . samizdat-paths.sh | ||
3 | . var.sh | ||
4 | . btrfs-functions.sh | ||
5 | |||
6 | rootfs_uuid () | ||
7 | { | ||
8 | btrfs filesystem show / | sed -ne 's/.*uuid: //p' | ||
9 | } | ||
10 | |||
11 | remote_btrfs_receiver() | ||
12 | { | ||
13 | # ssh "$BTRFS_RECEIVE_DESTINATION_HOST" -- "sudo btrfs receive $(shellescape "$BTRFS_RECEIVE_DESTINATION_PATH")" | ||
14 | ssh "$BTRFS_RECEIVE_DESTINATION_HOST" -- \ | ||
15 | "sudo sh sami/btrfs-receive-root.sh $(shellescape "$BTRFS_RECEIVE_DESTINATION_PATH") $(shellescape "$BTRFS_RECEIVE_SUBVOLUME_NAME")" | ||
16 | } | ||
17 | |||
18 | dummy_receiver() | ||
19 | { | ||
20 | true | ||
21 | } | ||
22 | |||
23 | push_remote() | ||
24 | { | ||
25 | $(ARGS_NE mnt src ssh_dst) | ||
26 | |||
27 | now=$(date +%F.%H%M%S) || die | ||
28 | snap_dir=$mnt/snapshot.$now | ||
29 | prev_dir=$mnt/SEED | ||
30 | |||
31 | case "$ssh_dst" in | ||
32 | *:*) ;; | ||
33 | *) return 1;; | ||
34 | esac | ||
35 | local BTRFS_RECEIVE_DESTINATION_PATH="${ssh_dst#*:}" | ||
36 | local BTRFS_RECEIVE_DESTINATION_HOST="${ssh_dst%%:*}" | ||
37 | local BTRFS_RECEIVE_SUBVOLUME_NAME="${snap_dir#$mnt/}" | ||
38 | push_helper false "$snap_dir" "$prev_dir" "$src" remote_btrfs_receiver | ||
39 | } | ||
40 | |||
41 | ssh_dst=d@fifty.local:sami/test_dest | ||
42 | |||
43 | mkdir -p /mnt/rootfs || die | ||
44 | mountpoint -q /mnt/rootfs || mount -o subvol=/ UUID=$(rootfs_uuid) /mnt/rootfs || die | ||
45 | push_remote /mnt/rootfs / "$ssh_dst" | ||
diff --git a/src/dnsmasq-dhcp-script.sh b/src/dnsmasq-dhcp-script.sh deleted file mode 100644 index 7469447..0000000 --- a/src/dnsmasq-dhcp-script.sh +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | [ "$1" = tftp ] || exit 0 | ||
3 | . samizdat-paths.sh | ||
4 | TFTP_ROOT=${samizdat_isolinux_dir} | ||
5 | TFTP_FILE=$4 | ||
6 | TFTP_FILE_SIZE=$3 | ||
7 | CLIENT_IP=$3 | ||
8 | |||
9 | # dnsmasq clears the environment. kiki needs at least $HOME | ||
10 | export USER=root | ||
11 | export MAIL=/var/mail/root | ||
12 | export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
13 | export LANG=en_US.UTF-8 | ||
14 | export HOME=/root | ||
15 | export LANGUAGE=en_US:en | ||
16 | export LOGNAME=root | ||
17 | |||
18 | debug() | ||
19 | { | ||
20 | LOGDIR=/var/log/dnsmasq-dhcp-script | ||
21 | mkdir -p "$LOGDIR" | ||
22 | exec > "$LOGDIR/$$.log" 2>&1 | ||
23 | set -x | ||
24 | } | ||
25 | |||
26 | new_child() | ||
27 | { | ||
28 | child_dir=$samizdat_child_dir/child.$$ | ||
29 | if [ -d "$child_dir" ]; then | ||
30 | rmdir "$child_dir" || exit 1 | ||
31 | fi | ||
32 | |||
33 | sh -x "$(which keygen.sh)" "$child_dir" || return | ||
34 | tar --exclude '*~' -zcf "$child_dir"/gnupghome.tar -C "$child_dir"/root/.gnupg . || return | ||
35 | |||
36 | tftp_dir="${TFTP_ROOT}"/"$CLIENT_IP" | ||
37 | if [ ! -d "$tftp_dir" ]; then | ||
38 | ATOMIC=y | ||
39 | dest_dir="$tftp_dir"~ | ||
40 | |||
41 | # DNSMASQ DOCUMENTATION IS WRONG OMFG | ||
42 | # Otherwise this symlink farm would be unnecessary | ||
43 | |||
44 | mkdir -p "$dest_dir" | ||
45 | (cd "$dest_dir" && ln -sf ../* . && rm "$CLIENT_IP"~) || return | ||
46 | else | ||
47 | dest_dir="$tftp_dir" | ||
48 | fi | ||
49 | |||
50 | chown dnsmasq "$child_dir" "$child_dir"/gnupghome.tar | ||
51 | ln -sf "$child_dir"/gnupghome.tar "$dest_dir"/ | ||
52 | |||
53 | if [ "$ATOMIC" ]; then | ||
54 | mv -T "$dest_dir" "$tftp_dir" | ||
55 | fi | ||
56 | } | ||
57 | |||
58 | cleanup_after_fail() | ||
59 | { | ||
60 | umount "$child_dir" | ||
61 | rmdir "$child_dir" | ||
62 | } | ||
63 | |||
64 | exit_unless_needed() | ||
65 | { | ||
66 | |||
67 | case "$TFTP_FILE" in | ||
68 | "${TFTP_ROOT}/linux/vmlinuz") | ||
69 | ;; | ||
70 | "${TFTP_ROOT}/${CLIENT_IP}/linux/vmlinuz") | ||
71 | [ -e "${TFTP_ROOT}/${CLIENT_IP}/gnupghome.tar" ] && exit | ||
72 | ;; | ||
73 | *) exit | ||
74 | ;; | ||
75 | esac | ||
76 | } | ||
77 | |||
78 | exit_unless_needed | ||
79 | |||
80 | debug | ||
81 | |||
82 | (new_child || cleanup_after_fail) & | ||
diff --git a/src/samizdat-paths.in b/src/samizdat-paths.in deleted file mode 100644 index c3037d3..0000000 --- a/src/samizdat-paths.in +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | # Note: this file is both shell script and make file | ||
2 | |||
3 | samizdat_libdir=PREFIX/lib/samizdat-rhizome | ||
4 | samizdat_bindir=PREFIX/bin | ||
5 | |||
6 | samizdat_initrd_files_dir=${samizdat_libdir}/initrd | ||
7 | samizdat_child_dir=${samizdat_libdir}/child | ||
8 | samizdat_isolinux_dir=${samizdat_libdir}/isolinux | ||
9 | samizdat_linux_dir=${samizdat_libdir}/isolinux/linux | ||
10 | samizdat_grub_efi_dir=${samizdat_libdir}/grub-efi | ||
11 | samizdat_initramfs_conf_dir=/etc/initramfs-tools | ||
12 | |||
13 | samizdat_iso_dir=. | ||
diff --git a/src/samizdat-paths.sh b/src/samizdat-paths.sh deleted file mode 100644 index 6548564..0000000 --- a/src/samizdat-paths.sh +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | # Note: this file is both shell script and make file | ||
2 | samizdat_libdir=/usr/local/lib/samizdat-rhizome | ||
3 | samizdat_bindir=/usr/local/bin | ||
4 | |||
5 | samizdat_initrd_files_dir=${samizdat_libdir}/initrd | ||
6 | samizdat_child_dir=${samizdat_libdir}/child | ||
7 | samizdat_isolinux_dir=${samizdat_libdir}/isolinux | ||
8 | samizdat_linux_dir=${samizdat_libdir}/isolinux/linux | ||
9 | samizdat_grub_efi_dir=${samizdat_libdir}/grub-efi | ||
10 | samizdat_initramfs_conf_dir=${samizdat_libdir}/initramfs-tools | ||
11 | |||
12 | samizdat_iso_dir=. | ||
13 | samizdat_execs_dir=${samizdat_bindir} | ||