forked from nvllsvm/freecyngn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
99-busybox.sh
60 lines (51 loc) · 1.08 KB
/
99-busybox.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
#!/sbin/sh
#
# /system/addon.d/99-busybox.sh
# Backup and restore busybox
#
. /tmp/backuptool.functions
do_action() {
action="$1"
bb_install=$(cat "$2")
bb="$bb_install/busybox"
[ -z "$bb_install" ] && exit 1
if [ "$action" = "backup" ]; then
local_bb="$bb"
[ ! -f "$local_bb" ] && exit 1
backup_file "$bb"
echo "$bb_install" > /tmp/busybox-install-dir
elif [ "$action" = "restore" ]; then
local_bb="$C/$bb"
[ ! -f "$local_bb" ] && exit 1
restore_file "$bb"
fi
"$local_bb" --list | while read applet; do
file="$bb_install/$applet"
if [ "$action" = "backup" ]; then
link=$(readlink -f "$file")
[ -f "$file" -a "$link" = "$bb" ] && backup_file "$file"
elif [ "$action" = "restore" ]; then
[ -f "$C/$file" ] && restore_file "$file"
fi
done
}
case "$1" in
backup)
do_action backup "$S/addon.d/busybox-install-dir"
;;
restore)
do_action restore "/tmp/busybox-install-dir"
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac