freedombone-app-postactiv 37KB

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