/
boot.cfg_installer.sh
106 lines (105 loc) · 2.58 KB
/
boot.cfg_installer.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/system/bin/sh
#Android Kexecboot boot.cfg/restorer Installer - TF700t-AKBI v2.6.8
# 07/31/2014
#by workdowg@xda
#This script must be run in the directory it was extracted to
# fail on errors
set -e
#Test for root access
perm=$(id|cut -b 5)
if [ "$perm" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
#cd into correct directory
workingdir=$(dirname "$0")
cd $workingdir
#Test for correct directory
if [ ! -f boot.cfg ] ; then
echo "You are not running this script"
echo "from the correct directory. Exiting"
exit
fi
#boot.cfg installer
echo ""
echo ""
echo ""
echo ""
echo "========================================================"
echo "Kexecboot boot.cfg installer/restorer by workdowg@xda"
echo "========================================================"
echo ""
echo ""
echo "With this script you can:"
echo ""
echo "1) Install default boot.cfg (and backup exsisting)"
echo "2) Restore boot.cfg.old (NO backup of exsisting)"
echo "3) Exit"
echo ""
read z
echo ""
case $z in
1) mkdir -p /data/media/0/kexecbootcfg
mount -t vfat /dev/block/mmcblk0p5 /data/media/0/kexecbootcfg/
echo "Backing up boot.cfg..."
if [ -f /data/media/0/kexecbootcfg/multiboot/boot.cfg ]
then cp -f /data/media/0/kexecbootcfg/multiboot/boot.cfg boot.cfg.old
fi
mkdir -p /data/media/0/kexecbootcfg/multiboot/
cp boot.cfg /data/media/0/kexecbootcfg/multiboot/
echo ""
echo ""
echo "Copying default boot.cfg..."
echo ""
echo ""
echo "Waiting for sync..."
sleep 10
umount /data/media/0/kexecbootcfg/
rm -r /data/media/0/kexecbootcfg
echo ""
echo ""
echo "Kexecboot boot.cfg installer - Done!"
echo ""
echo "Press enter to continue or ctr+c to exit"
read
sh ./TF700t-AKBI.sh ;;
2) ls *.old || echo "No boot.cfg.old found"
echo ""
ls
echo ""
echo "Enter a file to restore..."
echo ""
read oldfile
if [ ! -f "$oldfile" ] ; then
echo ""
echo "File doesn't exist or entred wrong, run installer again."
exit 1
fi
echo ""
mkdir -p /data/media/0/kexecbootcfg
mount -t vfat /dev/block/mmcblk0p5 /data/media/0/kexecbootcfg/
cp -f "$oldfile" /data/media/0/kexecbootcfg/multiboot/boot.cfg
echo ""
echo ""
echo "Restoring $oldfile ..."
echo ""
echo ""
echo "Waiting for sync..."
sleep 10
umount /data/media/0/kexecbootcfg/
rm -r /data/media/0/kexecbootcfg
echo ""
echo ""
echo "Kexecboot boot.cfg installer - Done!"
echo ""
echo "Press enter to continue or ctr+c to exit"
read
sh ./TF700t-AKBI.sh ;;
3) echo "Exiting..."
echo ""
exit 1 ;;
*) echo "Invalid selection, run installer again"
echo ""
exit
esac
read