@@ -23,15 +23,15 @@ function log() {
2323 echo " ` date` : ${* } " >> /mnt/udisk/aGVscF9zb3Nf/install.log
2424}
2525function progress() {
26- if [[ " ${ * } " == " success" ] ]; then
26+ if [ " $1 " == " success" ]; then
2727 fb_draw " drawbox=x=16:y=16:w=32:h=ih-32:t=fill:color=black,drawbox=x=20:y=20:w=24:h=ih-40:t=fill:color=green"
2828 return
2929 fi
30- if [[ " ${ * } " == " error" ] ]; then
30+ if [ " $1 " == " error" ]; then
3131 fb_draw " drawbox=x=16:y=16:w=32:h=ih-32:t=fill:color=black,drawbox=x=20:y=20:w=24:h=ih-40:t=fill:color=red"
3232 return
3333 fi
34- if [[ ${ * } == 0 ] ]; then
34+ if [ $1 == 0 ]; then
3535 fb_draw " drawbox=x=16:y=16:w=32:h=ih-32:t=fill:color=black"
3636 return
3737 fi
@@ -55,6 +55,7 @@ function fb_draw() {
5555}
5656
5757
58+ log
5859log " Starting Rinkhals installation..."
5960
6061
@@ -81,9 +82,20 @@ if [[ "$KOBRA_VERSION" != "2.3.5.3" ]]; then
8182fi
8283
8384
84- # Backup the machine-specific files
85+ # Stop Rinkhals if it is running already
8586progress 0.1
87+ if [ -f /useremain/rinkhals/.current/stop.sh ]; then
88+ log " Stopping Rinkhals"
89+
90+ chmod +x /useremain/rinkhals/.current/stop.sh
91+ /useremain/rinkhals/.current/stop.sh
92+ fi
93+
8694
95+ # Backup the machine-specific files
96+ progress 0.2
97+
98+ log " Backing up machine-specific files"
8799rm -f /mnt/udisk/aGVscF9zb3Nf/device.ini
88100rm -f /mnt/udisk/aGVscF9zb3Nf/device_account.json
89101cp /userdata/app/gk/config/device.ini /mnt/udisk/aGVscF9zb3Nf/device.ini
@@ -94,18 +106,20 @@ cp /userdata/app/gk/config/device_account.json /mnt/udisk/aGVscF9zb3Nf/device_ac
94106
95107
96108# Copy Rinkhals
97- progress 0.2
109+ progress 0.3
98110
99111RINKHALS_VERSION=` cat ${update_file_path} /.version`
100112log " Installing Rinkhals version $RINKHALS_VERSION "
101113
114+ log " Copying Rinkhals files"
102115mkdir -p /useremain/rinkhals/${RINKHALS_VERSION}
103116rm -rf /useremain/rinkhals/${RINKHALS_VERSION} /*
104117cp -r ${update_file_path} /rinkhals/* /useremain/rinkhals/${RINKHALS_VERSION}
105118echo ${RINKHALS_VERSION} > /useremain/rinkhals/${RINKHALS_VERSION} /.version
106119
107120progress 0.8
108121
122+ log " Copying Rinkhals startup files"
109123rm -f /useremain/rinkhals/* .*
110124cp ${update_file_path} /start-rinkhals.sh /useremain/rinkhals/start-rinkhals.sh
111125cp ${update_file_path} /start.sh.patch /useremain/rinkhals/start.sh.patch
127141 log " Rinkhals loader was detected, skipping installation"
128142fi
129143
144+ log " Removing update files"
130145rm -rf ${update_file_path}
131146rm -rf ${to_gcode_path} /update.swu
132147rm -rf ${swu_path} /update.swu
0 commit comments