1
0

rclone_script-install.sh 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151
  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. logfile=~/scripts/rclone_script/rclone_script-install.log
  23. ##################
  24. # WELCOME DIALOG #
  25. ##################
  26. dialog \
  27. --backtitle "${backtitle}" \
  28. --title "Welcome" \
  29. --ascii-lines \
  30. --colors \
  31. --no-collapse \
  32. --cr-wrap \
  33. --yesno \
  34. "\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. The installer will guide you through the necessary steps. If you wish to see what exactly is done at each step, open a second console and execute\n ${YELLOW}tail -f ~/scripts/rclone_script/rclone_script-install.log${NORMAL}\n\nIf you already have some savefiles in the ROMS directory, you will need to ${YELLOW}move them manually${NORMAL} after installation.\n\nAre you sure you wish to continue?" \
  35. 25 90 2>&1 > /dev/tty \
  36. || exit
  37. ####################
  38. # DIALOG FUNCTIONS #
  39. ####################
  40. # Warn the user if they are using the BETA branch
  41. function dialogBetaWarning ()
  42. {
  43. dialog \
  44. --backtitle "${backtitle}" \
  45. --title "Beta Warning" \
  46. --ascii-lines \
  47. --colors \
  48. --no-collapse \
  49. --cr-wrap \
  50. --yesno \
  51. "\n${RED}${UNDERLINE}WARNING!${NORMAL}\n\nYou are about to install a beta version!\nAre you ${RED}REALLY${NORMAL} sure you want to continue?" \
  52. 10 50 2>&1 > /dev/tty \
  53. || exit
  54. }
  55. # Build progress from array $STEPS()
  56. # INPUT
  57. # $steps()
  58. # OUTPUT
  59. # $progress
  60. function buildProgress ()
  61. {
  62. progress=""
  63. for ((i=0; i<=${#steps[*]}; i++))
  64. do
  65. progress="${progress}${steps[i]}\n"
  66. done
  67. }
  68. # Show Progress dialog
  69. # INPUT
  70. # 1 > Percentage to show in dialog
  71. # $backtitle
  72. # $progress
  73. function dialogShowProgress ()
  74. {
  75. local percent="$1"
  76. buildProgress
  77. echo "${percent}" | dialog \
  78. --stdout \
  79. --colors \
  80. --ascii-lines \
  81. --no-collapse \
  82. --cr-wrap \
  83. --backtitle "${backtitle}" \
  84. --title "Installer" \
  85. --gauge "${progress}" 36 90 0 \
  86. 2>&1 > /dev/tty
  87. sleep 1
  88. }
  89. # Show summary dialog
  90. function dialogShowSummary ()
  91. {
  92. # list all remotes and their type
  93. remotes=$(rclone listremotes -l)
  94. # get line with RETROPIE remote
  95. retval=$(grep -i "^retropie:" <<< ${remotes})
  96. remoteType="${retval#*:}"
  97. remoteType=$(echo ${remoteType} | xargs)
  98. dialog \
  99. --backtitle "${backtitle}" \
  100. --title "Summary" \
  101. --ascii-lines \
  102. --colors \
  103. --no-collapse \
  104. --cr-wrap \
  105. --yesno \
  106. "\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 systems will put their saves and states in\n Local: \"${YELLOW}~/RetroPie/saves/<SYSTEM>${NORMAL}\"\n Remote: \"${YELLOW}retropie:${remotebasedir}/<SYSTEM>${NORMAL}\" (${remoteType})\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\nStart\n ${YELLOW}RetroPie / RCLONE_SCRIPT menu / 9 uninstall${NORMAL}\nto revert all changes and remove this script.\n\nTo finish the installer you should reboot your RetroPie now.\n\n${RED}Reboot RetroPie now?${NORMAL}" 25 90
  107. case $? in
  108. 0) sudo shutdown -r now ;;
  109. esac
  110. }
  111. ##################
  112. # STEP FUNCTIONS #
  113. ##################
  114. # Initialize array $STEPS()
  115. # OUTPUT
  116. # $steps()
  117. function initSteps ()
  118. {
  119. steps[1]="1. RCLONE"
  120. steps[2]=" 1a. Test for RCLONE binary [ waiting... ]"
  121. steps[3]=" 1b. Get RCLONE binary [ waiting... ]"
  122. steps[4]=" 1c. Test RCLONE remote [ waiting... ]"
  123. steps[5]=" 1d. Create RCLONE remote [ waiting... ]"
  124. steps[6]="2. PNGVIEW"
  125. steps[7]=" 2a. Test for PNGVIEW binary [ waiting... ]"
  126. steps[8]=" 2b. Get PNGVIEW source [ waiting... ]"
  127. steps[9]=" 2c. Compile PNGVIEW [ waiting... ]"
  128. steps[10]="3. IMAGEMAGICK"
  129. steps[11]=" 3a. Test for IMAGEMAGICK [ waiting... ]"
  130. steps[12]=" 3b. Get IMAGEMAGICK [ waiting... ]"
  131. steps[13]="4. RCLONE_SCRIPT"
  132. steps[14]=" 4a. Get RCLONE_SCRIPT files [ waiting... ]"
  133. steps[15]=" 4b. Create RCLONE_SCRIPT menu item [ waiting... ]"
  134. steps[16]=" 4c. Configure RCLONE_SCRIPT [ waiting... ]"
  135. steps[17]="5. RUNCOMMAND"
  136. steps[18]=" 5a. Add call to RUNCOMMAND-ONSTART [ waiting... ]"
  137. steps[19]=" 5b. Add call to RUNCOMMAND-ONEND [ waiting... ]"
  138. steps[20]="6. Local SAVEFILE directory"
  139. steps[21]=" 6a. Check local base directory [ waiting... ]"
  140. steps[22]=" 6b. Check local <SYSTEM> directories [ waiting... ]"
  141. steps[23]="7. Remote SAVEFILE directory"
  142. steps[24]=" 7a. Check remote base directory [ waiting... ]"
  143. steps[25]=" 7b. Check remote <SYSTEM> directories [ waiting... ]"
  144. steps[26]="8. Configure RETROARCH"
  145. steps[27]=" 8a. Set local SAVEFILE directories [ waiting... ]"
  146. steps[28]="9. Finalizing"
  147. steps[29]=" 9a. Save configuration [ waiting... ]"
  148. }
  149. # Update item of $STEPS() and show updated progress dialog
  150. # INPUT
  151. # 1 > Number of step to update
  152. # 2 > New status for step
  153. # 3 > Percentage to show in progress dialog
  154. # $steps()
  155. # OUTPUT
  156. # $steps()
  157. function updateStep ()
  158. {
  159. local step="$1"
  160. local newStatus="$2"
  161. local percent="$3"
  162. local oldline
  163. local newline
  164. # translate and colorize $NEWSTATUS
  165. case "${newStatus}" in
  166. "waiting") newStatus="[ ${NORMAL}WAITING...${NORMAL} ]" ;;
  167. "in progress") newStatus="[ ${NORMAL}IN PROGRESS${NORMAL} ]" ;;
  168. "done") newStatus="[ ${GREEN}DONE${NORMAL} ]" ;;
  169. "found") newStatus="[ ${GREEN}FOUND${NORMAL} ]" ;;
  170. "not found") newStatus="[ ${RED}NOT FOUND${NORMAL} ]" ;;
  171. "created") newStatus="[ ${GREEN}CREATED${NORMAL} ]" ;;
  172. "failed") newStatus="[ ${RED}FAILED${NORMAL} ]" ;;
  173. "skipped") newStatus="[ ${YELLOW}SKIPPED${NORMAL} ]" ;;
  174. *) newStatus="[ ${RED}UNDEFINED${NORMAL} ]" ;;
  175. esac
  176. # search $STEP in $STEPS
  177. for ((i=0; i<${#steps[*]}; i++))
  178. do
  179. if [[ ${steps[i]} =~ .*$step.* ]]
  180. then
  181. # update $STEP with $NEWSTATUS
  182. oldline="${steps[i]}"
  183. oldline="${oldline%%[*}"
  184. newline="${oldline}${newStatus}"
  185. steps[i]="${newline}"
  186. break
  187. fi
  188. done
  189. # show progress dialog
  190. dialogShowProgress ${percent}
  191. }
  192. #######################
  193. # INSTALLER FUNCTIONS #
  194. #######################
  195. # Installer
  196. function installer ()
  197. {
  198. initSteps
  199. dialogShowProgress 0
  200. 1RCLONE
  201. 2PNGVIEW
  202. 3IMAGEMAGICK
  203. 4RCLONE_SCRIPT
  204. 5RUNCOMMAND
  205. 6LocalSAVEFILEDirectory
  206. 7RemoteSAVEFILEDirectory
  207. 8ConfigureRETROARCH
  208. 9Finalize
  209. dialogShowSummary
  210. }
  211. function 1RCLONE ()
  212. {
  213. # 1a. Testing for RCLONE binary
  214. updateStep "1a" "in progress" 0
  215. 1aTestRCLONE
  216. if [[ $? -eq 0 ]]
  217. then
  218. updateStep "1a" "found" 5
  219. updateStep "1b" "skipped" 10
  220. else
  221. updateStep "1a" "not found" 5
  222. # 1b. Getting RCLONE binary
  223. updateStep "1b" "in progress" 5
  224. 1bInstallRCLONE
  225. if [[ $? -eq 0 ]]
  226. then
  227. updateStep "1b" "done" 10
  228. else
  229. updateStep "1b" "failed" 5
  230. exit
  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" >> "${logfile}"
  255. if [ -f /usr/bin/rclone ]
  256. then
  257. printf "$(date +%FT%T%:z):\t1aTestRCLONE\tFOUND\n" >> "${logfile}"
  258. return 0
  259. else
  260. printf "$(date +%FT%T%:z):\t1aTestRCLONE\tNOT FOUND\n" >> "${logfile}"
  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" >> "${logfile}"
  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="${logfile}" &&
  275. unzip ~/rclone-current-linux-arm.zip -d ~ >> "${logfile}" &&
  276. cd ~/rclone-v* &&
  277. # move binary
  278. sudo mv rclone /usr/bin >> "${logfile}" &&
  279. sudo chown root:root /usr/bin/rclone >> "${logfile}" &&
  280. sudo chmod 755 /usr/bin/rclone >> "${logfile}" &&
  281. cd ~ &&
  282. # remove temp files
  283. rm ~/rclone-current-linux-arm.zip >> "${logfile}" &&
  284. rm -r ~/rclone-v* >> "${logfile}" &&
  285. printf "$(date +%FT%T%:z):\t1bInstallRCLONE\tDONE\n" >> "${logfile}" &&
  286. return 0
  287. } || { #catch
  288. printf "$(date +%FT%T%:z):\t1bInstallRCLONE\tERROR\n" >> "${logfile}" &&
  289. # remove temp files
  290. rm ~/rclone-current-linux-arm.zip >> "${logfile}" &&
  291. rm -r ~/rclone-v* >> "${logfile}" &&
  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" >> "${logfile}"
  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" >> "${logfile}"
  307. return 0
  308. else
  309. printf "$(date +%FT%T%:z):\t1cTestRCLONEremote\tNOT FOUND\n" >> "${logfile}"
  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" >> "${logfile}"
  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" >> "${logfile}"
  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" >> "${logfile}"
  390. if [ -f /usr/bin/pngview ]
  391. then
  392. printf "$(date +%FT%T%:z):\t2aTestPNGVIEW\tFOUND\n" >> "${logfile}"
  393. return 0
  394. else
  395. printf "$(date +%FT%T%:z):\t2aTestPNGVIEW\tNOT FOUND\n" >> "${logfile}"
  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" >> "${logfile}"
  406. { #try
  407. wget -P ~ https://github.com/AndrewFromMelbourne/raspidmx/archive/master.zip --append-output="${logfile}" &&
  408. unzip ~/master.zip -d ~ >> "${logfile}" &&
  409. printf "$(date +%FT%T%:z):\t2bGetPNGVIEWsource\tDONE\n" >> "${logfile}" &&
  410. return 0
  411. } || { #catch
  412. printf "$(date +%FT%T%:z):\t2bGetPNGVIEWsource\tERROR\n" >> "${logfile}" &&
  413. rm ~/master.zip >> "${logfile}" &&
  414. sudo rm -r ~/raspidmx-master >> "${logfile}" &&
  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" >> "${logfile}"
  425. { #try
  426. # compile
  427. # cd ~/raspidmx-master &&
  428. make --directory=~/raspidmx-master >> "${logfile}" &&
  429. # move binary files
  430. sudo mv ~/raspidmx-master/pngview/pngview /usr/bin >> "${logfile}" &&
  431. sudo mv ~/raspidmx-master/lib/libraspidmx.so.1 /usr/lib >> "${logfile}" &&
  432. sudo chown root:root /usr/bin/pngview >> "${logfile}" &&
  433. sudo chmod 755 /usr/bin/pngview >> "${logfile}" &&
  434. # remove temp files
  435. rm ~/master.zip >> "${logfile}" &&
  436. sudo rm -r ~/raspidmx-master >> "${logfile}" &&
  437. printf "$(date +%FT%T%:z):\t2cCompilePNGVIEW\tDONE\n" >> "${logfile}" &&
  438. return 0
  439. } || { #catch
  440. printf "$(date +%FT%T%:z):\t2cCompilePNGVIEW\tERROR\n" >> "${logfile}" &&
  441. # remove temp files
  442. rm ~/master.zip >> "${logfile}" &&
  443. sudo rm -r ~/raspidmx-master >> "${logfile}" &&
  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" >> "${logfile}"
  476. if [ -f /usr/bin/convert ]
  477. then
  478. printf "$(date +%FT%T%:z):\t3aTestIMAGEMAGICK\tFOUND\n" >> "${logfile}"
  479. return 0
  480. else
  481. printf "$(date +%FT%T%:z):\t3aTestIMAGEMAGICK\tNOT FOUND\n" >> "${logfile}"
  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" >> "${logfile}"
  492. sudo apt-get update >> "${logfile}"
  493. sudo apt-get --yes install imagemagick >> "${logfile}"
  494. if [[ $? -eq 0 ]]
  495. then
  496. printf "$(date +%FT%T%:z):\t3bInstallIMAGEMAGICK\tDONE\n" >> "${logfile}"
  497. return 0
  498. else
  499. printf "$(date +%FT%T%:z):\t3bInstallIMAGEMAGICK\tERROR\n" >> "${logfile}"
  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" >> "${logfile}"
  537. # create directory if necessary
  538. if [ ! -d ~/scripts/rclone_script ]
  539. then
  540. mkdir ~/scripts/rclone_script >> "${logfile}"
  541. fi
  542. { #try
  543. # get script files
  544. wget -N -P ~/scripts/rclone_script ${url}/${branch}/rclone_script.sh --append-output="${logfile}" &&
  545. wget -N -P ~/scripts/rclone_script ${url}/${branch}/rclone_script-menu.sh --append-output="${logfile}" &&
  546. wget -N -P ~/scripts/rclone_script ${url}/${branch}/rclone_script-uninstall.sh --append-output="${logfile}" &&
  547. # change mod
  548. chmod +x ~/scripts/rclone_script/rclone_script.sh >> "${logfile}" &&
  549. chmod +x ~/scripts/rclone_script/rclone_script-menu.sh >> "${logfile}" &&
  550. chmod +x ~/scripts/rclone_script/rclone_script-uninstall.sh >> "${logfile}" &&
  551. printf "$(date +%FT%T%:z):\t4aGetRCLONE_SCRIPT\tDONE\n" >> "${logfile}" &&
  552. return 0
  553. } || { # catch
  554. printf "$(date +%FT%T%:z):\t4aGetRCLONE_SCRIPT\tERROR\n" >> "${logfile}" &&
  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" >> "${logfile}"
  565. # create redirect script
  566. printf "#!/bin/bash\n~/scripts/rclone_script/rclone_script-menu.sh" > ~/RetroPie/retropiemenu/rclone_script-redirect.sh
  567. chmod +x ~/RetroPie/retropiemenu/rclone_script-redirect.sh
  568. # check if menu item exists
  569. if [[ $(xmlstarlet sel -t -v "count(/gameList/game[path='./rclone_script-redirect.sh'])" ~/.emulationstation/gamelists/retropie/gamelist.xml) -eq 0 ]]
  570. then
  571. printf "$(date +%FT%T%:z):\t4bCreateRCLONE_SCRIPTMenuItem\tNOT FOUND\n" >> "${logfile}"
  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-redirect.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" >> "${logfile}"
  582. return 0
  583. else
  584. printf "$(date +%FT%T%:z):\t4bCreateRCLONE_SCRIPTMenuItem\tERROR\n" >> "${logfile}"
  585. return 1
  586. fi
  587. else
  588. printf "$(date +%FT%T%:z):\t4bCreateRCLONE_SCRIPTMenuItem\tFOUND\n" >> "${logfile}"
  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" >> "${logfile}"
  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" >> "${logfile}"
  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" >> "${logfile}"
  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" >> "${logfile}"
  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" >> "${logfile}"
  654. return 0
  655. else
  656. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONSTART\tCALL NOT FOUND\n" >> "${logfile}"
  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" >> "${logfile}"
  660. return 1
  661. fi
  662. else
  663. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONSTART\tFILE NOT FOUND\n" >> "${logfile}"
  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" >> "${logfile}"
  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" >> "${logfile}"
  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" >> "${logfile}"
  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" >> "${logfile}"
  685. return 0
  686. else
  687. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONEND\tCALL NOT FOUND\n" >> "${logfile}"
  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" >> "${logfile}"
  691. return 1
  692. fi
  693. else
  694. printf "$(date +%FT%T%:z):\t5aRUNCOMMAND-ONEND\tFILE NOT FOUND\n" >> "${logfile}"
  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" >> "${logfile}"
  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" >> "${logfile}"
  725. # check if local base dir exists
  726. if [ -d ~/RetroPie/saves ]
  727. then
  728. printf "$(date +%FT%T%:z):\t6aCheckLocalBaseDirectory\tFOUND\n" >> "${logfile}"
  729. return 0
  730. else
  731. printf "$(date +%FT%T%:z):\t6aCheckLocalBaseDirectory\tNOT FOUND\n" >> "${logfile}"
  732. mkdir ~/RetroPie/saves
  733. printf "$(date +%FT%T%:z):\t6aCheckLocalBaseDirectory\tCREATED\n" >> "${logfile}"
  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" >> "${logfile}"
  744. local retval=0
  745. # for each directory in ROMS directory...
  746. for directory in ~/RetroPie/roms/*
  747. do
  748. system="${directory##*/}"
  749. # check if ROMS directory is a real directory and not a SymLink
  750. if [ ! -L ~/RetroPie/roms/${system} ]
  751. then
  752. # check if same directory exists in SAVES, create if necessary
  753. if [ -d ~/RetroPie/saves/${system} ]
  754. then
  755. printf "$(date +%FT%T%:z):\t6bCheckLocalSystemDirectories\tFOUND directory ${system}\n" >> "${logfile}"
  756. else
  757. mkdir ~/RetroPie/saves/${system}
  758. printf "$(date +%FT%T%:z):\t6bCheckLocalSystemDirectories\tCREATED directory ${system}\n" >> "${logfile}"
  759. retval=1
  760. fi
  761. else
  762. # check if same SymLink exists in SAVES, create if necessary
  763. if [ -L ~/RetroPie/saves/${system} ]
  764. then
  765. printf "$(date +%FT%T%:z):\t6bCheckLocalSystemDirectories\tFOUND symlink ${system}\n" >> "${logfile}"
  766. else
  767. ln -s $(readlink ~/RetroPie/roms/${system}) ~/RetroPie/saves/${system}
  768. printf "$(date +%FT%T%:z):\t6bCheckLocalSystemDirectories\tCREATED symlink ${system}\n" >> "${logfile}"
  769. retval=1
  770. fi
  771. fi
  772. done
  773. return ${retval}
  774. }
  775. function 7RemoteSAVEFILEDirectory ()
  776. {
  777. # 7a. Check remote base directory
  778. updateStep "7a" "in progress" 80
  779. 7aCheckRemoteBaseDirectory
  780. case $? in
  781. 0) updateStep "7a" "found" 85 ;;
  782. 1) updateStep "7a" "created" 85 ;;
  783. 255) updateStep "7a" "failed" 80 ;;
  784. esac
  785. # 7b. Check remote <system> directories
  786. updateStep "7b" "in progress" 85
  787. 7bCheckRemoteSystemDirectories
  788. case $? in
  789. 0) updateStep "7b" "found" 90 ;;
  790. 1) updateStep "7b" "created" 90 ;;
  791. 255) updateStep "7b" "failed" 85 ;;
  792. esac
  793. }
  794. # Checks if the remote base SAVEFILE directory exists
  795. # RETURN
  796. # 0 > directory exists
  797. # 1 > directory has been created
  798. # 255 > error while creating directory
  799. function 7aCheckRemoteBaseDirectory ()
  800. {
  801. printf "$(date +%FT%T%:z):\t7aCheckRemoteBaseDirectory\tSTART\n" >> "${logfile}"
  802. # list all directories from remote
  803. remoteDirs=$(rclone lsf --dirs-only -R retropie:)
  804. # for each line...
  805. while read path
  806. do
  807. if [ "${path}" == "${remotebasedir}/" ]
  808. then
  809. printf "$(date +%FT%T%:z):\t7aCheckRemoteBaseDirectory\tFOUND\n" >> "${logfile}"
  810. return 0
  811. fi
  812. done <<< "${remoteDirs}"
  813. # if there has been no match...
  814. printf "$(date +%FT%T%:z):\t7aCheckRemoteBaseDirectory\tNOT FOUND\n" >> "${logfile}"
  815. rclone mkdir retropie:"${remotebasedir}" >> "${logfile}"
  816. case $? in
  817. 0) printf "$(date +%FT%T%:z):\t7aCheckRemoteBaseDirectory\tCREATED\n" >> "${logfile}"; return 1 ;;
  818. *) printf "$(date +%FT%T%:z):\t7aCheckRemoteBaseDirectory\tERROR\n" >> "${logfile}"; return 255 ;;
  819. esac
  820. }
  821. # Checks if the remote system specific directories exist
  822. # RETURN
  823. # 0 > all found
  824. # 1 > created at least one
  825. # 255 > error while creating directory
  826. function 7bCheckRemoteSystemDirectories ()
  827. {
  828. printf "$(date +%FT%T%:z):\t7bCheckRemoteSystemDirectories\tSTART\n" >> "${logfile}"
  829. local retval=0
  830. local output
  831. # list all directories in $REMOTEBASEDIR from remote
  832. remoteDirs=$(rclone lsf --dirs-only -R retropie:"${remotebasedir}")
  833. # for each directory in ROMS directory...
  834. for directory in ~/RetroPie/roms/*
  835. do
  836. system="${directory##*/}"
  837. # use grep to search $SYSTEM in $DIRECTORIES
  838. output=$(grep "${system}/" -nx <<< "${remoteDirs}")
  839. if [ "${output}" = "" ]
  840. then
  841. # create system dir
  842. rclone mkdir retropie:"${remotebasedir}/${system}"
  843. if [[ $? -eq 0 ]]
  844. then
  845. printf "$(date +%FT%T%:z):\t7bCheckRemoteSystemDirectories\tCREATED ${system}\n" >> "${logfile}"
  846. # put note if local directory is a symlink
  847. if [ -L ~/RetroPie/saves/${system} ]
  848. then
  849. printf "ATTENTION\r\n\r\nThis directory will not be used! This is just a symlink.\r\nPlace your savefiles in\r\n\r\n$(readlink ~/RetroPie/roms/${system})\r\n\r\ninstead." > ~/scripts/rclone_script/readme.txt
  850. rclone copy ~/scripts/rclone_script/readme.txt retropie:"${remotebasedir}/${system}/"
  851. rm ~/scripts/rclone_script/readme.txt
  852. fi
  853. retval=1
  854. else
  855. printf "$(date +%FT%T%:z):\t7bCheckRemoteSystemDirectories\tERROR\n" >> "${logfile}"
  856. return 255
  857. fi
  858. else
  859. printf "$(date +%FT%T%:z):\t7bCheckRemoteSystemDirectories\tFOUND ${system}\n" >> "${logfile}"
  860. fi
  861. done
  862. return ${retval}
  863. }
  864. function 8ConfigureRETROARCH ()
  865. {
  866. # 8a. Setting local SAVEFILE directory
  867. updateStep "8a" "in progress" 90
  868. 8aSetLocalSAVEFILEDirectory
  869. updateStep "8a" "done" 95
  870. }
  871. # Sets parameters in all system specific configuration files
  872. function 8aSetLocalSAVEFILEDirectory ()
  873. {
  874. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tSTART\n" >> "${logfile}"
  875. local retval
  876. # for each directory...
  877. for directory in /opt/retropie/configs/*
  878. do
  879. system="${directory##*/}"
  880. # skip directory ALL
  881. if [ "${system}" = "all" ]
  882. then
  883. continue
  884. fi
  885. # test if there's a RETROARCH.CFG
  886. if [ -f "${directory}/retroarch.cfg" ]
  887. then
  888. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tFOUND retroarch.cfg FOR ${system}\n" >> "${logfile}"
  889. # test file for SAVEFILE_DIRECTORY
  890. retval=$(grep -i "^savefile_directory = " ${directory}/retroarch.cfg)
  891. if [ ! "${retval}" = "" ]
  892. then
  893. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tREPLACED savefile_directory\n" >> "${logfile}"
  894. # replace existing parameter
  895. sed -i "/^savefile_directory = /c\savefile_directory = \"~/RetroPie/saves/${system}\"" ${directory}/retroarch.cfg
  896. else
  897. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tADDED savefile_directory\n" >> "${logfile}"
  898. # create new parameter above "#include..."
  899. 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
  900. fi
  901. # test file for SAVESTATE_DIRECTORY
  902. retval=$(grep -i "^savestate_directory = " ${directory}/retroarch.cfg)
  903. if [ ! "${retval}" = "" ]
  904. then
  905. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tREPLACED savestate_directory\n" >> "${logfile}"
  906. # replace existing parameter
  907. sed -i "/^savestate_directory = /c\savestate_directory = \"~/RetroPie/saves/${system}\"" ${directory}/retroarch.cfg
  908. else
  909. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tADDED savestate_directory\n" >> "${logfile}"
  910. # create new parameter above "#include..."
  911. 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
  912. fi
  913. fi
  914. done
  915. printf "$(date +%FT%T%:z):\t8aSetLocalSAVEFILEDirectory\tDONE\n" >> "${logfile}"
  916. }
  917. function 9Finalize ()
  918. {
  919. # 9a. Saving configuration
  920. updateStep "9a" "in progress" 95
  921. 9aSaveConfiguration
  922. updateStep "9a" "done" 100
  923. }
  924. # Saves the configuration of RCLONE_SCRIPT
  925. function 9aSaveConfiguration ()
  926. {
  927. printf "$(date +%FT%T%:z):\t9aSaveConfiguration\tSTART\n" >> "${logfile}"
  928. echo "remotebasedir=${remotebasedir}" > ~/scripts/rclone_script/rclone_script.ini
  929. echo "shownotifications=${shownotifications}" >> ~/scripts/rclone_script/rclone_script.ini
  930. echo "logfile=~/scripts/rclone_script/rclone_script.log" >> ~/scripts/rclone_script/rclone_script.ini
  931. echo "debug=0" >> ~/scripts/rclone_script/rclone_script.ini
  932. printf "$(date +%FT%T%:z):\t9aSaveConfiguration\tDONE\n" >> "${logfile}"
  933. }
  934. ########
  935. # MAIN #
  936. ########
  937. if [ "${branch}" == "beta" ]
  938. then
  939. dialogBetaWarning
  940. fi
  941. installer