freedombone-app-gnusocial 36KB

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