-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02_make_addons.sh
executable file
·85 lines (67 loc) · 1.78 KB
/
02_make_addons.sh
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
cd "`dirname \"$0\"`"
log() {
echo "$0 - $@"
}
error() {
log "$@"
exit 1
}
create_example() {
file="live-addon-maker/$1"
shift
log "Executing $command"
log " for $file"
if ! [ -f "$file" ]; then
(
cd "live-addon-maker"
"$@"
)
fi
add_file "$file" "$@"
}
files=""
[ -d "live-addon-maker" ] || \
error "Can not find live-addon-maker directory. Run 01_setup.sh first!"
add_file() {
local file="$1"
shift
[ -f "$file" ] || \
error "File $file not found for command $@"
files="$file $files"
}
addon() {
script="$1"
name="${script:6}"
name="${name%.sh}"
addon="z-$name.squashfs"
[ -e "./$script" ] && script="./$script"
if [ -e "$addon" ]; then
echo "Addon $addon exists"
else
log "Executing $script"
log " for $file"
"$script"
fi
add_file "$addon" "$script"
}
create_example examples/z-idle-python3.5.squashfs \
examples/idle-python3.5.sh
create_example examples/z-sources.list.squashfs \
examples/sources.list.sh
create_example examples/z-arduino-1.8.1-linux64.squashfs \
examples/arduino-1.8.1-linux64.sh
create_example examples/z-flash.squashfs \
examples/flash.sh
#create_example z-app-inventor-starter.squashfs \
# examples/CoderDojoOS-special.sh software/app-inventor-starter
create_example z-PyCharm.squashfs \
examples/CoderDojoOS-special.sh software/PyCharm z-PyCharm.squashfs
create_example z-Scratch2Installer.squashfs \
examples/CoderDojoOS-special.sh software/Scratch2Installer
# examples/CoderDojoOS-special.sh software/hamstermodell
for script in addon-*.sh; do
addon "$script"
done
# Final step: squash the addons
sudo live-addon-maker/merge-addons.sh z-coderdojo.squashfs $files