summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoru <u@billy>2023-11-17 18:49:37 -0500
committeru <u@billy>2023-11-19 07:14:19 -0500
commit3bbb985b7f95a7c39f272bb716cfcc1bfe906c63 (patch)
treed198b6b2756914f42ca6dcaf9b671b26279cdb54
parentd8c6be3b252ccb6379442d1ff3dd41e96290b3b6 (diff)
remove more samizdat-paths cruft
-rw-r--r--Makefile39
-rwxr-xr-xinitramfs-tools/hooks/samizdat19
-rw-r--r--src/btrfs-send-root.sh45
-rw-r--r--src/dnsmasq-dhcp-script.sh82
-rw-r--r--src/samizdat-paths.in13
-rw-r--r--src/samizdat-paths.sh13
6 files changed, 17 insertions, 194 deletions
diff --git a/Makefile b/Makefile
index b6ed4b6..6aff815 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ INSTALL_SUBMODULES = fsmgr
12NO_INSTALL_SUBMODULES = cryptonomic-dyndns-server 12NO_INSTALL_SUBMODULES = cryptonomic-dyndns-server
13SUBMODULES = $(INSTALL_SUBMODULES) $(NO_INSTALL_SUBMODULES) 13SUBMODULES = $(INSTALL_SUBMODULES) $(NO_INSTALL_SUBMODULES)
14 14
15all: samizdat-paths.sh ${compiled_programs} ${SUBMODULES} 15all: ${compiled_programs} ${SUBMODULES}
16 16
17.PHONY: stack install-stack 17.PHONY: stack install-stack
18install-stack: 18install-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
40src_bin_programs = btrfs-functions.sh var.sh dnsmasq-dhcp-script.sh usb partvi 40src_bin_programs = btrfs-functions.sh var.sh usb partvi
41 41
42bin_programs=$(addprefix src/, $(src_bin_programs)) samizdat-paths.sh ${cc_files} ${btrfs_utils} 42bin_programs=$(addprefix src/, $(src_bin_programs)) ${cc_files} ${btrfs_utils}
43 43
44btrfs_utils=$(addprefix src/btrfs-utils/, btarfs with-btrfs-seed) 44btrfs_utils=$(addprefix src/btrfs-utils/, btarfs with-btrfs-seed)
45 45
46initrd_files:=$(wildcard src/initrd/*) dynmenu samizdat-pinentry wait_for_files 46initrd_files:=$(wildcard src/initrd/*) dynmenu wait_for_files
47initramfs_conf_files:=$(wildcard initramfs-tools/*) 47initramfs_conf_files:=$(wildcard initramfs-tools/*)
48 48
49isolinux_files:=$(wildcard isolinux/*) 49isolinux_files:=$(wildcard isolinux/*)
50 50
51clean: 51clean:
52 rm -f samizdat-paths.sh ${compiled_programs} 52 rm -f ${compiled_programs}
53 53
54.PHONY: all clean 54.PHONY: all clean
55samizdat-paths.sh: src/samizdat-paths.in
56 @sed -e "s?PREFIX?$(prefix)?g" $< > $@
57include samizdat-paths.sh
58 55
59install-nested-kvm: conf/kvm.conf 56install-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
152fastboot: rootfs
153 sudo qemu.sh
154
155samizdat.netinst.iso: | $(rootfs)
156 exit 1; sudo initrd.sh
157 sudo xorriso-usb.sh $(reuse_child) --bootloader --out $@
158
159cleantest:
160 make testclean
161 make isotest
162
163isotest: samizdat.iso
164 USE_ISO=y SLOW_BOOT=y NO_NET=y qemu.sh $^
165
166isotest-netinst: samizdat.netinst.iso
167 USE_ISO=y SLOW_BOOT=y qemu.sh $^
168
169samizdat_btrfs_patch_size=256M 149samizdat_btrfs_patch_size=256M
170 150
171get_loop_dev="$$(sudo losetup -n -O name -j $@~tmp)" 151get_loop_dev="$$(sudo losetup -n -O name -j $@~tmp)"
@@ -229,23 +209,22 @@ build-submodules-stamp: build-submodules
229install-submodules-stamp: install-submodules 209install-submodules-stamp: install-submodules
230 touch $@ 210 touch $@
231 211
212bindir = /usr/local/bin
213
232install-bin-programs: ${bin_programs} 214install-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
235CP=cp --preserve=timestamps -r 217CP=cp --preserve=timestamps -r
236 218
237defaults_conf_files = conf/grub.default 219defaults_conf_files = conf/grub.default
238initramfs_conf_files = $(addprefix initramfs-tools/,hooks/samizdat scripts/samizdat) 220initramfs_conf_files = $(addprefix initramfs-tools/,hooks/samizdat scripts/samizdat)
239install-stamp: install-bin-programs samizdat-paths.sh ${compiled_programs} 221install-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
246bootclean:
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
251initrd: install 230initrd: 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
5die() { printf 'Error: generating initramfs: %s\n' "$*" >&2; exit 1; } 6die() { printf 'Error: generating initramfs: %s\n' "$*" >&2; exit 1; }
6 7
7CopyExec() { copy_exec "$@" || die "failed to copy_exec $*"; } 8CopyExec() { copy_exec "$@" || die "failed to copy_exec $*"; }
8CopyExecE() { [ "$2" ] || die "cannot find binary to copy: $1"; shift; CopyExec "$@"; } 9CopyExecE() { [ "$2" ] || die "cannot find binary to copy: $1"; shift; CopyExec "$@"; }
9 10
10. /usr/share/initramfs-tools/hook-functions 11SAMIZDAT_INITRD_PATH=/usr/local/lib/samizdat-rhizome/initrd
11PATH=/usr/local/lib/samizdat-rhizome/initrd:/usr/local/bin:$PATH 12
12. samizdat-paths.sh 13PATH=${SAMIZDAT_INITRD_PATH}:/usr/local/bin:$PATH
13 14
14repo_execs=$(echo "${samizdat_initrd_files_dir}"/*) 15repo_execs=$(echo "${SAMIZDAT_INITRD_PATH}"/*)
15 16
16path_execs=' 17path_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
23graft_paths=" 23graft_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
32absolute_path_copies='/lib/terminfo/l/linux /usr/bin/gpg-agent' 29absolute_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
6rootfs_uuid ()
7{
8 btrfs filesystem show / | sed -ne 's/.*uuid: //p'
9}
10
11remote_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
18dummy_receiver()
19{
20 true
21}
22
23push_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
41ssh_dst=d@fifty.local:sami/test_dest
42
43mkdir -p /mnt/rootfs || die
44mountpoint -q /mnt/rootfs || mount -o subvol=/ UUID=$(rootfs_uuid) /mnt/rootfs || die
45push_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
4TFTP_ROOT=${samizdat_isolinux_dir}
5TFTP_FILE=$4
6TFTP_FILE_SIZE=$3
7CLIENT_IP=$3
8
9# dnsmasq clears the environment. kiki needs at least $HOME
10export USER=root
11export MAIL=/var/mail/root
12export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
13export LANG=en_US.UTF-8
14export HOME=/root
15export LANGUAGE=en_US:en
16export LOGNAME=root
17
18debug()
19{
20 LOGDIR=/var/log/dnsmasq-dhcp-script
21 mkdir -p "$LOGDIR"
22 exec > "$LOGDIR/$$.log" 2>&1
23 set -x
24}
25
26new_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
58cleanup_after_fail()
59{
60 umount "$child_dir"
61 rmdir "$child_dir"
62}
63
64exit_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
78exit_unless_needed
79
80debug
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
3samizdat_libdir=PREFIX/lib/samizdat-rhizome
4samizdat_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
11samizdat_initramfs_conf_dir=/etc/initramfs-tools
12
13samizdat_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
2samizdat_libdir=/usr/local/lib/samizdat-rhizome
3samizdat_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
10samizdat_initramfs_conf_dir=${samizdat_libdir}/initramfs-tools
11
12samizdat_iso_dir=.
13samizdat_execs_dir=${samizdat_bindir}