freedombone-app-syncthing 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Syncthing application
  12. #
  13. # License
  14. # =======
  15. #
  16. # Copyright (C) 2014-2016 Bob Mottram <bob@robotics.uk.to>
  17. #
  18. # This program is free software: you can redistribute it and/or modify
  19. # it under the terms of the GNU Affero General Public License as published by
  20. # the Free Software Foundation, either version 3 of the License, or
  21. # (at your option) any later version.
  22. #
  23. # This program is distributed in the hope that it will be useful,
  24. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. # GNU Affero General Public License for more details.
  27. #
  28. # You should have received a copy of the GNU Affero General Public License
  29. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  30. VARIANTS='full full-vim cloud'
  31. SYNCTHING_ID=
  32. SYNCTHING_CONFIG_PATH=/root/.config/syncthing
  33. SYNCTHING_CONFIG_FILE=$SYNCTHING_CONFIG_PATH/config.xml
  34. SYNCTHING_RELAY_SERVER='https://relays.syncthing.net/endpoint'
  35. SYNCTHING_RELEASES='https://api.github.com/repos/syncthing/syncthing/releases?per_page=30'
  36. SYNCTHING_PORT=22000
  37. SYNCTHING_SHARED_DATA=/var/lib/syncthing/SyncShared
  38. SYNCTHING_USER_IDS_FILE='.syncthingids'
  39. syncthing_variables=(SYNCTHING_ID
  40. SYNCTHING_CONFIG_PATH
  41. SYNCTHING_CONFIG_FILE
  42. SYNCTHING_RELAY_SERVER
  43. SYNCTHING_RELEASES
  44. SYNCTHING_PORT
  45. SYNCTHING_SHARED_DATA
  46. USB_MOUNT)
  47. function syncthing_create_ids_file {
  48. if [ ! -f ~/.syncthing-server-id ]; then
  49. return
  50. fi
  51. SYNCTHING_ID=$(cat ~/.syncthing-server-id)
  52. if [ ! -f $SYNCTHING_CONFIG_FILE ]; then
  53. echo $'# Your syncthing configuration file' > $SYNCTHING_CONFIG_FILE
  54. echo '#' >> $SYNCTHING_CONFIG_FILE
  55. echo $"# The ${PROJECT_NAME} syncthing ID is: $SYNCTHING_ID" >> $SYNCTHING_CONFIG_FILE
  56. echo '#' >> $SYNCTHING_CONFIG_FILE
  57. echo '# Paste the IDs of your devices below' >> $SYNCTHING_CONFIG_FILE
  58. echo '#' >> $SYNCTHING_CONFIG_FILE
  59. fi
  60. }
  61. function syncthing_manual_edit {
  62. if [ ! -f ~/.syncthing-server-id ]; then
  63. return
  64. fi
  65. syncthing_create_ids_file
  66. editor $SYNCTHING_CONFIG_FILE
  67. # force an update of the configuration
  68. touch ~/.syncthing-update
  69. }
  70. function syncthing_show_id {
  71. if [ ! -f ~/.syncthing-server-id ]; then
  72. return
  73. fi
  74. SYNCTHING_ID=$(cat ~/.syncthing-server-id)
  75. dialog --title $"Device ID for ${PROJECT_NAME}" \
  76. --backtitle $"Freedombone User Control Panel" \
  77. --msgbox $"In a desktop terminal press shift and select the ID below,\nthen right click and copy.\n\nWithin Connectbot select Menu/Copy and then highlight the ID below\n\n$SYNCTHING_ID" 12 78
  78. }
  79. function syncthing_add_id {
  80. if [ ! -f ~/.syncthing-server-id ]; then
  81. return
  82. fi
  83. syncthing_create_ids_file
  84. data=$(tempfile 2>/dev/null)
  85. trap "rm -f $data" 0 1 2 5 15
  86. dialog --backtitle $"Freedombone User Control Panel" \
  87. --title $"Add a Syncthing device ID" \
  88. --form $"Paste the device ID for your laptop/desktop/netbook/phone/tablet below" 9 80 2 \
  89. $"Device ID:" 1 1 "" 1 26 80 80 \
  90. $"Description (optional):" 2 1 "" 2 26 80 80 \
  91. 2> $data
  92. sel=$?
  93. case $sel in
  94. 1) return;;
  95. 255) return;;
  96. esac
  97. SYNCTHING_DEVICE_ID=$(cat $data | sed -n 1p)
  98. SYNCTHING_DESCRIPTION=$(cat $data | sed -n 2p)
  99. if [ ${#SYNCTHING_DEVICE_ID} -lt 10 ]; then
  100. return
  101. fi
  102. if [[ $SYNCTHING_DEVICE_ID == *"#"* || $SYNCTHING_DEVICE_ID == *"*"* || $SYNCTHING_DEVICE_ID == *'/'* || $SYNCTHING_DEVICE_ID != *"-"* ]]; then
  103. dialog --title $"Add a Syncthing device ID" \
  104. --backtitle $"Freedombone User Control Panel" \
  105. --msgbox $"That doesn't look like a device ID" 6 50
  106. return
  107. fi
  108. if grep -q "$SYNCTHING_DEVICE_ID" $SYNCTHING_CONFIG_FILE; then
  109. dialog --title $"Add a Syncthing device ID" \
  110. --backtitle $"Freedombone User Control Panel" \
  111. --msgbox $"That ID has already been added" 6 50
  112. return
  113. fi
  114. if [ ${#SYNCTHING_DESCRIPTION} -gt 0 ]; then
  115. echo "# $SYNCTHING_DESCRIPTION" >> $SYNCTHING_CONFIG_FILE
  116. fi
  117. echo "$SYNCTHING_DEVICE_ID" >> $SYNCTHING_CONFIG_FILE
  118. # force an update of the configuration
  119. touch ~/.syncthing-update
  120. dialog --title $"Add a Syncthing device ID" \
  121. --backtitle $"Freedombone User Control Panel" \
  122. --msgbox $"The ID was added" 6 50
  123. }
  124. function syncthing_remove_id {
  125. if [ ! -f ~/.syncthing-server-id ]; then
  126. return
  127. fi
  128. syncthing_create_ids_file
  129. data=$(tempfile 2>/dev/null)
  130. trap "rm -f $data" 0 1 2 5 15
  131. dialog --backtitle $"Freedombone User Control Panel" \
  132. --title $"Remove a Syncthing device ID" \
  133. --form $"Paste the device ID which is to be removed below" 8 80 1 \
  134. $"Device ID:" 1 1 "" 1 14 80 80 \
  135. 2> $data
  136. sel=$?
  137. case $sel in
  138. 1) return;;
  139. 255) return;;
  140. esac
  141. SYNCTHING_DEVICE_ID=$(cat $data | sed -n 1p)
  142. if [ ${#SYNCTHING_DEVICE_ID} -lt 10 ]; then
  143. return
  144. fi
  145. if [[ $SYNCTHING_DEVICE_ID == *"#"* || $SYNCTHING_DEVICE_ID == *"*"* || $SYNCTHING_DEVICE_ID == *'/'* || $SYNCTHING_DEVICE_ID != *"-"* ]]; then
  146. dialog --title $"Remove a Syncthing device ID" \
  147. --backtitle $"Freedombone User Control Panel" \
  148. --msgbox $"That doesn't look like a device ID" 6 50
  149. return
  150. fi
  151. if ! grep -q "$SYNCTHING_DEVICE_ID" $SYNCTHING_CONFIG_FILE; then
  152. dialog --title $"Remove a Syncthing device ID" \
  153. --backtitle $"Freedombone User Control Panel" \
  154. --msgbox $"That ID wasn't registered anyway" 6 50
  155. return
  156. fi
  157. sed -i "/$SYNCTHING_DEVICE_ID/d" $SYNCTHING_CONFIG_FILE
  158. # force an update of the configuration
  159. touch ~/.syncthing-update
  160. dialog --title $"Remove a Syncthing device ID" \
  161. --backtitle $"Freedombone User Control Panel" \
  162. --msgbox $"The ID was removed" 6 50
  163. }
  164. function run_client_syncthing {
  165. SYNCTHING_CONFIG_FILE=~/.syncthingids
  166. SYNCTHING_ID=$(cat ~/.syncthing-server-id)
  167. while true
  168. do
  169. data=$(tempfile 2>/dev/null)
  170. trap "rm -f $data" 0 1 2 5 15
  171. dialog --backtitle $"Freedombone User Control Panel" \
  172. --title $"File Synchronization" \
  173. --radiolist $"Choose an operation:" 12 70 6 \
  174. 1 $"Show device ID for ${PROJECT_NAME}" off \
  175. 2 $"Add an ID for another machine or device" off \
  176. 3 $"Remove an ID for another machine or device" off \
  177. 4 $"Manually edit device IDs" off \
  178. 5 $"Back to main menu" on 2> $data
  179. sel=$?
  180. case $sel in
  181. 1) break;;
  182. 255) break;;
  183. esac
  184. case $(cat $data) in
  185. 1) syncthing_show_id;;
  186. 2) syncthing_add_id;;
  187. 3) syncthing_remove_id;;
  188. 4) syncthing_manual_edit;;
  189. 5) break;;
  190. esac
  191. done
  192. }
  193. function install_interactive_syncthing {
  194. echo -n ''
  195. APP_INSTALLED=1
  196. }
  197. function change_password_syncthing {
  198. echo -n ''
  199. }
  200. function reconfigure_syncthing {
  201. echo -n ''
  202. }
  203. function upgrade_syncthing {
  204. echo -n ''
  205. }
  206. function backup_local_syncthing {
  207. if [ -d /var/lib/syncthing/SyncShared ]; then
  208. echo $"Backing up syncthing"
  209. function_check backup_directory_to_usb
  210. backup_directory_to_usb /var/lib/syncthing/SyncShared syncthingshared
  211. backup_directory_to_usb /root/.config/syncthing syncthingconfig
  212. echo $"Backup to syncthing complete"
  213. fi
  214. for d in /home/*/ ; do
  215. USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
  216. if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
  217. if [ -d /home/$USERNAME/Sync ]; then
  218. echo $"Backing up syncthing files for $USERNAME"
  219. backup_directory_to_usb /home/$USERNAME/Sync syncthing/$USERNAME
  220. # ensure that device IDs will be backed up as part of user config settings
  221. if [ ! -d /home/$USERNAME/.config/syncthing ]; then
  222. mkdir -p /home/$USERNAME/.config/syncthing
  223. chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
  224. fi
  225. if [ -f /home/$USERNAME/.syncthing-server-id ]; then
  226. cp /home/$USERNAME/.syncthing-server-id /home/$USERNAME/.config/syncthing
  227. chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
  228. fi
  229. if [ -f /home/$USERNAME/.syncthingids ]; then
  230. cp /home/$USERNAME/.syncthingids /home/$USERNAME/.config/syncthing
  231. chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
  232. fi
  233. fi
  234. fi
  235. done
  236. }
  237. function restore_local_syncthing {
  238. if [ -f /etc/systemd/system/syncthing.service ]; then
  239. systemctl stop syncthing
  240. systemctl stop cron
  241. fi
  242. temp_restore_dir=/root/tempsyncthing
  243. if [ -d $USB_MOUNT/backup/syncthingconfig ]; then
  244. echo $"Restoring syncthing configuration"
  245. function_check restore_directory_from_usb
  246. restore_directory_from_usb ${temp_restore_dir}config syncthingconfig
  247. cp -r ${temp_restore_dir}config/* /
  248. if [ ! "$?" = "0" ]; then
  249. set_user_permissions
  250. backup_unmount_drive
  251. systemctl start syncthing
  252. systemctl start cron
  253. exit 6833
  254. fi
  255. rm -rf ${temp_restore_dir}config
  256. fi
  257. if [ -d $USB_MOUNT/backup/syncthingshared ]; then
  258. echo $"Restoring syncthing shared files"
  259. restore_directory_from_usb ${temp_restore_dir}shared syncthingshared
  260. cp -r ${temp_restore_dir}shared/* /
  261. if [ ! "$?" = "0" ]; then
  262. set_user_permissions
  263. backup_unmount_drive
  264. systemctl start syncthing
  265. systemctl start cron
  266. exit 37904
  267. fi
  268. rm -rf ${temp_restore_dir}shared
  269. fi
  270. if [ -d $USB_MOUNT/backup/syncthing ]; then
  271. for d in $USB_MOUNT/backup/syncthing/*/ ; do
  272. USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
  273. if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
  274. if [ ! -d /home/$USERNAME ]; then
  275. ${PROJECT_NAME}-adduser $USERNAME
  276. fi
  277. echo $"Restoring syncthing files for $USERNAME"
  278. restore_directory_from_usb ${temp_restore_dir} syncthing/$USERNAME
  279. cp -r ${temp_restore_dir}/home/$USERNAME/Sync /home/$USERNAME/
  280. if [ ! "$?" = "0" ]; then
  281. rm -rf ${temp_restore_dir}
  282. set_user_permissions
  283. backup_unmount_drive
  284. systemctl start syncthing
  285. systemctl start cron
  286. exit 68438
  287. fi
  288. rm -rf ${temp_restore_dir}
  289. # restore device IDs from config settings
  290. if [ -f /home/$USERNAME/.config/syncthing/.syncthing-server-id ]; then
  291. cp /home/$USERNAME/.config/syncthing/.syncthing-server-id /home/$USERNAME/.syncthing-server-id
  292. chown $USERNAME:$USERNAME /home/$USERNAME/.syncthing-server-id
  293. fi
  294. if [ -f /home/$USERNAME/.config/syncthing/.syncthingids ]; then
  295. cp /home/$USERNAME/.config/syncthing/.syncthingids /home/$USERNAME/.syncthingids
  296. chown $USERNAME:$USERNAME /home/$USERNAME/.syncthingids
  297. fi
  298. fi
  299. done
  300. fi
  301. if [ -f /etc/systemd/system/syncthing.service ]; then
  302. systemctl start syncthing
  303. systemctl start cron
  304. fi
  305. }
  306. function backup_remote_syncthing {
  307. if [ -d /root/.config/syncthing ]; then
  308. echo $"Backing up syncthing configuration"
  309. function_check backup_directory_to_friend
  310. backup_directory_to_friend /root/.config/syncthing syncthingconfig
  311. echo $"Backup of syncthing configuration complete"
  312. fi
  313. if [ -d /var/lib/syncthing/SyncShared ]; then
  314. echo $"Backing up syncthing shared files"
  315. function_check backup_directory_to_friend
  316. backup_directory_to_friend /var/lib/syncthing/SyncShared syncthingshared
  317. echo $"Backup of syncthing shared files complete"
  318. fi
  319. for d in /home/*/ ; do
  320. USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
  321. if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
  322. if [ -d /home/$USERNAME/Sync ]; then
  323. echo $"Backing up syncthing files for $USERNAME"
  324. backup_directory_to_friend /home/$USERNAME/Sync syncthing/$USERNAME
  325. # ensure that device IDs will be backed up as part of user config settings
  326. if [ ! -d /home/$USERNAME/.config/syncthing ]; then
  327. mkdir -p /home/$USERNAME/.config/syncthing
  328. chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
  329. fi
  330. if [ -f /home/$USERNAME/.syncthing-server-id ]; then
  331. cp /home/$USERNAME/.syncthing-server-id /home/$USERNAME/.config/syncthing
  332. chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
  333. fi
  334. if [ -f /home/$USERNAME/.syncthingids ]; then
  335. cp /home/$USERNAME/.syncthingids /home/$USERNAME/.config/syncthing
  336. chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
  337. fi
  338. fi
  339. fi
  340. done
  341. }
  342. function restore_remote_syncthing {
  343. if [ -f /etc/systemd/system/syncthing.service ]; then
  344. systemctl stop syncthing
  345. systemctl stop cron
  346. fi
  347. if [ -d $SERVER_DIRECTORY/backup/syncthingconfig ]; then
  348. echo $"Restoring syncthing configuration"
  349. temp_restore_dir=/root/tempsyncthingconfig
  350. function_check restore_directory_from_friend
  351. restore_directory_from_friend $temp_restore_dir syncthingconfig
  352. cp -r $temp_restore_dir/* /
  353. if [ ! "$?" = "0" ]; then
  354. systemctl start syncthing
  355. systemctl start cron
  356. exit 6833
  357. fi
  358. rm -rf $temp_restore_dir
  359. fi
  360. if [ -d $SERVER_DIRECTORY/backup/syncthingshared ]; then
  361. echo $"Restoring syncthing shared files"
  362. temp_restore_dir=/root/tempsyncthingshared
  363. function_check restore_directory_from_friend
  364. restore_directory_from_friend $temp_restore_dir syncthingshared
  365. cp -r $temp_restore_dir/* /
  366. if [ ! "$?" = "0" ]; then
  367. systemctl start syncthing
  368. systemctl start cron
  369. exit 37904
  370. fi
  371. rm -rf $temp_restore_dir
  372. fi
  373. if [ -d $SERVER_DIRECTORY/backup/syncthing ]; then
  374. for d in $SERVER_DIRECTORY/backup/syncthing/*/ ; do
  375. USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
  376. if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
  377. if [ ! -d /home/$USERNAME ]; then
  378. ${PROJECT_NAME}-adduser $USERNAME
  379. fi
  380. echo $"Restoring syncthing files for $USERNAME"
  381. temp_restore_dir=/root/tempsyncthing
  382. function_check restore_directory_from_friend
  383. restore_directory_from_friend $temp_restore_dir syncthing/$USERNAME
  384. cp -r $temp_restore_dir/home/$USERNAME/Sync /home/$USERNAME/
  385. if [ ! "$?" = "0" ]; then
  386. rm -rf $temp_restore_dir
  387. systemctl start syncthing
  388. systemctl start cron
  389. exit 68438
  390. fi
  391. rm -rf $temp_restore_dir
  392. # restore device IDs from config settings
  393. if [ -f /home/$USERNAME/.config/syncthing/.syncthing-server-id ]; then
  394. cp /home/$USERNAME/.config/syncthing/.syncthing-server-id /home/$USERNAME/.syncthing-server-id
  395. chown $USERNAME:$USERNAME /home/$USERNAME/.syncthing-server-id
  396. fi
  397. if [ -f /home/$USERNAME/.config/syncthing/.syncthingids ]; then
  398. cp /home/$USERNAME/.config/syncthing/.syncthingids /home/$USERNAME/.syncthingids
  399. chown $USERNAME:$USERNAME /home/$USERNAME/.syncthingids
  400. fi
  401. echo $"Restore of syncthing files for $USERNAME complete"
  402. fi
  403. done
  404. fi
  405. if [ -f /etc/systemd/system/syncthing.service ]; then
  406. systemctl start syncthing
  407. systemctl start cron
  408. fi
  409. }
  410. function remove_syncthing {
  411. iptables -D INPUT -p udp --dport $SYNCTHING_PORT -j ACCEPT
  412. iptables -D INPUT -p tcp --dport $SYNCTHING_PORT -j ACCEPT
  413. function_check save_firewall_settings
  414. save_firewall_settings
  415. systemctl stop syncthing
  416. systemctl disable syncthing
  417. apt-get -y remove --purge syncthing
  418. rm /etc/systemd/system/syncthing.service
  419. sed -i "/${PROJECT_NAME}-syncthing/d" /etc/crontab
  420. remove_completion_param install_syncthing
  421. remove_completion_param configure_firewall_for_syncthing
  422. systemctl restart cron
  423. }
  424. function configure_firewall_for_syncthing {
  425. if [[ $(is_completed $FUNCNAME) == "1" ]]; then
  426. return
  427. fi
  428. iptables -A INPUT -p udp --dport $SYNCTHING_PORT -j ACCEPT
  429. iptables -A INPUT -p tcp --dport $SYNCTHING_PORT -j ACCEPT
  430. function_check save_firewall_settings
  431. save_firewall_settings
  432. OPEN_PORTS+=("Syncthing $SYNCTHING_PORT")
  433. mark_completed $FUNCNAME
  434. }
  435. function install_syncthing {
  436. apt-get -y install curl
  437. curl -s https://syncthing.net/release-key.txt | apt-key add -
  438. echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list
  439. apt-get update
  440. apt-get -y install syncthing
  441. # This probably does need to run as root so that it can access the Sync directories
  442. # in each user's home directory
  443. echo '[Unit]' > /etc/systemd/system/syncthing.service
  444. echo 'Description=Syncthing - Open Source Continuous File Synchronization' >> /etc/systemd/system/syncthing.service
  445. echo 'Documentation=man:syncthing(1)' >> /etc/systemd/system/syncthing.service
  446. echo 'After=network.target' >> /etc/systemd/system/syncthing.service
  447. echo 'Wants=syncthing-inotify@.service' >> /etc/systemd/system/syncthing.service
  448. echo '' >> /etc/systemd/system/syncthing.service
  449. echo '[Service]' >> /etc/systemd/system/syncthing.service
  450. echo 'User=root' >> /etc/systemd/system/syncthing.service
  451. echo "Environment='all_proxy=socks5://localhost:9050'" >> /etc/systemd/system/syncthing.service
  452. echo 'ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0' >> /etc/systemd/system/syncthing.service
  453. echo 'Restart=on-failure' >> /etc/systemd/system/syncthing.service
  454. echo 'SuccessExitStatus=3 4' >> /etc/systemd/system/syncthing.service
  455. echo 'RestartForceExitStatus=3 4' >> /etc/systemd/system/syncthing.service
  456. echo '' >> /etc/systemd/system/syncthing.service
  457. echo '[Install]' >> /etc/systemd/system/syncthing.service
  458. echo 'WantedBy=multi-user.target' >> /etc/systemd/system/syncthing.service
  459. systemctl enable syncthing
  460. systemctl daemon-reload
  461. systemctl start syncthing
  462. function_check cron_add_mins
  463. cron_add_mins 1 "/usr/local/bin/${PROJECT_NAME}-syncthing > /dev/null"
  464. function_check configure_firewall_for_syncthing
  465. configure_firewall_for_syncthing
  466. APP_INSTALLED=1
  467. }
  468. # NOTE: deliberately no exit 0