1
0

rclone_script-install.sh 31 KB

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