diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/qemu.sh | 13 | ||||
-rw-r--r-- | src/xorriso-usb.sh | 19 |
2 files changed, 24 insertions, 8 deletions
diff --git a/src/qemu.sh b/src/qemu.sh index 3b355b4..207ca68 100755 --- a/src/qemu.sh +++ b/src/qemu.sh | |||
@@ -24,11 +24,20 @@ initrd=${samizdat_isolinux_dir}/linux/initrd.img | |||
24 | kernel=${samizdat_isolinux_dir}/linux/vmlinuz | 24 | kernel=${samizdat_isolinux_dir}/linux/vmlinuz |
25 | kcmdline='boot=samizdat components quiet splash' | 25 | kcmdline='boot=samizdat components quiet splash' |
26 | 26 | ||
27 | if [ "$QEMU_LOADS_LINUX" ]; then | ||
28 | set -- -initrd "$initrd" -kernel "$kernel" -append "$kcmdline" | ||
29 | fi | ||
30 | |||
31 | if [ "$USE_ISO" ]; then | ||
32 | set -- -cdrom "$iso" | ||
33 | else | ||
34 | set -- -boot n | ||
35 | fi | ||
36 | |||
27 | sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 640 -k en-us \ | 37 | sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 640 -k en-us \ |
28 | -vga qxl \ | 38 | -vga qxl \ |
29 | -net nic,vlan=0,model=virtio \ | 39 | -net nic,vlan=0,model=virtio \ |
30 | -net "$NET" \ | 40 | -net "$NET" \ |
31 | -rtc base=localtime \ | 41 | -rtc base=localtime \ |
32 | -cdrom "$iso" \ | ||
33 | -hda "$disk" \ | 42 | -hda "$disk" \ |
34 | -initrd "$initrd" -kernel "$kernel" -append "$kcmdline" | 43 | "$@" |
diff --git a/src/xorriso-usb.sh b/src/xorriso-usb.sh index ef26cb2..0d7773d 100644 --- a/src/xorriso-usb.sh +++ b/src/xorriso-usb.sh | |||
@@ -12,29 +12,35 @@ efi_dir=$samizdat_grub_efi_dir | |||
12 | 12 | ||
13 | die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; } | 13 | die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; } |
14 | 14 | ||
15 | TEMP="$(getopt -o '' --long adam,usb,detach,in:,out:,test -n "$0" -- "$@")" || | 15 | TEMP="$(getopt -o '' --long bootloader,adam,usb,detach,in:,out:,test -n "$0" -- "$@")" || |
16 | die 'getopt error' | 16 | die 'getopt error' |
17 | eval set -- "$TEMP" | 17 | eval set -- "$TEMP" |
18 | 18 | ||
19 | ADAM=; DETACH=; USB= | 19 | ADAM=; DETACH=; USB=y |
20 | while [ $# -gt 0 ]; do | 20 | while [ $# -gt 0 ]; do |
21 | case "$1" in | 21 | case "$1" in |
22 | --adam) shift; ADAM=y;; | 22 | --adam) shift; ADAM=y;; |
23 | --usb) shift; USB=y;; | 23 | --bootloader) shift; BOOTLOADER_ONLY=y;; |
24 | --cdrom) shift; USB=;; | ||
24 | --detach) shift; DETACH=y;; | 25 | --detach) shift; DETACH=y;; |
25 | --test) shift; QUICK_TEST=y;; | 26 | --test) shift; QUICK_TEST=y;; |
26 | --out) CMDLINE_OUTDEV="$2"; shift 2;; | 27 | --out) CMDLINE_OUTDEV="$2"; USB=; shift 2;; |
27 | --in) INPUT_DEVICE="$2"; shift 2;; | 28 | --in) INPUT_DEVICE="$2"; shift 2;; |
28 | --) shift; break;; | 29 | --) shift; break;; |
29 | *) die 'getopt error';; | 30 | *) die 'getopt error';; |
30 | esac | 31 | esac |
31 | done | 32 | done |
32 | 33 | ||
33 | if [ -z "$INPUT_DEVICE" -a $# = 0 ]; then | 34 | if [ -z "$INPUT_DEVICE" -a $# = 0 -a -z "$BOOTLOADER_ONLY" ]; then |
34 | if mountpoint -q /cdrom; then | 35 | if mountpoint -q /cdrom; then |
35 | INPUT_DEVICE=/cdrom | 36 | INPUT_DEVICE=/cdrom |
36 | elif [ -e debian-live-8.4.0-amd64-standard.btrfs -a -e layer.btrfs ]; then | 37 | elif [ -e debian-live-8.4.0-amd64-standard.btrfs -a -e layer.btrfs ]; then |
37 | set -- debian-live-8.4.0-amd64-standard.btrfs layer.btrfs | 38 | set -- debian-live-8.4.0-amd64-standard.btrfs layer.btrfs |
39 | elif [ -e /srv/nbd.btrfs ]; then | ||
40 | set -- /srv/nbd.btrfs | ||
41 | elif [ "$(blockdev --getsz /dev/nbd0)" -gt 0 ]; then | ||
42 | (set -x; dd if=/dev/nbd0 of=/srv/nbd.btrfs~ && mv /srv/nbd.btrfs~ /srv/nbd.btrfs) || die "failed to copy network block device" | ||
43 | set -- /srv/nbd.btrfs | ||
38 | else | 44 | else |
39 | die "no input device and no input btrfs layers: aborting." | 45 | die "no input device and no input btrfs layers: aborting." |
40 | fi | 46 | fi |
@@ -113,7 +119,7 @@ choose_outdev() | |||
113 | 119 | ||
114 | generate_keys() | 120 | generate_keys() |
115 | { | 121 | { |
116 | if [ "$ADAM" ]; then | 122 | if [ "$ADAM" -o "$BOOTLOADER_ONLY" ]; then |
117 | kiki init || die 'kiki init failed' | 123 | kiki init || die 'kiki init failed' |
118 | gnupghome=/root/.gnupg | 124 | gnupghome=/root/.gnupg |
119 | else | 125 | else |
@@ -170,6 +176,7 @@ if [ "$REPLACE_INITRD" ]; then | |||
170 | # support tftp pointing to the cdrom. This probably means a tftp directory | 176 | # support tftp pointing to the cdrom. This probably means a tftp directory |
171 | # that contains a symlink to /cdrom/linux which gets updated on success here | 177 | # that contains a symlink to /cdrom/linux which gets updated on success here |
172 | mv "${vmlinuz_dir}" "${vmlinuz_dir}".bak | 178 | mv "${vmlinuz_dir}" "${vmlinuz_dir}".bak |
179 | mkdir "${vmlinuz_dir}" | ||
173 | initrd.sh || { | 180 | initrd.sh || { |
174 | mv "${vmlinuz_dir}.bak" "${vmlinuz_dir}" | 181 | mv "${vmlinuz_dir}.bak" "${vmlinuz_dir}" |
175 | die 'initrd.sh failed' | 182 | die 'initrd.sh failed' |