-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathmake-script
executable file
·65 lines (46 loc) · 1.24 KB
/
make-script
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
set -e
catCommonScripts() {
local dir="$(dirname "$1")"
if [ "$dir" != "." ]; then
catCommonScripts "$dir"
local commonScript="$dir/common.sh"
if [ -f "$commonScript" ]; then
>>"$out" cat "$commonScript"
>>"$out" echo
fi
fi
}
makeScript() {
device="$1"
out="${2:-build/lanchon-repit-$device.sh}"
deviceScript="$(find device -name "$device.sh")"
if [ "$device" == "common" ] || [ ! -f "$deviceScript" ]; then
>&2 echo "error: invalid device: '$device'"
exit 1
fi
rm -f "$out"
>>"$out" cat repit.sh
>>"$out" echo
>>"$out" cat repit-par-tools.sh
>>"$out" echo
>>"$out" cat repit-fs-ext4.sh
>>"$out" echo
>>"$out" cat repit-fs-vfat.sh
>>"$out" echo
>>"$out" cat repit-fs-f2fs.sh
>>"$out" echo
>>"$out" cat repit-fs-swap.sh
>>"$out" echo
>>"$out" cat repit-fs-raw.sh
>>"$out" echo
catCommonScripts "$deviceScript"
>>"$out" cat "$deviceScript"
>>"$out" echo
>>"$out" echo "#####################################################"
>>"$out" echo
>>"$out" printf 'deviceName=%q\n' "$device"
>>"$out" echo
>>"$out" echo 'main "$@"'
}
makeScript "$@"