freedombone-app-postactiv 37KB

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