freedombone-app-scuttlebot 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. #!/bin/bash
  2. # _____ _ _
  3. # | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
  4. # | __| _| -_| -_| . | . | | . | . | | -_|
  5. # |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
  6. #
  7. # Freedom in the Cloud
  8. #
  9. # scuttlebot pub application. Enables nat traversal for SSB.
  10. # https://scuttlebot.io
  11. #
  12. # License
  13. # =======
  14. #
  15. # Copyright (C) 2017-2018 Bob Mottram <bob@freedombone.net>
  16. #
  17. # This program is free software: you can redistribute it and/or modify
  18. # it under the terms of the GNU Affero General Public License as published by
  19. # the Free Software Foundation, either version 3 of the License, or
  20. # (at your option) any later version.
  21. #
  22. # This program is distributed in the hope that it will be useful,
  23. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. # GNU Affero General Public License for more details.
  26. #
  27. # You should have received a copy of the GNU Affero General Public License
  28. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  29. VARIANTS='full full-vim social'
  30. IN_DEFAULT_INSTALL=0
  31. SHOW_ON_ABOUT=0
  32. SHOW_ICANN_ADDRESS_ON_ABOUT=0
  33. SCUTTLEBOT_DOMAIN_NAME=
  34. SCUTTLEBOT_CODE=
  35. SCUTTLEBOT_VERSION='11.2.0'
  36. SCUTTLEBOT_PORT=8010
  37. SCUTTLEBOT_ONION_PORT=8623
  38. GIT_SSB_PORT=7718
  39. NGINX_GIT_SSB_PORT=7719
  40. scuttlebot_variables=(MY_USERNAME
  41. SCUTTLEBOT_DOMAIN_NAME
  42. SCUTTLEBOT_CODE
  43. DEFAULT_DOMAIN_NAME
  44. SYSTEM_TYPE)
  45. function logging_on_scuttlebot {
  46. echo -n ''
  47. }
  48. function logging_off_scuttlebot {
  49. echo -n ''
  50. }
  51. function scuttlebot_create_invite {
  52. invite_string=$(su -c "/etc/scuttlebot/node_modules/.bin/sbot invite.create 1" - scuttlebot | sed 's/"//g')
  53. clear
  54. echo -e "\\n\\nYour Scuttlebot invite code is:\\n\\n${invite_string}\\n\\n"
  55. # shellcheck disable=SC2034
  56. read -n1 -r -p $"Press any key to continue..." key
  57. }
  58. function configure_interactive_scuttlebot {
  59. W=(1 $"Create an invite")
  60. while true
  61. do
  62. # shellcheck disable=SC2068
  63. selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Scuttlebot" --menu $"Choose an operation, or ESC to exit:" 10 60 2 "${W[@]}" 3>&2 2>&1 1>&3)
  64. if [ ! "$selection" ]; then
  65. break
  66. fi
  67. case $selection in
  68. 1) scuttlebot_create_invite;;
  69. esac
  70. done
  71. }
  72. function remove_user_scuttlebot {
  73. echo -n ''
  74. # remove_username="$1"
  75. }
  76. function add_user_scuttlebot {
  77. # new_username="$1"
  78. # new_user_password="$2"
  79. echo '0'
  80. }
  81. function install_interactive_scuttlebot {
  82. if [[ $ONION_ONLY != "no" ]]; then
  83. SCUTTLEBOT_DOMAIN_NAME='scuttlebot.local'
  84. write_config_param "SCUTTLEBOT_DOMAIN_NAME" "$SCUTTLEBOT_DOMAIN_NAME"
  85. else
  86. function_check interactive_site_details
  87. interactive_site_details scuttlebot
  88. fi
  89. APP_INSTALLED=1
  90. }
  91. function change_password_scuttlebot {
  92. # new_username="$1"
  93. # new_user_password="$2"
  94. echo '0'
  95. }
  96. function reconfigure_scuttlebot {
  97. if [ -d /etc/scuttlebot/.ssb ]; then
  98. systemctl stop scuttlebot
  99. rm -rf /etc/scuttlebot/.ssb
  100. systemctl start scuttlebot
  101. fi
  102. }
  103. function upgrade_scuttlebot {
  104. if ! grep -q 'scuttlebot version:' $"COMPLETION_FILE"; then
  105. return
  106. fi
  107. CURR_SCUTTLEBOT_VERSION=$(get_completion_param "scuttlebot version")
  108. echo "scuttlebot current version: ${CURR_SCUTTLEBOT_VERSION}"
  109. echo "scuttlebot app version: ${SCUTTLEBOT_VERSION}"
  110. if [[ "${CURR_SCUTTLEBOT_VERSION}" == "${SCUTTLEBOT_VERSION}" ]]; then
  111. return
  112. fi
  113. if ! npm upgrade -g scuttlebot@${SCUTTLEBOT_VERSION} --save; then
  114. return
  115. fi
  116. sed -i "s|scuttlebot version.*|scuttlebot version:${SCUTTLEBOT_VERSION}|g" "${COMPLETION_FILE}"
  117. }
  118. function backup_local_scuttlebot {
  119. if [ -d /etc/scuttlebot/.ssb ]; then
  120. systemctl stop scuttlebot
  121. function_check backup_directory_to_usb
  122. backup_directory_to_usb /etc/scuttlebot/.ssb scuttlebot
  123. systemctl start scuttlebot
  124. fi
  125. }
  126. function restore_local_scuttlebot {
  127. if [ -d /etc/scuttlebot ]; then
  128. systemctl stop scuttlebot
  129. temp_restore_dir=/root/tempscuttlebot
  130. function_check restore_directory_from_usb
  131. restore_directory_from_usb $temp_restore_dir scuttlebot
  132. if [ -d $temp_restore_dir/etc/scuttlebot/.ssb ]; then
  133. cp -r $temp_restore_dir/etc/scuttlebot/.ssb /etc/scuttlebot/
  134. else
  135. cp -r $temp_restore_dir/* /etc/scuttlebot/.ssb/*
  136. fi
  137. systemctl start scuttlebot
  138. rm -rf $temp_restore_dir
  139. fi
  140. }
  141. function backup_remote_scuttlebot {
  142. if [ -d /etc/scuttlebot/.ssb ]; then
  143. systemctl stop scuttlebot
  144. function_check backup_directory_to_friend
  145. backup_directory_to_friend /etc/scuttlebot/.ssb scuttlebot
  146. systemctl start scuttlebot
  147. fi
  148. }
  149. function restore_remote_scuttlebot {
  150. if [ -d /etc/scuttlebot ]; then
  151. systemctl stop scuttlebot
  152. temp_restore_dir=/root/tempscuttlebot
  153. function_check restore_directory_from_friend
  154. restore_directory_from_friend $temp_restore_dir scuttlebot
  155. if [ -d $temp_restore_dir/etc/scuttlebot/.ssb ]; then
  156. cp -r $temp_restore_dir/etc/scuttlebot/.ssb /etc/scuttlebot/
  157. else
  158. cp -r $temp_restore_dir/* /etc/scuttlebot/.ssb/*
  159. fi
  160. systemctl start scuttlebot
  161. rm -rf $temp_restore_dir
  162. fi
  163. }
  164. function remove_scuttlebot {
  165. firewall_remove ${SCUTTLEBOT_PORT}
  166. firewall_remove ${GIT_SSB_PORT}
  167. if [ $SCUTTLEBOT_DOMAIN_NAME ]; then
  168. nginx_dissite ${SCUTTLEBOT_DOMAIN_NAME}
  169. rm /etc/nginx/sites-available/${SCUTTLEBOT_DOMAIN_NAME}
  170. fi
  171. systemctl stop git_ssb
  172. systemctl stop scuttlebot
  173. systemctl disable git_ssb
  174. systemctl disable scuttlebot
  175. rm /etc/systemd/system/git_ssb.service
  176. rm /etc/systemd/system/scuttlebot.service
  177. systemctl daemon-reload
  178. userdel -r scuttlebot
  179. if [ -d /etc/scuttlebot ]; then
  180. rm -rf /etc/scuttlebot
  181. fi
  182. if [ -f /usr/bin/git-ssb-create ]; then
  183. rm /usr/bin/git-ssb-create
  184. fi
  185. remove_completion_param install_scuttlebot
  186. sed -i '/scuttlebot /d' "$COMPLETION_FILE"
  187. }
  188. function git_ssb_script {
  189. if [[ "$1" == "mesh" ]]; then
  190. # shellcheck disable=SC2154
  191. git_ssb_script_name=$rootdir/usr/bin/git-ssb-create
  192. git_ssb_daemon_filename=$rootdir/etc/systemd/system/git_ssb.service
  193. else
  194. git_ssb_script_name=/usr/bin/git-ssb-create
  195. git_ssb_daemon_filename=/etc/systemd/system/git_ssb.service
  196. fi
  197. { echo '#!/bin/bash';
  198. echo "reponame=\"\$1\"";
  199. echo '';
  200. echo "if [[ \"\$reponame\" != \"\" ]]; then";
  201. echo " mkdir \$reponame";
  202. echo " cd \$reponame";
  203. echo ' git init';
  204. echo " git ssb create ssb \$reponame";
  205. echo ' git push --tags ssb master';
  206. echo 'fi';
  207. echo 'exit 0'; } > $git_ssb_script_name
  208. chmod +x $git_ssb_script_name
  209. { echo '[Unit]';
  210. echo 'Description=Git SSB (SSB git web interface)';
  211. echo 'After=syslog.target';
  212. echo 'After=network.target';
  213. echo 'After=scuttlebot.target';
  214. echo '';
  215. echo '[Service]';
  216. echo 'Type=simple';
  217. echo 'User=scuttlebot';
  218. echo 'Group=scuttlebot';
  219. echo "WorkingDirectory=/etc/scuttlebot";
  220. echo "ExecStart=/usr/bin/git ssb web --public localhost:$GIT_SSB_PORT";
  221. echo 'Restart=always';
  222. echo 'Environment="USER=scuttlebot"';
  223. echo '';
  224. echo '[Install]';
  225. echo 'WantedBy=multi-user.target'; } > $git_ssb_daemon_filename
  226. }
  227. function scuttlebot_git_setup {
  228. if [[ "$1" == "mesh" ]]; then
  229. if [ ! -d "$rootdir/usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight" ]; then
  230. mkdir "$rootdir/usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight"
  231. fi
  232. if [ ! -f "$rootdir/usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css" ]; then
  233. echo $'Could not find foundation.css'
  234. exit 347687245
  235. fi
  236. cp "$rootdir/usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css" "$rootdir/usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight/foundation.css"
  237. git_ssb_nginx_site=$rootdir/etc/nginx/sites-available/git_ssb
  238. { echo 'server {';
  239. echo " listen $NGINX_GIT_SSB_PORT default_server;";
  240. echo " server_name P${PEER_ID}.local;";
  241. echo '';
  242. echo ' access_log /dev/null;';
  243. echo ' error_log /dev/null;';
  244. echo '';
  245. echo ' add_header X-XSS-Protection "1; mode=block";';
  246. echo ' add_header X-Content-Type-Options nosniff;';
  247. echo ' add_header X-Frame-Options SAMEORIGIN;'; } > "$git_ssb_nginx_site"
  248. else
  249. if [ ! $SCUTTLEBOT_DOMAIN_NAME ]; then
  250. exit 7357225
  251. fi
  252. if [ ! -d /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight ]; then
  253. mkdir /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight
  254. fi
  255. if [ ! -f /usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css ]; then
  256. echo $'Could not find foundation.css'
  257. exit 347687245
  258. fi
  259. cp /usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight/foundation.css
  260. git_ssb_nginx_site=/etc/nginx/sites-available/${SCUTTLEBOT_DOMAIN_NAME}
  261. function_check nginx_http_redirect
  262. nginx_http_redirect $SCUTTLEBOT_DOMAIN_NAME "index index.html"
  263. { echo 'server {';
  264. echo ' listen 443 ssl;';
  265. echo ' #listen [::]:443 ssl;';
  266. echo " server_name $SCUTTLEBOT_DOMAIN_NAME;";
  267. echo ''; } >> $git_ssb_nginx_site
  268. function_check nginx_compress
  269. nginx_compress $SCUTTLEBOT_DOMAIN_NAME
  270. echo '' >> "$git_ssb_nginx_site"
  271. echo ' # Security' >> "$git_ssb_nginx_site"
  272. function_check nginx_ssl
  273. nginx_ssl $SCUTTLEBOT_DOMAIN_NAME
  274. function_check nginx_security_options
  275. nginx_security_options $SCUTTLEBOT_DOMAIN_NAME
  276. fi
  277. { echo '';
  278. echo ' root /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web;';
  279. echo '';
  280. echo ' location = / {';
  281. echo " proxy_pass http://localhost:${GIT_SSB_PORT};";
  282. echo " proxy_set_header X-Real-IP \$remote_addr;";
  283. echo " proxy_set_header Host \$host;";
  284. echo " proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;";
  285. echo ' proxy_http_version 1.1;';
  286. echo " proxy_set_header Upgrade \$http_upgrade;";
  287. echo ' proxy_set_header Connection upgrade;';
  288. echo ' }';
  289. echo '}'; } >> $git_ssb_nginx_site
  290. if [ "$SCUTTLEBOT_ONION_HOSTNAME" ]; then
  291. { echo '';
  292. echo 'server {';
  293. echo " listen 127.0.0.1:${SCUTTLEBOT_ONION_PORT} default_server;";
  294. echo " server_name ${SCUTTLEBOT_ONION_HOSTNAME};";
  295. echo '';
  296. echo ' access_log /dev/null;';
  297. echo ' error_log /dev/null;';
  298. echo '';
  299. echo ' add_header X-XSS-Protection "1; mode=block";';
  300. echo ' add_header X-Content-Type-Options nosniff;';
  301. echo ' add_header X-Frame-Options SAMEORIGIN;';
  302. echo '';
  303. echo ' root /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web;';
  304. echo '';
  305. echo ' location = / {';
  306. echo " proxy_pass http://localhost:${GIT_SSB_PORT};";
  307. echo " proxy_set_header X-Real-IP \$remote_addr;";
  308. echo " proxy_set_header Host \$host;";
  309. echo " proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;";
  310. echo ' proxy_http_version 1.1;';
  311. echo " proxy_set_header Upgrade \$http_upgrade;";
  312. echo ' proxy_set_header Connection upgrade;';
  313. echo ' }';
  314. echo '}'; } >> $git_ssb_nginx_site
  315. fi
  316. if [[ "$1" != "mesh" ]]; then
  317. nginx_ensite git_ssb
  318. fi
  319. }
  320. function mesh_install_dat {
  321. get_npm_arch
  322. mesh_setup_npm
  323. cat <<EOF > "$rootdir/usr/bin/install_dat"
  324. #!/bin/bash
  325. npm install --arch=$NPM_ARCH -g dat
  326. EOF
  327. chroot "$rootdir" /bin/chmod +x /usr/bin/install_dat
  328. chroot "$rootdir" /usr/bin/install_dat
  329. rm "$rootdir/usr/bin/install_dat"
  330. }
  331. function install_dat {
  332. npm install -g dat
  333. }
  334. function mesh_install_scuttlebot {
  335. SCUTTLEBOT_ONION_HOSTNAME=
  336. mesh_install_dat
  337. get_npm_arch
  338. mesh_setup_npm
  339. if [ ! -d "$rootdir/etc/scuttlebot" ]; then
  340. mkdir -p "$rootdir/etc/scuttlebot"
  341. fi
  342. # an unprivileged user to install and run as
  343. chroot "$rootdir" useradd -d /etc/scuttlebot/ scuttlebot
  344. chroot "$rootdir" chown -R scuttlebot:scuttlebot /etc/scuttlebot
  345. cat <<EOF > "$rootdir/usr/bin/install_scuttlebot"
  346. #!/bin/bash
  347. cd /etc/scuttlebot || exit 1
  348. if ! npm install --arch=$NPM_ARCH scuttlebot@${SCUTTLEBOT_VERSION}; then
  349. exit 2
  350. fi
  351. exit 0
  352. EOF
  353. chroot "$rootdir" /bin/chmod +x /usr/bin/install_scuttlebot
  354. chroot "$rootdir" sudo -u scuttlebot /usr/bin/install_scuttlebot
  355. rm "$rootdir/usr/bin/install_scuttlebot"
  356. if [ ! -f "$rootdir/etc/scuttlebot/node_modules/.bin/sbot" ]; then
  357. echo $'Scuttlebot was not installed'
  358. exit 528253
  359. fi
  360. cat <<EOF > "$rootdir/usr/bin/install_git_ssb"
  361. #!/bin/bash
  362. if ! npm install --arch=$NPM_ARCH -g git-ssb; then
  363. exit 1
  364. fi
  365. if ! npm install --arch=$NPM_ARCH -g git-remote-ssb; then
  366. exit 2
  367. fi
  368. exit 0
  369. EOF
  370. chroot "$rootdir" /bin/chmod +x /usr/bin/install_git_ssb
  371. chroot "$rootdir" /usr/bin/install_git_ssb
  372. rm "$rootdir/usr/bin/install_git_ssb"
  373. # daemon
  374. { echo '[Unit]';
  375. echo 'Description=Scuttlebot (messaging system)';
  376. echo 'After=syslog.target';
  377. echo 'After=network.target';
  378. echo '';
  379. echo '[Service]';
  380. echo 'Type=simple';
  381. echo 'User=scuttlebot';
  382. echo 'Group=scuttlebot';
  383. echo "WorkingDirectory=/etc/scuttlebot";
  384. echo 'ExecStart=/etc/scuttlebot/node_modules/.bin/sbot server';
  385. echo 'Restart=always';
  386. echo 'Environment="USER=scuttlebot"';
  387. echo '';
  388. echo '[Install]';
  389. echo 'WantedBy=multi-user.target'; } > "$rootdir/etc/systemd/system/scuttlebot.service"
  390. scuttlebot_git_setup mesh
  391. git_ssb_script mesh
  392. }
  393. function install_scuttlebot {
  394. function_check install_nodejs
  395. install_nodejs scuttlebot
  396. if [ ! -d /etc/scuttlebot ]; then
  397. mkdir -p /etc/scuttlebot
  398. fi
  399. # an unprivileged user to install and run as
  400. useradd -d /etc/scuttlebot/ scuttlebot
  401. chown -R scuttlebot:scuttlebot /etc/scuttlebot
  402. cat <<EOF > /usr/bin/install_scuttlebot
  403. #!/bin/bash
  404. cd /etc/scuttlebot || exit 1
  405. if ! npm install scuttlebot@${SCUTTLEBOT_VERSION}; then
  406. exit 2
  407. fi
  408. exit 0
  409. EOF
  410. chmod +x /usr/bin/install_scuttlebot
  411. su -c '/usr/bin/install_scuttlebot' - scuttlebot
  412. rm /usr/bin/install_scuttlebot
  413. if [ ! -f /etc/scuttlebot/node_modules/.bin/sbot ]; then
  414. echo $'Scuttlebot was not installed'
  415. exit 528253
  416. fi
  417. install_dat
  418. npm install -g git-ssb
  419. npm install -g git-remote-ssb
  420. # daemon
  421. { echo '[Unit]';
  422. echo 'Description=Scuttlebot (messaging system)';
  423. echo 'After=syslog.target';
  424. echo 'After=network.target';
  425. echo '';
  426. echo '[Service]';
  427. echo 'Type=simple';
  428. echo 'User=scuttlebot';
  429. echo 'Group=scuttlebot';
  430. echo "WorkingDirectory=/etc/scuttlebot";
  431. echo 'ExecStart=/etc/scuttlebot/node_modules/.bin/sbot server';
  432. echo 'Restart=always';
  433. echo 'Environment="USER=scuttlebot"';
  434. echo '';
  435. echo '[Install]';
  436. echo 'WantedBy=multi-user.target'; } > /etc/systemd/system/scuttlebot.service
  437. chown -R scuttlebot:scuttlebot /etc/scuttlebot
  438. # files gw_name myhostname mdns4_minimal [NOTFOUND=return] dns
  439. sed -i "s|hosts:.*|hosts: files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf
  440. # start the daemon
  441. systemctl enable scuttlebot.service
  442. systemctl daemon-reload
  443. systemctl start scuttlebot.service
  444. sleep 3
  445. if [ ! -d /etc/scuttlebot/.ssb ]; then
  446. echo $'Scuttlebot config not generated'
  447. exit 73528
  448. fi
  449. SCUTTLEBOT_ONION_HOSTNAME=$(add_onion_service scuttlebot 80 ${SCUTTLEBOT_ONION_PORT})
  450. if [[ "$ONION_ONLY" == 'no' ]]; then
  451. { echo '{';
  452. echo " \"host\": \"${DEFAULT_DOMAIN_NAME}\",";
  453. echo ' "tor-only": false,'; } > /etc/scuttlebot/.ssb/config
  454. else
  455. { echo '{';
  456. echo " \"host\": \"${SCUTTLEBOT_ONION_HOSTNAME}\",";
  457. echo ' "tor-only": true,'; } > /etc/scuttlebot/.ssb/config
  458. fi
  459. { echo " \"port\": ${SCUTTLEBOT_PORT},";
  460. echo ' "timeout": 30000,';
  461. echo ' "pub": true,';
  462. echo ' "local": true,';
  463. echo ' "friends": {';
  464. echo ' "dunbar": 150,';
  465. echo ' "hops": 3';
  466. echo ' },';
  467. echo ' "gossip": {';
  468. echo ' "connections": 2';
  469. echo ' },';
  470. echo ' "master": [],';
  471. echo ' "logging": {';
  472. echo ' "level": "error"';
  473. echo ' }';
  474. echo '}'; } >> /etc/scuttlebot/.ssb/config
  475. chown scuttlebot:scuttlebot /etc/scuttlebot/.ssb/config
  476. systemctl restart scuttlebot.service
  477. firewall_add scuttlebot ${SCUTTLEBOT_PORT}
  478. firewall_add git_ssb ${GIT_SSB_PORT}
  479. scuttlebot_git_setup
  480. git_ssb_script
  481. systemctl enable git_ssb.service
  482. systemctl daemon-reload
  483. systemctl start git_ssb.service
  484. function_check create_site_certificate
  485. create_site_certificate ${SCUTTLEBOT_DOMAIN_NAME} 'yes'
  486. systemctl restart nginx
  487. if ! grep -q "scuttlebot version:" "${COMPLETION_FILE}"; then
  488. echo "scuttlebot version:${SCUTTLEBOT_VERSION}" >> "${COMPLETION_FILE}"
  489. else
  490. sed -i "s|scuttlebot version.*|scuttlebot version:${SCUTTLEBOT_VERSION}|g" "${COMPLETION_FILE}"
  491. fi
  492. APP_INSTALLED=1
  493. }
  494. # NOTE: deliberately no exit 0