rclone_script-install-dialog.sh 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126
  1. #!/bin/bash
  2. # define colors for output
  3. NORMAL="\Zn"
  4. BLACK="\Z0"
  5. RED="\Z1"
  6. GREEN="\Z2"
  7. YELLOW="\Z3\Zb"
  8. BLUE="\Z4"
  9. MAGENTA="\Z5"
  10. CYAN="\Z6"
  11. WHITE="\Z7"
  12. BOLD="\Zb"
  13. REVERSE="\Zr"
  14. UNDERLINE="\Zu"
  15. # global variables
  16. url="https://raw.githubusercontent.com/Jandalf81/rclone_script"
  17. branch="beta"
  18. # configuration variables
  19. remotebasedir=""
  20. shownotifications=""
  21. backtitle="RCLONE_SCRIPT installer"
  22. ##################
  23. # WELCOME DIALOG #
  24. ##################
  25. dialog \
  26. --backtitle "${backtitle}" \
  27. --title "Welcome" \
  28. --ascii-lines \
  29. --colors \
  30. --no-collapse \
  31. --cr-wrap \
  32. --yesno \
  33. "\nThis script will configure RetroPie so that your savefiles and statefiles will be ${YELLOW}synchronized with a remote destination${NORMAL}. Several packages and scripts will be installed, see\n\n https://github.com/Jandalf81/rclone_script/blob/master/ReadMe.md\n\nfor a rundown. In short, any time you ${GREEN}start${NORMAL} or ${RED}stop${NORMAL} a ROM the savefiles and savestates for that ROM will be ${GREEN}down-${NORMAL} and ${RED}uploaded${NORMAL} ${GREEN}from${NORMAL} and ${RED}to${NORMAL} a remote destination. To do so, RetroPie will be configured to put all savefiles and statefiles in distinct directories, seperated from the ROMS directories. If you already have some savefiles there, you will need to ${YELLOW}move them manually${NORMAL} after installation.\n\nAre you sure you wish to continue?" \
  34. 20 90 2>&1 > /dev/tty \
  35. || exit
  36. ####################
  37. # DIALOG FUNCTIONS #
  38. ####################
  39. # Warn the user if they are using the BETA branch
  40. function dialogBetaWarning ()
  41. {
  42. dialog \
  43. --backtitle "${backtitle}" \
  44. --title "Beta Warning" \
  45. --ascii-lines \
  46. --colors \
  47. --no-collapse \
  48. --cr-wrap \
  49. --yesno \
  50. "\n${RED}${UNDERLINE}WARNING!${NORMAL}\n\nYou are about to install a beta version!\nAre you ${RED}REALLY${NORMAL} sure you want to continue?" \
  51. 10 50 2>&1 > /dev/tty \
  52. || exit
  53. }
  54. # Build progress from array $STEPS()
  55. # INPUT
  56. # $steps()
  57. # OUTPUT
  58. # $progress
  59. function buildProgress ()
  60. {
  61. progress=""
  62. for ((i=0; i<=${#steps[*]}; i++))
  63. do
  64. progress="${progress}${steps[i]}\n"
  65. done
  66. }
  67. # Show Progress dialog
  68. # INPUT
  69. # 1 > Percentage to show in dialog
  70. # $backtitle
  71. # $progress
  72. function dialogShowProgress ()
  73. {
  74. local percent="$1"
  75. buildProgress
  76. clear
  77. clear
  78. echo "${percent}" | dialog \
  79. --stdout \
  80. --colors \
  81. --ascii-lines \
  82. --no-collapse \
  83. --cr-wrap \
  84. --backtitle "${backtitle}" \
  85. --title "Installer" \
  86. --gauge "${progress}" 36 90 0 \
  87. 2>&1 > /dev/tty
  88. sleep 1
  89. }
  90. # Show summary dialog
  91. function dialogShowSummary ()
  92. {
  93. # list all remotes and their type
  94. remotes=$(rclone listremotes -l)
  95. # get line wiht RETROPIE remote
  96. retval=$(grep -i "^retropie:" <<< ${remotes})
  97. remoteType="${retval#*:}"
  98. remoteType=$(echo ${remoteType} | xargs)
  99. dialog \
  100. --backtitle "${backtitle}" \
  101. --title "Summary" \
  102. --ascii-lines \
  103. --colors \
  104. --no-collapse \
  105. --cr-wrap \
  106. --yesno \
  107. "\n${GREEN}All done!${NORMAL}\n\nFrom now on, all your saves and states will be synchronized each time you start or stop a ROM.\n\nAll system will put their saves and states in\n Local: \"${YELLOW}~/RetroPie/saves/<SYSTEM>${NORMAL}\"\n Remote: \"${YELLOW}retropie:${remotebasedir}/<SYSTEM>\" (${remoteType})${NORMAL}\nIf you already have some saves in the ROM directories, you need to move them there manually now! Afterward, you should ${red}reboot${NORMAL} your RetroPie. Then, you should start a full sync via\n ${YELLOW}RetroPie / RCLONE_SCRIPT menu / 1 Full sync${NORMAL}\n\nCall\n ${YELLOW}RetroPie / RCLONE_SCRIPT menu / 9 uninstall${NORMAL}\nto remove all or parts of this script.\n\n${RED}Reboot RetroPie now?${NORMAL}" 25 90
  108. case $? in
  109. 0) sudo shutdown -r now ;;
  110. esac
  111. }
  112. ##################
  113. # STEP FUNCTIONS #
  114. ##################
  115. # Initialize array $STEPS()
  116. # OUTPUT
  117. # $steps()
  118. function initSteps ()
  119. {
  120. steps[1]="1. RCLONE"
  121. steps[2]=" 1a. Test for RCLONE binary [ waiting... ]"
  122. steps[3]=" 1b. Get RCLONE binary [ waiting... ]"
  123. steps[4]=" 1c. Test RCLONE remote [ waiting... ]"
  124. steps[5]=" 1d. Create RCLONE remote [ waiting... ]"
  125. steps[6]="2. PNGVIEW"
  126. steps[7]=" 2a. Test for PNGVIEW binary [ waiting... ]"
  127. steps[8]=" 2b. Get PNGVIEW source [ waiting... ]"
  128. steps[9]=" 2c. Compile PNGVIEW [ waiting... ]"
  129. steps[10]="3. IMAGEMAGICK"
  130. steps[11]=" 3a. Test for IMAGEMAGICK [ waiting... ]"
  131. steps[12]=" 3b. Get IMAGEMAGICK [ waiting... ]"
  132. steps[13]="4. RCLONE_SCRIPT"
  133. steps[14]=" 4a. Get RCLONE_SCRIPT files [ waiting... ]"
  134. steps[15]=" 4b. Create RCLONE_SCRIPT menu item [ waiting... ]"
  135. steps[16]=" 4c. Configure RCLONE_SCRIPT [ waiting... ]"
  136. steps[17]="5. RUNCOMMAND"
  137. steps[18]=" 5a. Add call to RUNCOMMAND-ONSTART [ waiting... ]"
  138. steps[19]=" 5b. Add call to RUNCOMMAND-ONEND [ waiting... ]"
  139. steps[20]="6. Local SAVEFILE directory"
  140. steps[21]=" 6a. Check local base directory [ waiting... ]"
  141. steps[22]=" 6b. Check local <SYSTEM> directories [ waiting... ]"
  142. steps[23]="7. Remote SAVEFILE directory"
  143. steps[24]=" 7a. Check remote base directory [ waiting... ]"
  144. steps[25]=" 7b. Check remote <SYSTEM> directories [ waiting... ]"
  145. steps[26]="8. Configure RETROARCH"
  146. steps[27]=" 8a. Set local SAVEFILE directories [ waiting... ]"
  147. steps[28]="9. Finalizing"
  148. steps[29]=" 9a. Save configuration [ waiting... ]"
  149. }
  150. # Update item of $STEPS() and show updated progress dialog
  151. # INPUT
  152. # 1 > Number of step to update
  153. # 2 > New status for step
  154. # 3 > Percentage to show in progress dialog
  155. # $steps()
  156. # OUTPUT
  157. # $steps()
  158. function updateStep ()
  159. {
  160. local step="$1"
  161. local newStatus="$2"
  162. local percent="$3"
  163. local oldline
  164. local newline
  165. # translate and colorize $NEWSTATUS
  166. case "${newStatus}" in
  167. "waiting") newStatus="[ ${NORMAL}WAITING...${NORMAL} ]" ;;
  168. "in progress") newStatus="[ ${NORMAL}IN PROGRESS${NORMAL} ]" ;;
  169. "done") newStatus="[ ${GREEN}DONE${NORMAL} ]" ;;
  170. "found") newStatus="[ ${GREEN}FOUND${NORMAL} ]" ;;
  171. "not found") newStatus="[ ${RED}NOT FOUND${NORMAL} ]" ;;
  172. "created") newStatus="[ ${GREEN}CREATED${NORMAL} ]" ;;
  173. "failed") newStatus="[ ${RED}FAILED${NORMAL} ]" ;;
  174. "skipped") newStatus="[ ${YELLOW}SKIPPED${NORMAL} ]" ;;
  175. *) newStatus="[ ${RED}UNDEFINED${NORMAL} ]" ;;
  176. esac
  177. # search $STEP in $STEPS
  178. for ((i=0; i<${#steps[*]}; i++))
  179. do
  180. if [[ ${steps[i]} =~ .*$step.* ]]
  181. then
  182. # update $STEP with $NEWSTATUS
  183. oldline="${steps[i]}"
  184. oldline="${oldline%%[*}"
  185. newline="${oldline}${newStatus}"
  186. steps[i]="${newline}"
  187. break
  188. fi
  189. done
  190. # show progress dialog
  191. dialogShowProgress ${percent}
  192. }
  193. #######################
  194. # INSTALLER FUNCTIONS #
  195. #######################
  196. # Installer
  197. function installer ()
  198. {
  199. initSteps
  200. dialogShowProgress 0
  201. 1RCLONE
  202. 2PNGVIEW
  203. 3IMAGEMAGICK
  204. 4RCLONE_SCRIPT
  205. 5RUNCOMMAND
  206. 6LocalSAVEFILEDirectory
  207. 7RemoteSAVEFILEDirectory
  208. 8ConfigureRETROARCH
  209. 9Finalize
  210. dialogShowSummary
  211. }
  212. function 1RCLONE ()
  213. {
  214. # 1a. Testing for RCLONE binary
  215. updateStep "1a" "in progress" 0
  216. 1aTestRCLONE
  217. if [[ $? -eq 0 ]]
  218. then
  219. updateStep "1a" "found" 5
  220. updateStep "1b" "skipped" 10
  221. else
  222. updateStep "1a" "not found" 5
  223. # 1b. Getting RCLONE binary
  224. updateStep "1b" "in progress" 5
  225. 1bInstallRCLONE
  226. if [[ $? -eq 0 ]]
  227. then
  228. updateStep "1b" "done" 10
  229. else
  230. updateStep "1b" "failed" 5
  231. fi
  232. fi
  233. # 1c. Testing RCLONE configuration
  234. updateStep "1c" "in progress" 10
  235. 1cTestRCLONEremote
  236. if [[ $? -eq 0 ]]
  237. then
  238. updateStep "1c" "found" 15
  239. updateStep "1d" "skipped" 20
  240. else
  241. updateStep "1c" "not found" 15
  242. # 1d. Create RCLONE remote
  243. updateStep "1d" "in progress" 15
  244. 1dCreateRCLONEremote
  245. updateStep "1d" "done" 20
  246. fi
  247. }
  248. # Checks if RCLONE is installed
  249. # RETURN
  250. # 0 > RCLONE is installed
  251. # 1 > RCLONE is not installed
  252. function 1aTestRCLONE ()
  253. {
  254. printf "$(date +%FT%T%:z):\t1aTestRCLONE\tSTART\n" >> ./rclone_script-install.log
  255. if [ -f /usr/bin/rclone ]
  256. then
  257. printf "$(date +%FT%T%:z):\t1aTestRCLONE\tFOUND\n" >> ./rclone_script-install.log
  258. return 0
  259. else
  260. printf "$(date +%FT%T%:z):\t1aTestRCLONE\tNOT FOUND\n" >> ./rclone_script-install.log
  261. return 1
  262. fi
  263. }
  264. # Installs RCLONE by download
  265. # RETURN
  266. # 0 > RCLONE has been installed
  267. # 1 > Error while installing RCLONE
  268. function 1bInstallRCLONE ()
  269. {
  270. printf "$(date +%FT%T%:z):\t1bInstallRCLONE\tSTART\n" >> ./rclone_script-install.log
  271. # TODO get RCLONE for 64bit
  272. { # try
  273. # get binary
  274. wget -P ~ https://downloads.rclone.org/rclone-current-linux-arm.zip --append-output=./rclone_script-install.log &&
  275. unzip ~/rclone-current-linux-arm.zip -d ~ >> ./rclone_script-install.log &&
  276. cd ~/rclone-v* &&
  277. # move binary
  278. sudo mv rclone /usr/bin >> ./rclone_script-install.log &&
  279. sudo chown root:root /usr/bin/rclone >> ./rclone_script-install.log &&
  280. sudo chmod 755 /usr/bin/rclone >> ./rclone_script-install.log &&
  281. cd ~ &&
  282. # remove temp files
  283. rm ~/rclone-current-linux-arm.zip >> ./rclone_script-install.log &&
  284. rm -r ~/rclone-v* >> ./rclone_script-install.log &&
  285. printf "$(date +%FT%T%:z):\t1bInstallRCLONE\tDONE\n" >> ./rclone_script-install.log
  286. return 0
  287. } || { #catch
  288. printf "$(date +%FT%T%:z):\t1bInstallRCLONE\tERROR\n" >> ./rclone_script-install.log
  289. # remove temp files
  290. rm ~/rclone-current-linux-arm.zip >> ./rclone_script-install.log &&
  291. rm -r ~/rclone-v* >> ./rclone_script-install.log &&
  292. return 1
  293. }
  294. }
  295. # Checks if there's a RCLONE remote called RETROPIE
  296. # RETURN
  297. # 0 > remote RETROPIE has been found
  298. # 1 > no remote RETROPIE found
  299. function 1cTestRCLONEremote ()
  300. {
  301. printf "$(date +%FT%T%:z):\t1cTestRCLONEremote\tSTART\n" >> ./rclone_script-install.log
  302. local remotes=$(rclone listremotes)
  303. local retval=$(grep -i "^retropie:" <<< ${remotes})
  304. if [ "${retval}" == "retropie:" ]
  305. then
  306. printf "$(date +%FT%T%:z):\t1cTestRCLONEremote\tFOUND\n" >> ./rclone_script-install.log
  307. return 0
  308. else
  309. printf "$(date +%FT%T%:z):\t1cTestRCLONEremote\tNOT FOUND\n" >> ./rclone_script-install.log
  310. return 1
  311. fi
  312. }
  313. # Tells the user to create a new RCLONE remote called RETROPIE
  314. # RETURN
  315. # 0 > remote RETROPIE has been created (no other OUTPUT possible)
  316. function 1dCreateRCLONEremote ()
  317. {
  318. printf "$(date +%FT%T%:z):\t1dCreateRCLONEremote\tSTART\n" >> ./rclone_script-install.log
  319. dialog \
  320. --stdout \
  321. --colors \
  322. --ascii-lines \
  323. --no-collapse \
  324. --cr-wrap \
  325. --backtitle "${backtitle}" \
  326. --title "Installer" \
  327. --msgbox "\nPlease create a new remote within RCLONE now. Name that remote ${RED}retropie${NORMAL}. Please consult the RCLONE documentation for further information:\n https://www.rclone.org\n\nOpening RCLONE CONFIG now..." 20 50 \
  328. 2>&1 > /dev/tty
  329. rclone config
  330. 1cTestRCLONEremote
  331. if [[ $? -eq 1 ]]
  332. then
  333. dialog \
  334. --stdout \
  335. --colors \
  336. --ascii-lines \
  337. --no-collapse \
  338. --cr-wrap \
  339. --backtitle "${backtitle}" \
  340. --title "Installer" \
  341. --msgbox "\nNo remote ${RED}retropie${NORMAL} found.\nPlease try again." 20 50 \
  342. 2>&1 > /dev/tty
  343. 1dCreateRCLONEremote
  344. else
  345. printf "$(date +%FT%T%:z):\t1dCreateRCLONEremote\tFOUND\n" >> ./rclone_script-install.log
  346. return 0
  347. fi
  348. }
  349. function 2PNGVIEW ()
  350. {
  351. # 2a. Testing for PNGVIEW binary
  352. updateStep "2a" "in progress" 20
  353. 2aTestPNGVIEW
  354. if [[ $? -eq 0 ]]
  355. then
  356. updateStep "2a" "found" 25
  357. updateStep "2b" "skipped" 30
  358. updateStep "2c" "skipped" 35
  359. else
  360. updateStep "2a" "not found" 25
  361. # 2b. Getting PNGVIEW source
  362. updateStep "2b" "in progress" 25
  363. 2bGetPNGVIEWsource
  364. if [[ $? -eq 0 ]]
  365. then
  366. updateStep "2b" "done" 30
  367. # 2c. Compiling PNGVIEW
  368. updateStep "2c" "in progress" 30
  369. 2cCompilePNGVIEW
  370. if [[ $? -eq 0 ]]
  371. then
  372. updateStep "2c" "done" 35
  373. else
  374. updateStep "2c" "failed" 30
  375. exit
  376. fi
  377. else
  378. updateStep "2b" "failed" 25
  379. exit
  380. fi
  381. fi
  382. }
  383. # Checks if PNGVIEW is installed
  384. # RETURN
  385. # 0 > PNGVIEW is installed
  386. # 1 > PNGVIEW is not installed
  387. function 2aTestPNGVIEW ()
  388. {
  389. printf "$(date +%FT%T%:z):\t2aTestPNGVIEW\tSTART\n" >> ./rclone_script-install.log
  390. if [ -f /usr/bin/pngview ]
  391. then
  392. printf "$(date +%FT%T%:z):\t2aTestPNGVIEW\tFOUND\n" >> ./rclone_script-install.log
  393. return 0
  394. else
  395. printf "$(date +%FT%T%:z):\t2aTestPNGVIEW\tNOT FOUND\n" >> ./rclone_script-install.log
  396. return 1
  397. fi
  398. }
  399. # Gets PNGVIEW source
  400. # RETURN
  401. # 0 > source downloaded and unzipped
  402. # 1 > no source downloaded, removed temp files
  403. function 2bGetPNGVIEWsource ()
  404. {
  405. printf "$(date +%FT%T%:z):\t2bGetPNGVIEWsource\tSTART\n" >> ./rclone_script-install.log
  406. { #try
  407. wget -P ~ https://github.com/AndrewFromMelbourne/raspidmx/archive/master.zip --append-output=./rclone_script-install.log &&
  408. unzip ~/master.zip -d ~ >> ./rclone_script-install.log &&
  409. printf "$(date +%FT%T%:z):\t2bGetPNGVIEWsource\tDONE\n" >> ./rclone_script-install.log &&
  410. return 0
  411. } || { #catch
  412. printf "$(date +%FT%T%:z):\t2bGetPNGVIEWsource\tERROR\n" >> ./rclone_script-install.log &&
  413. rm ~/master.zip >> ./rclone_script-install.log &&
  414. sudo rm -r ~/raspidmx-master >> ./rclone_script-install.log &&
  415. return 1
  416. }
  417. }
  418. # Compiles PNGVIEW source, moves binaries
  419. # RETURN
  420. # 0 > compiled without errors, moved binaries, removed temp files
  421. # 1 > errors while compiling, removed temp files
  422. function 2cCompilePNGVIEW ()
  423. {
  424. printf "$(date +%FT%T%:z):\t2cCompilePNGVIEW\tSTART\n" >> ./rclone_script-install.log
  425. { #try
  426. # compile
  427. # cd ~/raspidmx-master &&
  428. make --directory=~/raspidmx-master >> ./rclone_script-install.log &&
  429. # move binary files
  430. sudo mv ~/raspidmx-master/pngview/pngview /usr/bin >> ./rclone_script-install.log &&
  431. sudo mv ~/raspidmx-master/lib/libraspidmx.so.1 /usr/lib >> ./rclone_script-install.log &&
  432. sudo chown root:root /usr/bin/pngview >> ./rclone_script-install.log &&
  433. sudo chmod 755 /usr/bin/pngview >> ./rclone_script-install.log &&
  434. # remove temp files
  435. rm ~/master.zip >> ./rclone_script-install.log &&
  436. sudo rm -r ~/raspidmx-master >> ./rclone_script-install.log &&
  437. printf "$(date +%FT%T%:z):\t2cCompilePNGVIEW\tDONE\n" >> ./rclone_script-install.log &&
  438. return 0
  439. } || { #catch
  440. printf "$(date +%FT%T%:z):\t2cCompilePNGVIEW\tERROR\n" >> ./rclone_script-install.log &&
  441. # remove temp files
  442. rm ~/master.zip >> ./rclone_script-install.log &&
  443. sudo rm -r ~/raspidmx-master >> ./rclone_script-install.log &&
  444. return 1
  445. }
  446. }
  447. function 3IMAGEMAGICK ()
  448. {
  449. # 3a. Testing for IMAGEMAGICK
  450. updateStep "3a" "in progress" 35
  451. 3aTestIMAGEMAGICK
  452. if [[ $? -eq 0 ]]
  453. then
  454. updateStep "3a" "found" 40
  455. updateStep "3b" "skipped" 45
  456. else
  457. updateStep "3a" "not found" 40
  458. # 3b. Getting IMAGEMAGICK
  459. updateStep "3b" "in progress" 40
  460. 3bInstallIMAGEMAGICK
  461. if [[ $? -eq 0 ]]
  462. then
  463. updateStep "3b" "done" 45
  464. else
  465. updateStep "3b" "failed" 40
  466. fi
  467. fi
  468. }
  469. # Checks is IMAGEMAGICK is installed
  470. # RETURN
  471. # 0 > IMAGEMAGICK is installed
  472. # 1 > IMAGEMAGICK is not installed
  473. function 3aTestIMAGEMAGICK ()
  474. {
  475. printf "$(date +%FT%T%:z):\t3aTestIMAGEMAGICK\tSTART\n" >> ./rclone_script-install.log
  476. if [ -f /usr/bin/convert ]
  477. then
  478. printf "$(date +%FT%T%:z):\t3aTestIMAGEMAGICK\tFOUND\n" >> ./rclone_script-install.log
  479. return 0
  480. else
  481. printf "$(date +%FT%T%:z):\t3aTestIMAGEMAGICK\tNOT FOUND\n" >> ./rclone_script-install.log
  482. return 1
  483. fi
  484. }
  485. # Installs IMAGEMAGICK via APT-GET
  486. # RETURN
  487. # 0 > IMAGEMAGICK has been installed
  488. # 1 > Error while installing IMAGEMAGICK
  489. function 3bInstallIMAGEMAGICK ()
  490. {
  491. printf "$(date +%FT%T%:z):\t3bInstallIMAGEMAGICK\tSTART\n" >> ./rclone_script-install.log
  492. sudo apt-get update >> ./rclone_script-install.log &&
  493. sudo apt-get --yes install imagemagick >> ./rclone_script-install.log &&
  494. if [[ $? -eq 0 ]]
  495. then
  496. printf "$(date +%FT%T%:z):\t3bInstallIMAGEMAGICK\tDONE\n" >> ./rclone_script-install.log &&
  497. return 0
  498. else
  499. printf "$(date +%FT%T%:z):\t3bInstallIMAGEMAGICK\tERROR\n" >> ./rclone_script-install.log &&
  500. return 1
  501. fi
  502. }
  503. function 4RCLONE_SCRIPT ()
  504. {
  505. # 4a. Getting RCLONE_SCRIPT
  506. updateStep "4a" "in progress" 45
  507. 4aGetRCLONE_SCRIPT
  508. if [[ $? -eq 0 ]]
  509. then
  510. updateStep "4a" "done" 50
  511. else
  512. updateStep "4a" "failed" 45
  513. exit
  514. fi
  515. # 4b. Creating RCLONE_SCRIPT menu item
  516. updateStep "4b" "in progress" 50
  517. 4bCreateRCLONE_SCRIPTMenuItem
  518. if [[ $? -eq 0 ]]
  519. then
  520. updateStep "4b" "done" 55
  521. else
  522. updateStep "4b" "failed" 50
  523. exit
  524. fi
  525. # 4c. Configure RCLONE_SCRIPT
  526. updateStep "4c" "in progress" 55
  527. 4cConfigureRCLONE_SCRIPT
  528. updateStep "4c" "done" 60
  529. }
  530. # Gets RCLONE_SCRIPT
  531. # RETURN
  532. # 0 > downloaded successfully
  533. # 1 > errors while downloading
  534. function 4aGetRCLONE_SCRIPT ()
  535. {
  536. printf "$(date +%FT%T%:z):\t4aGetRCLONE_SCRIPT\tSTART\n" >> ./rclone_script-install.log
  537. # create directory if necessary
  538. if [ ! -d ~/scripts/rclone_script ]
  539. then
  540. mkdir ~/scripts/rclone_script >> ./rclone_script-install.log
  541. fi
  542. { #try
  543. # get script files
  544. wget -N -P ~/scripts/rclone_script ${url}/${branch}/rclone_script.sh --append-output=./rclone_script-install.log &&
  545. wget -N -P ~/scripts/rclone_script ${url}/${branch}/rclone_script-menu.sh --append-output=./rclone_script-install.log &&
  546. wget -N -P ~/scripts/rclone_script ${url}/${branch}/rclone_script-uninstall.sh --append-output=./rclone_script-install.log &&
  547. # change mod
  548. chmod +x ~/scripts/rclone_script/rclone_script.sh >> ./rclone_script-install.log &&
  549. chmod +x ~/scripts/rclone_script/rclone_script-menu.sh >> ./rclone_script-install.log &&
  550. chmod +x ~/scripts/rclone_script/rclone_script-uninstall.sh >> ./rclone_script-install.log &&
  551. printf "$(date +%FT%T%:z):\t4aGetRCLONE_SCRIPT\tDONE\n" >> ./rclone_script-install.log &&
  552. return 0
  553. } || { # catch
  554. printf "$(date +%FT%T%:z):\t4aGetRCLONE_SCRIPT\tERROR\n" >> ./rclone_script-install.log
  555. return 1
  556. }
  557. }
  558. # Creates a menu item for RCLONE_SCRIPT in RetroPie menu
  559. # RETURN
  560. # 0 > menu item has been found or created
  561. # 1 > error while creating menu item
  562. function 4bCreateRCLONE_SCRIPTMenuItem ()
  563. {
  564. printf "$(date +%FT%T%:z):\t4bCreateRCLONE_SCRIPTMenuItem\tSTART\n" >> ./rclone_script-install.log
  565. # move menu script
  566. mv --force ~/scripts/rclone_script/rclone_script-menu.sh ~/RetroPie/retropiemenu >> ./rclone_script-install.log
  567. # check if menu item exists
  568. if [[ $(xmlstarlet sel -t -v "count(/gameList/game[path='./rclone_script-menu.sh'])" ~/.emulationstation/gamelists/retropie/gamelist.xml) -eq 0 ]]
  569. then
  570. printf "$(date +%FT%T%:z):\t4bCreateRCLONE_SCRIPTMenuItem\tNOT FOUND\n" >> ./rclone_script-install.log
  571. # sed -i "/<\/gameList>/c\\\\t<game>\n\t\t<path>.\/rclone_script-menu.sh<\/path>\n\t\t<name>RCLONE_SCRIPT menu<\/name>\n\t\t<desc>Customize RCLONE_SCRIPT, start a full sync, uninstall RCLONE_SCRIPT<\/desc>\n\t\t<image></image>\n\t<\/game>\n<\/gameList>" ~/.emulationstation/gamelists/retropie/gamelist.xml
  572. xmlstarlet ed \
  573. --inplace \
  574. --subnode "/gameList" --type elem -n game -v "" \
  575. --subnode "/gameList/game[last()]" --type elem -n path -v "./rclone_script-menu.sh" \
  576. --subnode "/gameList/game[last()]" --type elem -n name -v "RCLONE_SCRIPT menu" \
  577. --subnode "/gameList/game[last()]" --type elem -n desc -v "Launches a menu allowing you to start a full sync, configure RCLONE_SCRIPT or even uninstall it" \
  578. ~/.emulationstation/gamelists/retropie/gamelist.xml
  579. if [[ $? -eq 0 ]]
  580. then
  581. printf "$(date +%FT%T%:z):\t4bCreateRCLONE_SCRIPTMenuItem\tCREATED\n" >> ./rclone_script-install.log
  582. return 0
  583. else
  584. printf "$(date +%FT%T%:z):\t4bCreateRCLONE_SCRIPTMenuItem\tERROR\n" >> ./rclone_script-install.log
  585. return 1
  586. fi
  587. else
  588. printf "$(date +%FT%T%:z):\t4bCreateRCLONE_SCRIPTMenuItem\tFOUND\n" >> ./rclone_script-install.log
  589. return 0
  590. fi
  591. }
  592. # Gets user input to configure RCLONE_SCRIPT
  593. function 4cConfigureRCLONE_SCRIPT ()
  594. {
  595. printf "$(date +%FT%T%:z):\t4cConfigureRCLONE_SCRIPT\tSTART\n" >> ./rclone_script-install.log
  596. remotebasedir=$(dialog \
  597. --stdout \
  598. --colors \
  599. --ascii-lines \
  600. --no-collapse \
  601. --cr-wrap \
  602. --backtitle "${backtitle}" \
  603. --title "Remote base directory" \
  604. --inputbox "\nPlease name the directory which will be used as your ${YELLOW}remote base directory${NORMAL}. If necessary, this directory will be created.\n\nExamples:\n* RetroArch\n* mySaves/RetroArch\n\n" 18 40 "RetroArch"
  605. )
  606. dialog \
  607. --stdout \
  608. --colors \
  609. --ascii-lines \
  610. --no-collapse \
  611. --cr-wrap \
  612. --backtitle "${backtitle}" \
  613. --title "Notifications" \
  614. --yesno "\nDo you wish to see ${YELLOW}notifications${NORMAL} whenever RCLONE_SCRIPT is synchronizing?" 18 40
  615. case $? in
  616. 0) shownotifications="TRUE" ;;
  617. 1) shownotifications="FALSE" ;;
  618. *) shownotifications="FALSE" ;;
  619. esac
  620. printf "$(date +%FT%T%:z):\t4cConfigureRCLONE_SCRIPT\tDONE\n" >> ./rclone_script-install.log
  621. }
  622. function 5RUNCOMMAND ()
  623. {
  624. # 5a. RUNCOMMAND-ONSTART
  625. updateStep "5a" "in progress" 60
  626. 5aRUNCOMMAND-ONSTART
  627. case $? in
  628. 0) updateStep "5a" "found" 65 ;;
  629. 1) updateStep "5a" "created" 65 ;;
  630. esac
  631. # 5b. RUNCOMMAND-ONEND
  632. updateStep "5b" "in progress" 65
  633. 5aRUNCOMMAND-ONEND
  634. case $? in
  635. 0) updateStep "5b" "found" 70 ;;
  636. 1) updateStep "5b" "created" 70 ;;
  637. esac
  638. }
  639. # Checks call of RCLONE_SCRIPT by RUNCOMMAND-ONSTART
  640. # RETURNS
  641. # 0 > call found
  642. # 1 > call created
  643. function 5aRUNCOMMAND-ONSTART ()
  644. {
  645. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONSTART\tSTART\n" >> ./rclone_script-install.log
  646. # check if RUNCOMMAND-ONSTART.sh exists
  647. if [ -f /opt/retropie/configs/all/runcommand-onstart.sh ]
  648. then
  649. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONSTART\tFILE FOUND\n" >> ./rclone_script-install.log
  650. # check if there's a call to RCLONE_SCRIPT
  651. if grep -Fq "~/scripts/rclone_script/rclone_script.sh" /opt/retropie/configs/all/runcommand-onstart.sh
  652. then
  653. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONSTART\tCALL FOUND\n" >> ./rclone_script-install.log
  654. return 0
  655. else
  656. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONSTART\tCALL NOT FOUND\n" >> ./rclone_script-install.log
  657. # add call
  658. echo "~/scripts/rclone_script/rclone_script.sh \"down\" \"\$1\" \"\$2\" \"\$3\" \"\$4\"" >> /opt/retropie/configs/all/runcommand-onstart.sh
  659. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONSTART\tCALL CREATED\n" >> ./rclone_script-install.log
  660. return 1
  661. fi
  662. else
  663. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONSTART\tFILE NOT FOUND\n" >> ./rclone_script-install.log
  664. echo "#!/bin/bash" > /opt/retropie/configs/all/runcommand-onstart.sh
  665. echo "~/scripts/rclone_script/rclone_script.sh \"down\" \"\$1\" \"\$2\" \"\$3\" \"\$4\"" >> /opt/retropie/configs/all/runcommand-onstart.sh
  666. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONSTART\tFILE CREATED\n" >> ./rclone_script-install.log
  667. return 1
  668. fi
  669. }
  670. # Checks call of RCLONE_SCRIPT by RUNCOMMAND-ONEND
  671. # RETURNS
  672. # 0 > call found
  673. # 1 > call created
  674. function 5aRUNCOMMAND-ONEND ()
  675. {
  676. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONEND\tSTART\n" >> ./rclone_script-install.log
  677. # check if RUNCOMMAND-ONEND.sh exists
  678. if [ -f /opt/retropie/configs/all/runcommand-onend.sh ]
  679. then
  680. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONEND\tFILE FOUND\n" >> ./rclone_script-install.log
  681. # check if there's a call to RCLONE_SCRIPT
  682. if grep -Fq "~/scripts/rclone_script/rclone_script.sh" /opt/retropie/configs/all/runcommand-onend.sh
  683. then
  684. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONEND\tCALL FOUND\n" >> ./rclone_script-install.log
  685. return 0
  686. else
  687. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONEND\tCALL NOT FOUND\n" >> ./rclone_script-install.log
  688. # add call
  689. echo "~/scripts/rclone_script/rclone_script.sh \"up\" \"\$1\" \"\$2\" \"\$3\" \"\$4\"" >> /opt/retropie/configs/all/runcommand-onend.sh
  690. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONEND\tCALL CREATED\n" >> ./rclone_script-install.log
  691. return 1
  692. fi
  693. else
  694. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONEND\tFILE NOT FOUND\n" >> ./rclone_script-install.log
  695. echo "#!/bin/bash" > /opt/retropie/configs/all/runcommand-onend.sh
  696. echo "~/scripts/rclone_script/rclone_script.sh \"up\" \"\$1\" \"\$2\" \"\$3\" \"\$4\"" >> /opt/retropie/configs/all/runcommand-onend.sh
  697. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONEND\tFILE CREATED\n" >> ./rclone_script-install.log
  698. return 1
  699. fi
  700. }
  701. function 6LocalSAVEFILEDirectory ()
  702. {
  703. # 6a. Test for local SAVEFILE directory
  704. updateStep "6a" "in progress" 70
  705. 6aCheckLocalBaseDirectory
  706. case $? in
  707. 0) updateStep "6a" "found" 75 ;;
  708. 1) updateStep "6a" "created" 75 ;;
  709. esac
  710. # 6b. Check local <SYSTEM> directories
  711. updateStep "6b" "in progress" 75
  712. 6bCheckLocalSystemDirectories
  713. case $? in
  714. 0) updateStep "6b" "found" 80 ;;
  715. 1) updateStep "6b" "created" 80 ;;
  716. esac
  717. }
  718. # Checks if the local base SAVEFILE directory exists
  719. # RETURN
  720. # 0 > directory exists
  721. # 1 > directory has been created
  722. function 6aCheckLocalBaseDirectory ()
  723. {
  724. printf "$(date +%FT%T%:z):\t6aCheckLocalBaseDirectory\tSTART\n" >> ./rclone_script-install.log
  725. # check if local base dir exists
  726. if [ -d ~/RetroPie/saves ]
  727. then
  728. printf "$(date +%FT%T%:z):\t6aCheckLocalBaseDirectory\tFOUND\n" >> ./rclone_script-install.log
  729. return 0
  730. else
  731. printf "$(date +%FT%T%:z):\t6aCheckLocalBaseDirectory\tNOT FOUND\n" >> ./rclone_script-install.log
  732. mkdir ~/RetroPie/saves
  733. printf "$(date +%FT%T%:z):\t6aCheckLocalBaseDirectory\tCREATED\n" >> ./rclone_script-install.log
  734. return 1
  735. fi
  736. }
  737. # Checks if the local system specific directories exists
  738. # RETURN
  739. # 0 > all found
  740. # 1 > created at least one
  741. function 6bCheckLocalSystemDirectories ()
  742. {
  743. printf "$(date +%FT%T%:z):\t6bCheckLocalSystemDirectories\tSTART\n" >> ./rclone_script-install.log
  744. local retval=0
  745. # for each directory in ROMS directory...
  746. for directory in ~/RetroPie/roms/*
  747. do
  748. system="${directory##*/}"
  749. if [ -d ~/RetroPie/saves/${system} ]
  750. then
  751. printf "$(date +%FT%T%:z):\t6bCheckLocalSystemDirectories\tFOUND ${system}\n" >> ./rclone_script-install.log
  752. else
  753. mkdir ~/RetroPie/saves/${system}
  754. printf "$(date +%FT%T%:z):\t6bCheckLocalSystemDirectories\tCREATED ${system}\n" >> ./rclone_script-install.log
  755. retval=1
  756. fi
  757. done
  758. return ${retval}
  759. }
  760. function 7RemoteSAVEFILEDirectory ()
  761. {
  762. # 7a. Check remote base directory
  763. updateStep "7a" "in progress" 80
  764. 7aCheckRemoteBaseDirectory
  765. case $? in
  766. 0) updateStep "7a" "found" 85 ;;
  767. 1) updateStep "7a" "created" 85 ;;
  768. 255) updateStep "7a" "failed" 80 ;;
  769. esac
  770. # 7b. Check remote <system> directories
  771. updateStep "7b" "in progress" 85
  772. 7bCheckRemoteSystemDirectories
  773. case $? in
  774. 0) updateStep "7b" "found" 90 ;;
  775. 1) updateStep "7b" "created" 90 ;;
  776. 255) updateStep "7b" "failed" 85 ;;
  777. esac
  778. }
  779. # Checks if the remote base SAVEFILE directory exists
  780. # RETURN
  781. # 0 > directory exists
  782. # 1 > directory has been created
  783. # 255 > error while creating directory
  784. function 7aCheckRemoteBaseDirectory ()
  785. {
  786. printf "$(date +%FT%T%:z):\t7aCheckRemoteBaseDirectory\tSTART\n" >> ./rclone_script-install.log
  787. # list all directories from remote
  788. remoteDirs=$(rclone lsf --dirs-only -R retropie:)
  789. # for each line...
  790. while read path
  791. do
  792. if [ "${path}" == "${remotebasedir}/" ]
  793. then
  794. printf "$(date +%FT%T%:z):\t7aCheckRemoteBaseDirectory\tFOUND\n" >> ./rclone_script-install.log
  795. return 0
  796. fi
  797. done <<< "${remoteDirs}"
  798. # if there has been no match...
  799. printf "$(date +%FT%T%:z):\t7aCheckRemoteBaseDirectory\tNOT FOUND\n" >> ./rclone_script-install.log
  800. rclone mkdir retropie:"${remotebasedir}" >> ./rclone_script-install.log
  801. case $? in
  802. 0) printf "$(date +%FT%T%:z):\t7aCheckRemoteBaseDirectory\tCREATED\n" >> ./rclone_script-install.log; return 1 ;;
  803. *) printf "$(date +%FT%T%:z):\t7aCheckRemoteBaseDirectory\tERROR\n" >> ./rclone_script-install.log;return 255 ;;
  804. esac
  805. }
  806. # Checks if the remote system specific directories exist
  807. # RETURN
  808. # 0 > all found
  809. # 1 > created at least one
  810. # 255 > error while creating directory
  811. function 7bCheckRemoteSystemDirectories ()
  812. {
  813. printf "$(date +%FT%T%:z):\t7bCheckRemoteSystemDirectories\tSTART\n" >> ./rclone_script-install.log
  814. local retval=0
  815. local output
  816. # list all directories in $REMOTEBASEDIR from remote
  817. remoteDirs=$(rclone lsf --dirs-only -R retropie:"${remotebasedir}")
  818. # for each directory in ROMS directory...
  819. for directory in ~/RetroPie/roms/*
  820. do
  821. system="${directory##*/}"
  822. # use grep to search $SYSTEM in $DIRECTORIES
  823. output=$(grep "${system}/" -nx <<< "${remoteDirs}")
  824. if [ "${output}" = "" ]
  825. then
  826. # create system dir
  827. rclone mkdir retropie:"${remotebasedir}/${system}"
  828. if [[ $? -eq 0 ]]
  829. then
  830. printf "$(date +%FT%T%:z):\t7bCheckRemoteSystemDirectories\tCREATED ${system}\n" >> ./rclone_script-install.log
  831. retval=1
  832. else
  833. printf "$(date +%FT%T%:z):\t7bCheckRemoteSystemDirectories\tERROR\n" >> ./rclone_script-install.log
  834. return 255
  835. fi
  836. else
  837. printf "$(date +%FT%T%:z):\t7bCheckRemoteSystemDirectories\tFOUND ${system}\n" >> ./rclone_script-install.log
  838. fi
  839. done
  840. return ${retval}
  841. }
  842. function 8ConfigureRETROARCH ()
  843. {
  844. # 8a. Setting local SAVEFILE directory
  845. updateStep "8a" "in progress" 90
  846. 8aSetLocalSAVEFILEDirectory
  847. updateStep "8a" "done" 95
  848. }
  849. # Sets parameters in all system specific configuration files
  850. function 8aSetLocalSAVEFILEDirectory ()
  851. {
  852. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tSTART\n" >> ./rclone_script-install.log
  853. local retval
  854. # for each directory...
  855. for directory in /opt/retropie/configs/*
  856. do
  857. system="${directory##*/}"
  858. # skip directory ALL
  859. if [ "${system}" = "all" ]
  860. then
  861. continue
  862. fi
  863. # test if there's a RETROARCH.CFG
  864. if [ -f "${directory}/retroarch.cfg" ]
  865. then
  866. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tFOUND retroarch.cfg FOR ${system}\n" >> ./rclone_script-install.log
  867. # test file for SAVEFILE_DIRECTORY
  868. retval=$(grep -i "^savefile_directory = " ${directory}/retroarch.cfg)
  869. if [ ! "${retval}" = "" ]
  870. then
  871. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tREPLACED savefile_directory\n" >> ./rclone_script-install.log
  872. # replace existing parameter
  873. sed -i "/^savefile_directory = /c\savefile_directory = \"~/RetroPie/saves/${system}\"" ${directory}/retroarch.cfg
  874. else
  875. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tADDED savefile_directory\n" >> ./rclone_script-install.log
  876. # create new parameter above "#include..."
  877. sed -i "/^#include \"\/opt\/retropie\/configs\/all\/retroarch.cfg\"/c\savefile_directory = \"~\/RetroPie\/saves\/${system}\"\n#include \"\/opt\/retropie\/configs\/all\/retroarch.cfg\"" ${directory}/retroarch.cfg
  878. fi
  879. # test file for SAVESTATE_DIRECTORY
  880. retval=$(grep -i "^savestate_directory = " ${directory}/retroarch.cfg)
  881. if [ ! "${retval}" = "" ]
  882. then
  883. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tREPLACED savestate_directory\n" >> ./rclone_script-install.log
  884. # replace existing parameter
  885. sed -i "/^savestate_directory = /c\savestate_directory = \"~/RetroPie/saves/${system}\"" ${directory}/retroarch.cfg
  886. else
  887. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tADDED savestate_directory\n" >> ./rclone_script-install.log
  888. # create new parameter above "#include..."
  889. sed -i "/^#include \"\/opt\/retropie\/configs\/all\/retroarch.cfg\"/c\savestate_directory = \"~\/RetroPie\/saves\/${system}\"\n#include \"\/opt\/retropie\/configs\/all\/retroarch.cfg\"" ${directory}/retroarch.cfg
  890. fi
  891. fi
  892. done
  893. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tDONE\n" >> ./rclone_script-install.log
  894. }
  895. function 9Finalize ()
  896. {
  897. # 9a. Saving configuration
  898. updateStep "9a" "in progress" 95
  899. 9aSaveConfiguration
  900. updateStep "9a" "done" 100
  901. }
  902. # Saves the configuration of RCLONE_SCRIPT
  903. function 9aSaveConfiguration ()
  904. {
  905. printf "$(date +%FT%T%:z):\t9aSaveConfiguration\tSTART\n" >> ./rclone_script-install.log
  906. echo "remotebasedir=${remotebasedir}" > ~/scripts/rclone_script/rclone_script.ini
  907. echo "shownotifications=${shownotifications}" >> ~/scripts/rclone_script/rclone_script.ini
  908. echo "logfile=~/scripts/rclone_script/rclone_script.log" >> ~/scripts/rclone_script/rclone_script.ini
  909. echo "debug=0" >> ~/scripts/rclone_script/rclone_script.ini
  910. printf "$(date +%FT%T%:z):\t9aSaveConfiguration\tDONE\n" >> ./rclone_script-install.log
  911. }
  912. ########
  913. # MAIN #
  914. ########
  915. if [ "${branch}" == "beta" ]
  916. then
  917. dialogBetaWarning
  918. fi
  919. installer