-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync2ramdisk.sh
executable file
·54 lines (53 loc) · 1.44 KB
/
sync2ramdisk.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
d="recovery/root";
r="/data/local/AIK-mobile/ramdisk";
echo "########sync $d to:";
echo "$r";
echo -n "Press enter to continue.";
read;
_od="$PWD"
ssize () {
test "$(stat -c "%s" "$1")" = "$(stat -c "%s" "$2")";
}
smd5sum () {
test "$(md5sum -b "$1")" = "$(md5sum -b "$2")";
}
choice () {
local _a;
test -n "$*" && echo "$*";
echo -n " ? choice [y]?: ";
read -r _a;
test "$_a" = "y";
}
cd "$d" && {
_g=$(find . -type f -print);
for f in $_g; do
f="${f:2}";
# echo -n "$f";
if test -f "$r/$f"; then
if ! ssize "$f" "$r/$f"; then
choice " ! diff in file size: $f" && cat "$f" > "$r/$f";
echo " * [$?]re-sized: $f";
else
if smd5sum "$f" "$r/$f"; then
echo " - same: $f";
else
cat "$f" > "$r/$f" 2>/dev/null;
echo " * [$?]patched: $f";
fi
fi
else
cp "$f" "$r/$f" 2>/dev/null;
echo " + [$?] new: $f";
fi
done
cd "$_od"
} || echo "access error: $d"
echo "patching system/bin/recovery not download updates, press enter to continue"
read
sed -i 's|/system/bin/aria2c|/system/bin/aria2_|' "$r/system/bin/recovery";
echo "Press entery continue mod log..."
read
sed -i 's|/tmp/recovery.log|/cache/recovery.g|' "$r/system/bin/recovery";
sed -i 's|/tmp/guardianangle.log|/cache/guardianangle.g|' "$r/system/bin/recovery";
sed -i 's|/tmp/recovery.log|/cache/recovery.g|' "$r/system/bin/guardianangle";
sed -i 's|/tmp/guardianangle.log|/cache/guardianangle.g|' "$r/system/bin/guardianangle";