set_device case in hanlin-v3 hanlin-v3ext DEVICE echo Unknown device e

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
set_device() {
case "$1" in
hanlin-v3|hanlin-v3ext) DEVICE="$1";;
*) echo "Unknown device: $1"; exit 1;;
esac
case "$DEVICE" in
hanlin-v3) KERNEL_FLAVOUR=-v3;;
hanlin-v3ext) KERNEL_FLAVOUR=-v3ext;;
esac
}
set_mode() {
case "$1" in
install|live|nfsroot) MODE="$1";;
*) echo "Unknown mode: $1"; exit 1;;
esac
}
usage() {
echo "Usage: build-v3 [--skip-bootstrap]"
echo " [(-d |--device=)(hanlin-v3|hanlin-v3ext)]"
echo " [(-m |--mode=)(install|live|nfsroot)]"
echo " [<version>]"
echo
echo "device defaults to 'hanlin-v3',"
echo "mode defaults to 'install',"
echo "version defaults to today's snapshot."
}
TMP=$(getopt -l skip-bootstrap,device:,mode: -o hd:m: -- "$@")
if [ $? != 0 ]; then
exit 1
fi
eval set -- "$TEMP"
while true; do
case "$1" in
--skip-bootstrap) SKIP_BOOTSTRAP=1; shift;;
-d|--device) set_device "$2"; shift; shift;;
-m|--mode) set_mode "$2"; shift; shift;;
-h) usage; exit 0;;
--) shift; break;;
*) echo "Unexpected argument in getopt parsing: $1"; exit 1;;
esac
done