freedombone-app-gnusocial 36KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # gnusocial application
  12. #
  13. # License
  14. # =======
  15. #
  16. # Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
  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 media'
  31. IN_DEFAULT_INSTALL=0
  32. SHOW_ON_ABOUT=1
  33. GNUSOCIAL_DOMAIN_NAME=
  34. GNUSOCIAL_CODE=
  35. GNUSOCIAL_ONION_PORT=8087
  36. GNUSOCIAL_REPO="https://git.gnu.io/gnu/gnu-social.git"
  37. GNUSOCIAL_COMMIT='d9fbc17f7745edb3e3eeddf6485f70b187df762f'
  38. GNUSOCIAL_ADMIN_PASSWORD=
  39. GNUSOCIAL_BACKGROUND_IMAGE_URL=
  40. GNUSOCIAL_TITLE='Pleroma FE'
  41. # Number of months after which posts expire
  42. GNUSOCIAL_EXPIRE_MONTHS=3
  43. gnusocial_variables=(ONION_ONLY
  44. GNUSOCIAL_DOMAIN_NAME
  45. GNUSOCIAL_CODE
  46. GNUSOCIAL_WELCOME_MESSAGE
  47. GNUSOCIAL_BACKGROUND_IMAGE_URL
  48. DDNS_PROVIDER
  49. GNUSOCIAL_TITLE
  50. GNUSOCIAL_EXPIRE_MONTHS
  51. MY_USERNAME)
  52. function logging_on_gnusocial {
  53. echo -n ''
  54. }
  55. function logging_off_gnusocial {
  56. echo -n ''
  57. }
  58. function gnusocial_fix_endless_reloads {
  59. # This fixes a bug introduced with commit 5f7032dfee1fd202c14e76a9f8b37af35d584901
  60. # and which causes OrFox to endlessly reload the page
  61. sed -i 's| && common_local_referer()||g' /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/lib/apiauthaction.php
  62. }
  63. function remove_user_gnusocial {
  64. remove_username="$1"
  65. ${PROJECT_NAME}-pass -u $remove_username --rmapp gnusocial
  66. function_check get_completion_param
  67. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  68. if [ -d /var/www/$GNUSOCIAL_DOMAIN_NAME ]; then
  69. cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
  70. php scripts/deleteprofile.php -n $remove_username -y
  71. fi
  72. }
  73. function add_user_gnusocial {
  74. new_username="$1"
  75. new_user_password="$2"
  76. ${PROJECT_NAME}-pass -u $new_username -a gnusocial -p "$new_user_password"
  77. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  78. if [ -d /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs ]; then
  79. cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
  80. php scripts/registeruser.php -n $new_username -w "$new_user_password" -e "$new_username@$HOSTNAME"
  81. ${PROJECT_NAME}-addemail -u $new_username -e "noreply@$GNUSOCIAL_DOMAIN_NAME" -g gnusocial --public no
  82. echo '0'
  83. else
  84. echo '1'
  85. fi
  86. }
  87. function install_interactive_gnusocial {
  88. if [ ! $ONION_ONLY ]; then
  89. ONION_ONLY='no'
  90. fi
  91. if [[ $ONION_ONLY != "no" ]]; then
  92. GNUSOCIAL_DOMAIN_NAME='gnusocial.local'
  93. else
  94. GNUSOCIAL_DETAILS_COMPLETE=
  95. while [ ! $GNUSOCIAL_DETAILS_COMPLETE ]
  96. do
  97. data=$(tempfile 2>/dev/null)
  98. trap "rm -f $data" 0 1 2 5 15
  99. if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
  100. dialog --backtitle $"Freedombone Configuration" \
  101. --title $"GNU Social Configuration" \
  102. --form $"\nPlease enter your GNU Social details. The background image URL can be left blank.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
  103. $"Domain:" 1 1 "$(grep 'GNUSOCIAL_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
  104. $"Title:" 2 1 "$(grep '$GNUSOCIAL_TITLE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
  105. $"Background image URL:" 3 1 "$(grep '$GNUSOCIAL_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
  106. $"Code:" 4 1 "$(grep 'GNUSOCIAL_CODE' temp.cfg | awk -F '=' '{print $2}')" 4 25 33 255 \
  107. 2> $data
  108. else
  109. dialog --backtitle $"Freedombone Configuration" \
  110. --title $"GNU Social Configuration" \
  111. --form $"\nPlease enter your GNU Social details. The background image URL can be left blank.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
  112. $"Domain:" 1 1 "$(grep 'GNUSOCIAL_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
  113. $"Title:" 2 1 "$(grep '$GNUSOCIAL_TITLE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
  114. $"Background image URL:" 3 1 "$(grep '$GNUSOCIAL_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
  115. 2> $data
  116. fi
  117. sel=$?
  118. case $sel in
  119. 1) exit 1;;
  120. 255) exit 1;;
  121. esac
  122. GNUSOCIAL_DOMAIN_NAME=$(cat $data | sed -n 1p)
  123. title=$(cat $data | sed -n 2p)
  124. if [ ${#title} -gt 1 ]; then
  125. GNUSOCIAL_TITLE=$welcome_msg
  126. fi
  127. img_url=$(cat $data | sed -n 3p)
  128. if [ ${#img_url} -gt 1 ]; then
  129. GNUSOCIAL_BACKGROUND_IMAGE_URL=$img_url
  130. fi
  131. if [ $GNUSOCIAL_DOMAIN_NAME ]; then
  132. if [[ $GNUSOCIAL_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then
  133. GNUSOCIAL_DOMAIN_NAME=""
  134. fi
  135. TEST_DOMAIN_NAME=$GNUSOCIAL_DOMAIN_NAME
  136. validate_domain_name
  137. if [[ $TEST_DOMAIN_NAME != $GNUSOCIAL_DOMAIN_NAME ]]; then
  138. GNUSOCIAL_DOMAIN_NAME=
  139. dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
  140. else
  141. if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
  142. GNUSOCIAL_CODE=$(cat $data | sed -n 4p)
  143. validate_freedns_code "$GNUSOCIAL_CODE"
  144. if [ ! $VALID_CODE ]; then
  145. GNUSOCIAL_DOMAIN_NAME=
  146. fi
  147. fi
  148. fi
  149. fi
  150. if [ $GNUSOCIAL_DOMAIN_NAME ]; then
  151. GNUSOCIAL_DETAILS_COMPLETE="yes"
  152. fi
  153. done
  154. # remove any invalid characters
  155. if [ ${#GNUSOCIAL_TITLE} -gt 0 ]; then
  156. new_title=$(echo "$GNUSOCIAL_TITLE" | sed "s|'||g")
  157. GNUSOCIAL_TITLE="$new_title"
  158. fi
  159. # save the results in the config file
  160. write_config_param "GNUSOCIAL_CODE" "$GNUSOCIAL_CODE"
  161. write_config_param "GNUSOCIAL_TITLE" "$GNUSOCIAL_TITLE"
  162. write_config_param "GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_BACKGROUND_IMAGE_URL"
  163. fi
  164. write_config_param "GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_DOMAIN_NAME"
  165. APP_INSTALLED=1
  166. }
  167. function change_password_gnusocial {
  168. curr_username="$1"
  169. new_user_password="$2"
  170. read_config_param 'GNUSOCIAL_DOMAIN_NAME'
  171. cd /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/scripts
  172. php setpassword.php "$curr_username" "$new_user_password"
  173. ${PROJECT_NAME}-pass -u "$curr_username" -a gnusocial -p "$new_user_password"
  174. }
  175. function gnusocial_create_database {
  176. if [ -f $IMAGE_PASSWORD_FILE ]; then
  177. GNUSOCIAL_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
  178. else
  179. if [ ! $GNUSOCIAL_ADMIN_PASSWORD ]; then
  180. GNUSOCIAL_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
  181. fi
  182. fi
  183. if [ ! $GNUSOCIAL_ADMIN_PASSWORD ]; then
  184. return
  185. fi
  186. function_check create_database
  187. create_database gnusocial "$GNUSOCIAL_ADMIN_PASSWORD" $MY_USERNAME
  188. }
  189. function reconfigure_gnusocial {
  190. echo -n ''
  191. }
  192. function gnusocial_set_background_image {
  193. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  194. data=$(tempfile 2>/dev/null)
  195. trap "rm -f $data" 0 1 2 5 15
  196. dialog --title $"GNU Social" \
  197. --backtitle $"Freedombone Control Panel" \
  198. --inputbox $'Set a background image URL' 10 60 2>$data
  199. sel=$?
  200. case $sel in
  201. 0)
  202. temp_background=$(<$data)
  203. if [ ${#temp_background} -gt 0 ]; then
  204. GNUSOCIAL_BACKGROUND_IMAGE_URL="$temp_background"
  205. write_config_param "GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_BACKGROUND_IMAGE_URL"
  206. if [[ $(pleroma_set_background_image_from_url /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs "$GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE" | tail -n 1) == "0" ]]; then
  207. dialog --title $"Set GNU Social login background" \
  208. --msgbox $"The background image has been set" 6 60
  209. fi
  210. fi
  211. ;;
  212. esac
  213. }
  214. function gnusocial_set_title {
  215. data=$(tempfile 2>/dev/null)
  216. trap "rm -f $data" 0 1 2 5 15
  217. dialog --title $"GNU Social" \
  218. --backtitle $"Freedombone Control Panel" \
  219. --inputbox $'Set a title' 10 60 2>$data
  220. sel=$?
  221. case $sel in
  222. 0)
  223. new_title=$(<$data)
  224. if [ ${#new_title} -gt 0 ]; then
  225. GNUSOCIAL_TITLE="$new_title"
  226. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  227. write_config_param "GNUSOCIAL_TITLE" "$GNUSOCIAL_TITLE"
  228. cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/static
  229. sed -i "s|\"name\":.*|\"name\": \"${GNUSOCIAL_TITLE}\",|g" config.json
  230. dialog --title $"Set GNU Social title" \
  231. --msgbox $"The title has been set" 6 60
  232. fi
  233. ;;
  234. esac
  235. }
  236. function gnusocial_set_expire_months {
  237. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  238. read_config_param "GNUSOCIAL_EXPIRE_MONTHS"
  239. data=$(tempfile 2>/dev/null)
  240. trap "rm -f $data" 0 1 2 5 15
  241. dialog --title $"GNU Social" \
  242. --backtitle $"Freedombone Control Panel" \
  243. --inputbox $'Set an expiry period for posts in months. Anything older will be deleted. Lower values help to keep the database size small and as fast as possible.' 12 60 "$GNUSOCIAL_EXPIRE_MONTHS" 2>$data
  244. sel=$?
  245. case $sel in
  246. 0)
  247. new_expiry_months=$(<$data)
  248. if [ ${#new_expiry_months} -gt 0 ]; then
  249. # should contain no spaces
  250. if [[ "$new_expiry_months" == *" "* ]]; then
  251. return
  252. fi
  253. # should be a number
  254. re='^[0-9]+$'
  255. if ! [[ $new_expiry_months =~ $re ]] ; then
  256. return
  257. fi
  258. # set the new value
  259. GNUSOCIAL_EXPIRE_MONTHS=$new_expiry_months
  260. write_config_param "GNUSOCIAL_EXPIRE_MONTHS" "$GNUSOCIAL_EXPIRE_MONTHS"
  261. expire_gnusocial_posts "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_EXPIRE_MONTHS"
  262. dialog --title $"Set GNU Social post expiry period" \
  263. --msgbox $"Expiry period set to $GNUSOCIAL_EXPIRE_MONTHS months" 6 60
  264. fi
  265. ;;
  266. esac
  267. }
  268. function configure_interactive_gnusocial {
  269. read_config_param GNUSOCIAL_EXPIRE_MONTHS
  270. while true
  271. do
  272. data=$(tempfile 2>/dev/null)
  273. trap "rm -f $data" 0 1 2 5 15
  274. dialog --backtitle $"Freedombone Control Panel" \
  275. --title $"GNU Social" \
  276. --radiolist $"Choose an operation:" 16 70 7 \
  277. 1 $"Set a background image" off \
  278. 2 $"Set the title" off \
  279. 3 $"Set post expiry period (currently $GNUSOCIAL_EXPIRE_MONTHS months)" off \
  280. 4 $"Select Qvitter user interface" off \
  281. 5 $"Select Pleroma user interface" off \
  282. 6 $"Select Classic user interface" off \
  283. 7 $"Exit" on 2> $data
  284. sel=$?
  285. case $sel in
  286. 1) return;;
  287. 255) return;;
  288. esac
  289. case $(cat $data) in
  290. 1) gnusocial_set_background_image;;
  291. 2) gnusocial_set_title;;
  292. 3) gnusocial_set_expire_months;;
  293. 4) gnusocial_use_qvitter gnusocial;;
  294. 5) gnusocial_use_pleroma gnusocial;;
  295. 6) gnusocial_use_classic gnusocial;;
  296. 7) break;;
  297. esac
  298. done
  299. }
  300. function upgrade_gnusocial {
  301. CURR_GNUSOCIAL_COMMIT=$(get_completion_param "gnusocial commit")
  302. if [[ "$CURR_GNUSOCIAL_COMMIT" == "$GNUSOCIAL_COMMIT" ]]; then
  303. return
  304. fi
  305. if grep -q "gnusocial domain" $COMPLETION_FILE; then
  306. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  307. fi
  308. # update to the next commit
  309. function_check set_repo_commit
  310. set_repo_commit /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs "gnusocial commit" "$GNUSOCIAL_COMMIT" $GNUSOCIAL_REPO
  311. gnusocial_fix_endless_reloads
  312. # Ensure that installation script is removed
  313. if [ -f /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/install.php ]; then
  314. rm /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/install.php
  315. fi
  316. if [ -f /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/index_qvitter.php ]; then
  317. if [ -f /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/index.php ]; then
  318. mv /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/index.php /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/index_qvitter.php
  319. fi
  320. fi
  321. gnusocial_block_user_script
  322. gnusocial_block_domain_script gnusocial $GNUSOCIAL_DOMAIN_NAME
  323. gnusocial_hourly_script gnusocial $GNUSOCIAL_DOMAIN_NAME
  324. if [ -d $INSTALL_DIR/pleroma ]; then
  325. upgrade_pleroma_frontend "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
  326. fi
  327. install_gnusocial_default_background "gnusocial" "$GNUSOCIAL_DOMAIN_NAME"
  328. chown -R www-data:www-data /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
  329. }
  330. function backup_local_gnusocial {
  331. GNUSOCIAL_DOMAIN_NAME='gnusocial'
  332. if grep -q "gnusocial domain" $COMPLETION_FILE; then
  333. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  334. fi
  335. # don't backup more data than we need to
  336. /etc/cron.daily/gnusocial-expire
  337. source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/backup
  338. if [ ! -d $source_directory ]; then
  339. mkdir $source_directory
  340. fi
  341. cp -p /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/config.php $source_directory
  342. if [ -d /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static ]; then
  343. cp -rp /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static $source_directory
  344. fi
  345. function_check suspend_site
  346. suspend_site ${GNUSOCIAL_DOMAIN_NAME}
  347. function_check backup_directory_to_usb
  348. dest_directory=gnusocialconfig
  349. backup_directory_to_usb $source_directory $dest_directory
  350. source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/file
  351. dest_directory=gnusocialfile
  352. backup_directory_to_usb $source_directory $dest_directory
  353. function_check backup_database_to_usb
  354. backup_database_to_usb gnusocial
  355. function_check restart_site
  356. restart_site
  357. }
  358. function restore_local_gnusocial {
  359. if ! grep -q "gnusocial domain" $COMPLETION_FILE; then
  360. return
  361. fi
  362. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  363. if [ $GNUSOCIAL_DOMAIN_NAME ]; then
  364. echo $"Restoring gnusocial"
  365. temp_restore_dir=/root/tempgnusocial
  366. gnusocial_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
  367. # stop the daemons
  368. cd $gnusocial_dir
  369. scripts/stopdaemons.sh
  370. function_check gnusocial_create_database
  371. gnusocial_create_database
  372. restore_database gnusocial
  373. if [ -d $temp_restore_dir ]; then
  374. rm -rf $temp_restore_dir
  375. fi
  376. function_check restore_directory_from_usb
  377. restore_directory_from_usb $temp_restore_dir gnusocialconfig
  378. if [ -d $temp_restore_dir ]; then
  379. if [ -d cp $temp_restore_dir$gnusocial_dir ]; then
  380. cp $temp_restore_dir$gnusocial_dir/backup/config.php $gnusocial_dir/
  381. cp -rp $temp_restore_dir$gnusocial_dir/static $gnusocial_dir/
  382. else
  383. cp $temp_restore_dir/backup/config.php $gnusocial_dir/
  384. if [ ! -d $gnusocial_dir/static ]; then
  385. mkdir $gnusocial_dir/static
  386. fi
  387. cp -rp $temp_restore_dir/static/* $gnusocial_dir/static/
  388. fi
  389. chown www-data:www-data $gnusocial_dir/config.php
  390. chown -R www-data:www-data $gnusocial_dir/static
  391. rm -rf $temp_restore_dir
  392. fi
  393. restore_directory_from_usb $temp_restore_dir gnusocialfile
  394. if [ -d $temp_restore_dir ]; then
  395. if [ -d cp $temp_restore_dir$gnusocial_dir/file ]; then
  396. cp -rp $temp_restore_dir$gnusocial_dir/file $gnusocial_dir/
  397. else
  398. if [ ! -d $gnusocial_dir/file ]; then
  399. mkdir $gnusocial_dir/file
  400. fi
  401. cp -rp $temp_restore_dir/* $gnusocial_dir/file
  402. fi
  403. chown -R www-data:www-data $gnusocial_dir/file
  404. rm -rf $temp_restore_dir
  405. fi
  406. gnusocial_update_after_restore gnusocial ${GNUSOCIAL_DOMAIN_NAME}
  407. echo $"Restore of gnusocial complete"
  408. fi
  409. }
  410. function backup_remote_gnusocial {
  411. GNUSOCIAL_DOMAIN_NAME='gnusocial'
  412. if grep -q "gnusocial domain" $COMPLETION_FILE; then
  413. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  414. fi
  415. # don't backup more data than we need to
  416. /etc/cron.daily/gnusocial-expire
  417. source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/backup
  418. if [ ! -d $source_directory ]; then
  419. mkdir $source_directory
  420. fi
  421. cp -p /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/config.php $source_directory
  422. if [ -d /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static ]; then
  423. cp -rp /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static $source_directory
  424. fi
  425. function_check suspend_site
  426. suspend_site ${GNUSOCIAL_DOMAIN_NAME}
  427. function_check backup_directory_to_friend
  428. dest_directory=gnusocialconfig
  429. backup_directory_to_friend $source_directory $dest_directory
  430. source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/file
  431. dest_directory=gnusocialfile
  432. backup_directory_to_friend $source_directory $dest_directory
  433. function_check backup_database_to_friend
  434. backup_database_to_friend gnusocial
  435. function_check restart_site
  436. restart_site
  437. }
  438. function restore_remote_gnusocial {
  439. if ! grep -q "gnusocial domain" $COMPLETION_FILE; then
  440. return
  441. fi
  442. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  443. if [ $GNUSOCIAL_DOMAIN_NAME ]; then
  444. echo $"Restoring gnusocial"
  445. temp_restore_dir=/root/tempgnusocial
  446. gnusocial_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
  447. # stop the daemons
  448. cd $gnusocial_dir
  449. scripts/stopdaemons.sh
  450. function_check gnusocial_create_database
  451. gnusocial_create_database
  452. function_check restore_database_from_friend
  453. restore_database_from_friend gnusocial
  454. if [ -d $temp_restore_dir ]; then
  455. rm -rf $temp_restore_dir
  456. fi
  457. function_check restore_directory_from_friend
  458. restore_directory_from_friend $temp_restore_dir gnusocialconfig
  459. if [ -d $temp_restore_dir ]; then
  460. if [ -d $temp_restore_dir$gnusocial_dir ]; then
  461. cp $temp_restore_dir$gnusocial_dir/backup/config.php $gnusocial_dir/
  462. cp -rp $temp_restore_dir$gnusocial_dir/static $gnusocial_dir/
  463. else
  464. cp $temp_restore_dir/backup/config.php $gnusocial_dir/
  465. if [ ! -d $gnusocial_dir/static ]; then
  466. mkdir $gnusocial_dir/static
  467. fi
  468. cp -rp $temp_restore_dir/static/* $gnusocial_dir/static/
  469. fi
  470. chown www-data:www-data $gnusocial_dir/config.php
  471. chown -R www-data:www-data $gnusocial_dir/static
  472. rm -rf $temp_restore_dir
  473. fi
  474. restore_directory_from_friend $temp_restore_dir gnusocialfile
  475. if [ -d $temp_restore_dir ]; then
  476. if [ ! -d $temp_restore_dir$gnusocial_dir/file ]; then
  477. cp -rp $temp_restore_dir$gnusocial_dir/file $gnusocial_dir/
  478. else
  479. if [ ! -d $gnusocial_dir/file ]; then
  480. mkdir $gnusocial_dir/file
  481. fi
  482. cp -rp $temp_restore_dir/* $gnusocial_dir/file/
  483. fi
  484. chown -R www-data:www-data $gnusocial_dir/file
  485. rm -rf $temp_restore_dir
  486. fi
  487. gnusocial_update_after_restore gnusocial ${GNUSOCIAL_DOMAIN_NAME}
  488. echo $"Restore of gnusocial complete"
  489. fi
  490. }
  491. function remove_gnusocial {
  492. if [ ${#GNUSOCIAL_DOMAIN_NAME} -eq 0 ]; then
  493. return
  494. fi
  495. function_check remove_nodejs
  496. remove_nodejs pleroma-gnusocial
  497. read_config_param "GNUSOCIAL_DOMAIN_NAME"
  498. read_config_param "MY_USERNAME"
  499. echo "Removing $GNUSOCIAL_DOMAIN_NAME"
  500. nginx_dissite $GNUSOCIAL_DOMAIN_NAME
  501. remove_certs $GNUSOCIAL_DOMAIN_NAME
  502. if [ -f /etc/cron.hourly/gnusocial-daemons ]; then
  503. rm /etc/cron.hourly/gnusocial-daemons
  504. fi
  505. if [ -f /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/stopdaemons.sh ]; then
  506. cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
  507. scripts/stopdaemons.sh
  508. fi
  509. kill_pid=$(ps aux | grep /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/queuedaemon.php | awk -F ' ' '{print $2}' | head -n 1)
  510. kill -9 $kill_pid
  511. if [ -d /var/www/$GNUSOCIAL_DOMAIN_NAME ]; then
  512. rm -rf /var/www/$GNUSOCIAL_DOMAIN_NAME
  513. fi
  514. if [ -f /etc/nginx/sites-available/$GNUSOCIAL_DOMAIN_NAME ]; then
  515. rm /etc/nginx/sites-available/$GNUSOCIAL_DOMAIN_NAME
  516. fi
  517. function_check drop_database
  518. drop_database gnusocial
  519. function_check remove_onion_service
  520. remove_onion_service gnusocial ${GNUSOCIAL_ONION_PORT}
  521. if grep -q "gnusocial" /etc/crontab; then
  522. sed -i "/gnusocial/d" /etc/crontab
  523. fi
  524. remove_app gnusocial
  525. remove_completion_param install_gnusocial
  526. sed -i '/gnusocial/d' $COMPLETION_FILE
  527. remove_backup_database_local gnusocial
  528. if grep -q 'gnusocial-firewall' /etc/crontab; then
  529. sed -i '/gnusocial-firewall/d' /etc/crontab
  530. fi
  531. function_check remove_ddns_domain
  532. remove_ddns_domain $GNUSOCIAL_DOMAIN_NAME
  533. }
  534. function install_gnusocial_main {
  535. if [ ! $GNUSOCIAL_DOMAIN_NAME ]; then
  536. echo $'No domain name was given for gnusocial'
  537. exit 7359
  538. fi
  539. if [[ $(app_is_installed gnusocial_main) == "1" ]]; then
  540. return
  541. fi
  542. gnusocial_hourly_script gnusocial $GNUSOCIAL_DOMAIN_NAME
  543. function_check install_mariadb
  544. install_mariadb
  545. function_check get_mariadb_password
  546. get_mariadb_password
  547. function_check repair_databases_script
  548. repair_databases_script
  549. apt-get -yq install php-gettext php-curl php-gd php-mysql git curl
  550. apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl
  551. if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME ]; then
  552. mkdir /var/www/$GNUSOCIAL_DOMAIN_NAME
  553. fi
  554. if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs ]; then
  555. if [ -d /repos/gnusocial ]; then
  556. mkdir /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
  557. cp -r -p /repos/gnusocial/. /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
  558. cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
  559. git pull
  560. else
  561. function_check git_clone
  562. git_clone $GNUSOCIAL_REPO /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
  563. fi
  564. if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs ]; then
  565. echo $'Unable to clone gnusocial repo'
  566. exit 87525
  567. fi
  568. fi
  569. cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
  570. git checkout $GNUSOCIAL_COMMIT -b $GNUSOCIAL_COMMIT
  571. set_completion_param "gnusocial commit" "$GNUSOCIAL_COMMIT"
  572. gnusocial_fix_endless_reloads
  573. chmod g+w /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
  574. chmod a+w /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/avatar
  575. chmod a+w /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/file
  576. chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
  577. chmod +x /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/maildaemon.php
  578. function_check gnusocial_create_database
  579. gnusocial_create_database
  580. if [ ! -f "/etc/aliases" ]; then
  581. touch /etc/aliases
  582. fi
  583. if ! grep -q "www-data: root" /etc/aliases; then
  584. echo 'www-data: root' >> /etc/aliases
  585. fi
  586. if ! grep -q "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/maildaemon.php" /etc/aliases; then
  587. echo "*: /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/maildaemon.php" >> /etc/aliases
  588. fi
  589. function_check add_ddns_domain
  590. add_ddns_domain $GNUSOCIAL_DOMAIN_NAME
  591. GNUSOCIAL_ONION_HOSTNAME=$(add_onion_service gnusocial 80 ${GNUSOCIAL_ONION_PORT})
  592. gnusocial_nginx_site=/etc/nginx/sites-available/$GNUSOCIAL_DOMAIN_NAME
  593. if [[ $ONION_ONLY == "no" ]]; then
  594. function_check nginx_http_redirect
  595. nginx_http_redirect $GNUSOCIAL_DOMAIN_NAME "index index.php"
  596. echo 'server {' >> $gnusocial_nginx_site
  597. echo ' listen 443 ssl;' >> $gnusocial_nginx_site
  598. echo ' listen [::]:443 ssl;' >> $gnusocial_nginx_site
  599. echo " server_name $GNUSOCIAL_DOMAIN_NAME;" >> $gnusocial_nginx_site
  600. echo '' >> $gnusocial_nginx_site
  601. function_check nginx_compress
  602. nginx_compress $GNUSOCIAL_DOMAIN_NAME
  603. echo '' >> $gnusocial_nginx_site
  604. echo ' # Security' >> $gnusocial_nginx_site
  605. function_check nginx_ssl
  606. nginx_ssl $GNUSOCIAL_DOMAIN_NAME
  607. function_check nginx_disable_sniffing
  608. nginx_disable_sniffing $GNUSOCIAL_DOMAIN_NAME
  609. echo ' add_header Strict-Transport-Security max-age=15768000;' >> $gnusocial_nginx_site
  610. echo '' >> $gnusocial_nginx_site
  611. echo ' # Logs' >> $gnusocial_nginx_site
  612. echo ' access_log /dev/null;' >> $gnusocial_nginx_site
  613. echo ' error_log /dev/null;' >> $gnusocial_nginx_site
  614. echo '' >> $gnusocial_nginx_site
  615. echo ' # Root' >> $gnusocial_nginx_site
  616. echo " root /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs;" >> $gnusocial_nginx_site
  617. echo '' >> $gnusocial_nginx_site
  618. echo ' # Index' >> $gnusocial_nginx_site
  619. echo ' index index.php;' >> $gnusocial_nginx_site
  620. echo '' >> $gnusocial_nginx_site
  621. echo ' # PHP' >> $gnusocial_nginx_site
  622. echo ' location ~ \.php {' >> $gnusocial_nginx_site
  623. echo ' include snippets/fastcgi-php.conf;' >> $gnusocial_nginx_site
  624. echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $gnusocial_nginx_site
  625. echo ' fastcgi_read_timeout 30;' >> $gnusocial_nginx_site
  626. echo ' }' >> $gnusocial_nginx_site
  627. echo '' >> $gnusocial_nginx_site
  628. echo ' # Location' >> $gnusocial_nginx_site
  629. echo ' location / {' >> $gnusocial_nginx_site
  630. function_check nginx_limits
  631. nginx_limits $GNUSOCIAL_DOMAIN_NAME '15m'
  632. echo ' try_files $uri $uri/ @gnusocial;' >> $gnusocial_nginx_site
  633. echo ' }' >> $gnusocial_nginx_site
  634. echo '' >> $gnusocial_nginx_site
  635. echo ' # Fancy URLs' >> $gnusocial_nginx_site
  636. echo ' location @gnusocial {' >> $gnusocial_nginx_site
  637. echo ' rewrite ^(.*)$ /index.php?p=$1 last;' >> $gnusocial_nginx_site
  638. echo ' }' >> $gnusocial_nginx_site
  639. echo '' >> $gnusocial_nginx_site
  640. echo ' # Restrict access that is unnecessary anyway' >> $gnusocial_nginx_site
  641. echo ' location ~ /\.(ht|git) {' >> $gnusocial_nginx_site
  642. echo ' deny all;' >> $gnusocial_nginx_site
  643. echo ' }' >> $gnusocial_nginx_site
  644. echo '' >> $gnusocial_nginx_site
  645. # DO NOT ENABLE KEYBASE. gnusocial really doesn't like having a .well-known directory
  646. echo '}' >> $gnusocial_nginx_site
  647. else
  648. echo -n '' > $gnusocial_nginx_site
  649. fi
  650. echo 'server {' >> $gnusocial_nginx_site
  651. echo " listen 127.0.0.1:$GNUSOCIAL_ONION_PORT default_server;" >> $gnusocial_nginx_site
  652. echo " server_name $GNUSOCIAL_ONION_HOSTNAME;" >> $gnusocial_nginx_site
  653. echo '' >> $gnusocial_nginx_site
  654. function_check nginx_compress
  655. nginx_compress $GNUSOCIAL_DOMAIN_NAME
  656. echo '' >> $gnusocial_nginx_site
  657. function_check nginx_disable_sniffing
  658. nginx_disable_sniffing $GNUSOCIAL_DOMAIN_NAME
  659. echo '' >> $gnusocial_nginx_site
  660. echo ' # Logs' >> $gnusocial_nginx_site
  661. echo ' access_log /dev/null;' >> $gnusocial_nginx_site
  662. echo ' error_log /dev/null;' >> $gnusocial_nginx_site
  663. echo '' >> $gnusocial_nginx_site
  664. echo ' # Root' >> $gnusocial_nginx_site
  665. echo " root /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs;" >> $gnusocial_nginx_site
  666. echo '' >> $gnusocial_nginx_site
  667. echo ' # Index' >> $gnusocial_nginx_site
  668. echo ' index index.php;' >> $gnusocial_nginx_site
  669. echo '' >> $gnusocial_nginx_site
  670. echo ' # PHP' >> $gnusocial_nginx_site
  671. echo ' location ~ \.php {' >> $gnusocial_nginx_site
  672. echo ' include snippets/fastcgi-php.conf;' >> $gnusocial_nginx_site
  673. echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $gnusocial_nginx_site
  674. echo ' fastcgi_read_timeout 30;' >> $gnusocial_nginx_site
  675. echo ' }' >> $gnusocial_nginx_site
  676. echo '' >> $gnusocial_nginx_site
  677. echo ' # Location' >> $gnusocial_nginx_site
  678. echo ' location / {' >> $gnusocial_nginx_site
  679. function_check nginx_limits
  680. nginx_limits $GNUSOCIAL_DOMAIN_NAME '15m'
  681. echo ' try_files $uri $uri/ @gnusocial;' >> $gnusocial_nginx_site
  682. echo ' }' >> $gnusocial_nginx_site
  683. echo '' >> $gnusocial_nginx_site
  684. echo ' # Fancy URLs' >> $gnusocial_nginx_site
  685. echo ' location @gnusocial {' >> $gnusocial_nginx_site
  686. echo ' rewrite ^(.*)$ /index.php?p=$1 last;' >> $gnusocial_nginx_site
  687. echo ' }' >> $gnusocial_nginx_site
  688. echo '' >> $gnusocial_nginx_site
  689. echo ' # Restrict access that is unnecessary anyway' >> $gnusocial_nginx_site
  690. echo ' location ~ /\.(ht|git) {' >> $gnusocial_nginx_site
  691. echo ' deny all;' >> $gnusocial_nginx_site
  692. echo ' }' >> $gnusocial_nginx_site
  693. echo '' >> $gnusocial_nginx_site
  694. # DO NOT ENABLE KEYBASE. gnusocial really doesn't like having a .well-known directory
  695. echo '}' >> $gnusocial_nginx_site
  696. function_check configure_php
  697. configure_php
  698. function_check create_site_certificate
  699. create_site_certificate $GNUSOCIAL_DOMAIN_NAME 'yes'
  700. # Ensure that the database gets backed up locally, if remote
  701. # backups are not being used
  702. function_check backup_databases_script_header
  703. backup_databases_script_header
  704. function_check backup_database_local
  705. backup_database_local gnusocial
  706. function_check nginx_ensite
  707. nginx_ensite $GNUSOCIAL_DOMAIN_NAME
  708. # NOTE: For the typical case always enable SSL and only
  709. # disable it if in onion only mode. This is due to complexities
  710. # with the way URLs are generated by gnusocial
  711. gnusocial_ssl='always'
  712. if [[ $ONION_ONLY != 'no' ]]; then
  713. gnusocial_ssl='never'
  714. fi
  715. GNUSOCIAL_SERVER=${GNUSOCIAL_DOMAIN_NAME}
  716. if [[ $ONION_ONLY != 'no' ]]; then
  717. GNUSOCIAL_SERVER=${GNUSOCIAL_ONION_HOSTNAME}
  718. fi
  719. # Create the configuration
  720. gnusocial_installer=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/scripts/install_cli.php
  721. if [ ! -f $gnusocial_installer ]; then
  722. rm -rf /var/www/$GNUSOCIAL_DOMAIN_NAME
  723. echo $'No gnusocial commandline installer found'
  724. exit 53026
  725. fi
  726. ${gnusocial_installer} --server "${GNUSOCIAL_SERVER}" \
  727. --host="localhost" --database="gnusocial" \
  728. --dbtype=mysql --username="root" -v \
  729. --password="$MARIADB_PASSWORD" \
  730. --sitename=$"GNU Social" --fancy='yes' \
  731. --admin-nick="$MY_USERNAME" \
  732. --admin-pass="$GNUSOCIAL_ADMIN_PASSWORD" \
  733. --site-profile="community" \
  734. --ssl=${gnusocial_ssl}
  735. # There can be a lot of warnings here so the return value check is disabled
  736. #if [ ! "$?" = "0" ]; then
  737. # # failed to install
  738. # echo $'Could not install GNU Social'
  739. # exit 72357
  740. #fi
  741. # check gnusocial has a config file
  742. gnusocial_config_file=/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/config.php
  743. if [ ! -f $gnusocial_config_file ]; then
  744. drop_database gnusocial
  745. rm -rf /var/www/$GNUSOCIAL_DOMAIN_NAME
  746. echo $'Gnusocial config.php not found'
  747. exit 87586
  748. fi
  749. # Some useful settings
  750. if ! grep -q "Recommended GNU social settings" $gnusocial_config_file; then
  751. echo "" >> $gnusocial_config_file
  752. echo "// Recommended GNU social settings" >> $gnusocial_config_file
  753. echo "\$config['thumbnail']['maxsize'] = 3000;" >> $gnusocial_config_file
  754. echo "\$config['profile']['delete'] = true;" >> $gnusocial_config_file
  755. echo "\$config['profile']['changenick'] = true;" >> $gnusocial_config_file
  756. echo "\$config['public']['localonly'] = false;" >> $gnusocial_config_file
  757. echo "addPlugin('StoreRemoteMedia');" >> $gnusocial_config_file
  758. echo "\$config['queue']['enabled'] = true;" >> $gnusocial_config_file
  759. echo "\$config['queue']['daemon'] = true;" >> $gnusocial_config_file
  760. echo "\$config['ostatus']['hub_retries'] = 3;" >> $gnusocial_config_file
  761. fi
  762. # turn off logging
  763. echo "\$config['site']['logfile'] = '/dev/null';" >> $gnusocial_config_file
  764. echo "\$config['mail']['domain'] = '${DEFAULT_DOMAIN_NAME}';" >> $gnusocial_config_file
  765. # This improves performance
  766. sed -i "s|//\$config\['db'\]\['schemacheck'\].*|\$config\['db'\]\['schemacheck'\] = 'script';|g" $gnusocial_config_file
  767. systemctl restart mariadb
  768. systemctl restart php7.0-fpm
  769. systemctl restart nginx
  770. ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$GNUSOCIAL_DOMAIN_NAME" -g gnusocial --public no
  771. ${PROJECT_NAME}-pass -u $MY_USERNAME -a gnusocial -p "$GNUSOCIAL_ADMIN_PASSWORD"
  772. gnusocial_block_user_script
  773. gnusocial_block_domain_script gnusocial "$GNUSOCIAL_DOMAIN_NAME"
  774. set_completion_param "gnusocial domain" "$GNUSOCIAL_DOMAIN_NAME"
  775. install_completed gnusocial_main
  776. }
  777. function install_gnusocial {
  778. if [ ! $ONION_ONLY ]; then
  779. ONION_ONLY='no'
  780. fi
  781. install_gnusocial_main
  782. expire_gnusocial_posts "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_EXPIRE_MONTHS"
  783. install_qvitter "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
  784. install_gnusocial_markdown "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
  785. install_gnusocial_plugin_sharings "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
  786. install_gnusocial_plugin_sharings_theme "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
  787. # Currently Pleroma won't install on ARM systems
  788. # because it uses node-sass which doesn't support ARM
  789. if [[ "$(arch)" == "arm"* || "$(arch)" == "aarch"* ]]; then
  790. echo -m $'WARNING: Pleroma currently does not support ARM '
  791. echo $'architecture, so it will not be installed'
  792. else
  793. function_check install_nodejs
  794. install_nodejs pleroma-gnusocial
  795. install_pleroma_front_end "gnusocial" "$GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
  796. install_gnusocial_default_background "gnusocial" "$GNUSOCIAL_DOMAIN_NAME"
  797. sed -i 's|"theme":.*|"theme": "base16-apathy.css",|g' /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static/config.json
  798. fi
  799. # unleash the daemons!
  800. /etc/cron.hourly/gnusocial-daemons
  801. systemctl restart nginx
  802. # Set qvitter to be the default UI. It's probably the most stable.
  803. # And doesn't forget logins
  804. gnusocial_use_qvitter gnusocial
  805. if [ $GNUSOCIAL_BACKGROUND_IMAGE_URL ]; then
  806. pleroma_set_background_image_from_url /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs "$GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
  807. fi
  808. APP_INSTALLED=1
  809. }
  810. # NOTE: deliberately there is no "exit 0"