summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-10-10 02:03:07 -0400
committerAndrew Cady <d@jerkface.net>2020-10-10 02:03:07 -0400
commitc3c9f565311216cd6845f18eb3963adf4a63e1d1 (patch)
tree9b0a7f368674bb0ea96ad43c61eab4394e8d5f13
parentd5b949c2592a9d1b24e572e351fcd2f1169071ed (diff)
parted-usb small fixups
-rwxr-xr-xsrc/parted-usb.sh54
1 files changed, 26 insertions, 28 deletions
diff --git a/src/parted-usb.sh b/src/parted-usb.sh
index 41c2814..6841166 100755
--- a/src/parted-usb.sh
+++ b/src/parted-usb.sh
@@ -13,31 +13,6 @@ MiB()
13 KiB $(KiB "$1") 13 KiB $(KiB "$1")
14} 14}
15 15
16. samizdat-paths.sh || die 'samizdat-paths.sh not found'
17
18samizdat_linux_dir=/boot
19
20: ${GPG_INPUT_DIR:=/cdrom/gnupghome}
21: ${GRUB_CONFIG:=grub.cfg}
22
23if [[ $UID != 0 ]]
24then
25 exit 1
26fi
27
28for d in "$samizdat_linux_dir" "$GPG_INPUT_DIR"
29do
30 if ! test -d "$d"
31 then
32 exit 1
33 fi
34done
35
36start_keys=64 # megs
37end_keys=256 # megs
38
39target=fallacy.img.tmp
40
41initialize_target() 16initialize_target()
42{ 17{
43 rm -f "$target" 18 rm -f "$target"
@@ -56,7 +31,6 @@ partition_target()
56 31
57make_target_bootable() 32make_target_bootable()
58{ 33{
59 version=${1:+-$1}
60 losetup -f "$target" 34 losetup -f "$target"
61 dev=$(losetup -j "$target" -O NAME --noheadings) 35 dev=$(losetup -j "$target" -O NAME --noheadings)
62 36
@@ -121,18 +95,42 @@ add_all()
121 add_grub_cfg 95 add_grub_cfg
122} 96}
123 97
98sanity_checks()
99{
100 [[ $UID = 0 ]] || die "You are not root."
101 for d in "$samizdat_linux_dir" "$GPG_INPUT_DIR"
102 do
103 [ -d "$d" ] || die "Not a directory: $d"
104 done
105}
106
107
108
109
110. samizdat-paths.sh || die 'samizdat-paths.sh not found'
111samizdat_linux_dir=/boot
112: ${GPG_INPUT_DIR:=/cdrom/gnupghome}
113: ${GRUB_CONFIG:=grub.cfg}
114start_keys=64 # megs
115end_keys=256 # megs
116target=fallacy.img.tmp
117
118sanity_checks
124set -e 119set -e
125 120
126if [ ! -e "$target" ] 121if [ ! -e "$target" ]
127then 122then
128 initialize_target 123 initialize_target
129 partition_target 124 partition_target
130 make_target_bootable ${1:4.9.0-0.bpo.2-amd64} 125 make_target_bootable
131 release_target 126 release_target
132fi 127fi
133 128
129if [ "$1" ]
130then
131 version=-$1
132fi
134cp --reflink=always "$target" "$target".keyed 133cp --reflink=always "$target" "$target".keyed
135
136with_target "$target".keyed add_all 134with_target "$target".keyed add_all
137 135
138qemu-system-x86_64 -enable-kvm -smp 2 -m 512 -k en-us -vga qxl -drive file="$target".keyed,format=raw 136qemu-system-x86_64 -enable-kvm -smp 2 -m 512 -k en-us -vga qxl -drive file="$target".keyed,format=raw