-
Notifications
You must be signed in to change notification settings - Fork 81
/
install.sh
117 lines (108 loc) · 3.5 KB
/
install.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
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/ksh
# This script installs esd files and scripts of the toolbox
# Coded by Olli and lprot
echo ' __ __ ___ ___ ___ _____ ___ ___ _____ _ _ '
echo '| \/ |_ _| _ ) / __|_ _| \_ ) |_ _|__ ___| | |__ _____ __'
echo '| |\/| || || _ \ \__ \ | | | |) / / | |/ _ \/ _ \ | _ \/ _ \ \ /'
echo '|_| |_|___|___/ |___/ |_| |___/___| |_|\___/\___/_|_.__/\___/_\_\'
echo
echo "This script will inject mibstd2_toolbox to Green Engineering Menu"
echo
TOOLBOX_FOLDER=/cpu/onlineservices/1/default/tsd/etc/persistence/esd
VOLUME=""
DESTINATION=""
ESD_FOLDER=/tsd/etc/persistence/esd
# Search toolbox folder
for i in /media/mp00*; do
if [ -d "$i$TOOLBOX_FOLDER" ]; then
VOLUME=$i
break
fi
done
if [ -z "$VOLUME" ]; then
for i in /fs/*; do
if [ -d "$i$TOOLBOX_FOLDER" ]; then
VOLUME=$i
break
fi
done
fi
if [ -z "$VOLUME" ]; then
for i in /mnt/*; do
if [ -d "$i$TOOLBOX_FOLDER" ]; then
VOLUME=$i
break
fi
done
fi
if [ -z "$VOLUME" ]; then
if [ -d "/tmp$TOOLBOX_FOLDER" ]; then
VOLUME="/tmp"
fi
fi
if [ -z "$VOLUME" ]; then
if [ -d "/dev/sdcard$TOOLBOX_FOLDER" ]; then
VOLUME="/dev/sdcard"
fi
fi
if [ -z "$VOLUME" ]; then
echo "ERROR: Cannot find a drive with the Toolbox!"
exit 1
fi
echo "Toolbox is found on $VOLUME"
for i in /fs/*; do
if [ -d "$i$ESD_FOLDER" ]; then
DESTINATION=$i
break
fi
done
if [ -z "$DESTINATION" ]; then
if [ -d "/emmc$ESD_FOLDER" ]; then
DESTINATION=/emmc
fi
fi
if [ -d "$DESTINATION$ESD_FOLDER" ]; then
echo "Destination is: $DESTINATION"
if [ -z "$DESTINATION" ]; then
echo "Mounting system volume in read/write mode"
mount -t qnx6 -o remount,rw /dev/hd0t177 /
fi
# Clean before installation
rm -f $DESTINATION/tsd/etc/persistence/esd/mib2std-*.esd
rm -f $DESTINATION/tsd/etc/persistence/esd/mibstd2_yox.esd
rm -f $DESTINATION/tsd/etc/persistence/esd/TOOLBOX.esd
rm -f $DESTINATION/tsd/etc/persistence/esd/mib2std_yox.esd
rm -rf $DESTINATION/tsd/scripts
rm -f $DESTINATION/tsd/etc/persistence/esd/mibstd2-*.esd
rm -rf $DESTINATION/tsd/etc/persistence/esd/scripts
# Copy toolbox screens and scripts
echo "Copying toolbox Green Engineering Menu screens and scripts..."
cp -rf $VOLUME$TOOLBOX_FOLDER/* $DESTINATION/tsd/etc/persistence/esd
echo "Done."
echo "Setting execution attributes to scripts..."
chmod a+rwx $DESTINATION/tsd/etc/persistence/esd/scripts/*.sh
echo "Done."
# Upgrage GEM 3.4/3.5/4.3 to 4.11 if found
#GEM_SIZE=$(ls -la "$DESTINATION/tsd/hmi/HMI/jar/GEM.jar" | awk '{print $5}' 2>/dev/null)
#if [[ "$GEM_SIZE" = "187047" || "$GEM_SIZE" = "187234" || "$GEM_SIZE" = "242383" ]]; then
echo "Updating GEM to version 4.11..."
if [[ -e "$VOLUME/toolbox/gem/cpu/onlineservices/1/default/tsd/bin/system/GEM.jar" ]]; then
cp -fv $VOLUME/toolbox/gem/cpu/onlineservices/1/default/tsd/bin/system/GEM.jar $DESTINATION/tsd/hmi/HMI/jar/GEM.jar
echo "GEM update is finished."
elif [[ -e "$VOLUME/toolbox/gem/cpu/onlineservices/1/default/tsd/bin/system/gem.jar" ]]; then
cp -fv $VOLUME/toolbox/gem/cpu/onlineservices/1/default/tsd/bin/system/gem.jar $DESTINATION/tsd/hmi/HMI/jar/GEM.jar
echo "GEM update is finished."
else
echo "Error! Can't find $VOLUME/toolbox/gem/cpu/onlineservices/1/default/tsd/bin/system/GEM.jar"
fi
#fi
sync
if [ -z "$DESTINATION" ]; then
echo "Mounting system volume in read/only mode"
mount -t qnx6 -o remount,ro /dev/hd0t177 /
fi
echo
echo "Installation of the toolbox is done. Now you can open Green Engineering Menu :)"
else
echo "ERROR: $DESTINATION$ESD_FOLDER is not found!"
fi