blob: 0445eab0686284658b7edf96b44c0b574269bdbe (
plain)
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
|
remount_root(){
local tmpmount=$modpath/var.tmp
mkdir -p "$tmpmount"
mount --move "$mountpoint/var" "$tmpmount"
umount "$mountpoint"
local loopfile=$tmpmount${1##$mountpoint/var}
mount -o loop,ro "$loopfile" "$mountpoint" || shutdown
mount --move "$tmpmount" "$mountpoint/var"
}
load_firmware(){
[ -d "$firmwarepath" ] || return 0
local firmware=$(find "$firmwarepath" -type f -name "*.hsqs" | sort | head -n 1)
[ -f "$firmware" ] || return 0
remount_root "$firmware" && cryptsetup close root-crypt
}
shutdown(){
echo shutting down...
umount -a
poweroff -f
while :;do :;done
}
early_getty(){
getty -ni 115200 ttyS0 -l /bin/sh
}
copy(){
# we must create target directory if source is directory
[ -d "$1" ] && mkdir -p "$2"
rsync -ac "$1" "$2"
}
restore(){
copy "$mountpoint$1" "$rootfs$1"
}
mount_bind(){
if mountpoint -q "$2"; then
umount "$2" || umount -f "$2"
fi
mount -o bind "$1" "$2"
}
overmount(){
if [ "$#" == "1" ]; then
echo overmounting $1
mount_bind "$rootfs$1" "$mountpoint$1"
fi
if [ "$#" == "2" ]; then
echo overmounting $1 on $2
mount_bind "$1" "$mountpoint$2"
fi
}
overmount_games(){
local menu_code=000
[ -f "$installpath/menu" ] && menu_code=$(cat "$installpath/menu")
[ -z "$menu_code" ] && menu_code=000
echo Menu code: $menu_code
if [ "$menu_code" == "000" ]; then
overmount "$gamepath"
else
overmount "$rootfs$gamepath/$menu_code" "$gamepath"
fi
}
|