File tree Expand file tree Collapse file tree 2 files changed +32
-13
lines changed Expand file tree Collapse file tree 2 files changed +32
-13
lines changed Original file line number Diff line number Diff line change 9
9
#
10
10
# Usage:
11
11
#
12
- # ./boot.sh PRESET [option] DISK ISO
12
+ # ./boot.sh PRESET [option] DISK_file [ISO_file]
13
13
#
14
14
# See the blocks in code for options.
15
15
#
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env zsh
1
2
2
- bash -n " $0 " || exit 1
3
+ set -xe
3
4
4
- set -x
5
+ zsh -n " $0 "
5
6
6
- [[ -n " $1 " ]]
7
+ [[ " $1 " == ' -n' ]] && {
8
+ RM=y
9
+ shift || :
10
+ :
11
+ } || RM=
7
12
8
- [[ -r disk.raw ]] && rm disk.raw
9
- [[ -r disk.qcow2 ]] && rm disk.qcow2
13
+ [[ " $1 " == ' -r' ]] && {
14
+ RAW=y
15
+ shift || :
16
+ :
17
+ } || RAW=
10
18
11
- [[ " $1 " == " -r" ]] && {
12
- qemu-img create -f raw disk.raw 10G
13
- exit
14
- }
19
+ n=" ${1:- } "
20
+
21
+ [[ -n " $n " ]]
22
+
23
+ [[ -n " $RAW " ]] && {
24
+ f=raw
25
+ :
26
+ } || f=qcow2
15
27
16
- [[ " $1 " == " -q" ]] && {
17
- qemu-img create -f qcow2 disk.qcow2 10G
18
- exit
28
+ d=" disk-${n} .${f} "
29
+
30
+ [[ -n " $RM " ]] && {
31
+ rm -f " $d " || :
32
+ :
33
+ } || {
34
+
35
+ [[ -r " $d " ]] && exit 2
19
36
}
20
37
38
+ qemu-img create -f " $f " " $d " 10G
39
+
You can’t perform that action at this time.
0 commit comments