freedombone-app-nextcloud 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # nextcloud application
  12. # In tests this is much too slow, and it appeared to self-destruct after a few minutes
  13. # i.e. becoming totally unusable.
  14. #
  15. # License
  16. # =======
  17. #
  18. # Copyright (C) 2017 Bob Mottram <bob@freedombone.net>
  19. #
  20. # This program is free software: you can redistribute it and/or modify
  21. # it under the terms of the GNU Affero General Public License as published by
  22. # the Free Software Foundation, either version 3 of the License, or
  23. # (at your option) any later version.
  24. #
  25. # This program is distributed in the hope that it will be useful,
  26. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28. # GNU Affero General Public License for more details.
  29. #
  30. # You should have received a copy of the GNU Affero General Public License
  31. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  32. VARIANTS=''
  33. IN_DEFAULT_INSTALL=0
  34. SHOW_ON_ABOUT=0
  35. NEXTCLOUD_DOMAIN_NAME=
  36. NEXTCLOUD_CODE=
  37. NEXTCLOUD_ONION_PORT=8112
  38. NEXTCLOUD_REPO="https://github.com/nextcloud/server"
  39. NEXTCLOUD_COMMIT='562c45d925a27b21f694a091029d87158364970c'
  40. NEXTCLOUD_ADMIN_PASSWORD=
  41. nextcloud_variables=(ONION_ONLY
  42. NEXTCLOUD_DOMAIN_NAME
  43. NEXTCLOUD_CODE
  44. DDNS_PROVIDER
  45. MY_USERNAME)
  46. function remove_user_nextcloud {
  47. remove_username="$1"
  48. ${PROJECT_NAME}-pass -u $remove_username --rmapp nextcloud
  49. }
  50. function add_user_nextcloud {
  51. new_username="$1"
  52. new_user_password="$2"
  53. ${PROJECT_NAME}-pass -u $new_username -a nextcloud -p "$new_user_password"
  54. echo '0'
  55. }
  56. function install_interactive_nextcloud {
  57. if [ ! $ONION_ONLY ]; then
  58. ONION_ONLY='no'
  59. fi
  60. if [[ $ONION_ONLY != "no" ]]; then
  61. NEXTCLOUD_DOMAIN_NAME='nextcloud.local'
  62. else
  63. NEXTCLOUD_DETAILS_COMPLETE=
  64. while [ ! $NEXTCLOUD_DETAILS_COMPLETE ]
  65. do
  66. data=$(tempfile 2>/dev/null)
  67. trap "rm -f $data" 0 1 2 5 15
  68. if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
  69. dialog --backtitle $"Freedombone Configuration" \
  70. --title $"NextCloud Configuration" \
  71. --form $"\nPlease enter your NextCloud details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 13 65 3 \
  72. $"Domain:" 1 1 "$(grep 'NEXTCLOUD_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 15 40 40 \
  73. $"Code:" 2 1 "$(grep 'NEXTCLOUD_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 15 40 255 \
  74. 2> $data
  75. else
  76. dialog --backtitle $"Freedombone Configuration" \
  77. --title $"NextCloud Configuration" \
  78. --form $"\nPlease enter your NextCloud details. The background image URL can be left blank.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 13 65 2 \
  79. $"Domain:" 1 1 "$(grep 'NEXTCLOUD_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 15 40 40 \
  80. 2> $data
  81. fi
  82. sel=$?
  83. case $sel in
  84. 1) exit 1;;
  85. 255) exit 1;;
  86. esac
  87. NEXTCLOUD_DOMAIN_NAME=$(cat $data | sed -n 1p)
  88. if [ ${#img_url} -gt 1 ]; then
  89. NEXTCLOUD_BACKGROUND_IMAGE_URL=$img_url
  90. fi
  91. if [ $NEXTCLOUD_DOMAIN_NAME ]; then
  92. TEST_DOMAIN_NAME=$NEXTCLOUD_DOMAIN_NAME
  93. validate_domain_name
  94. if [[ $TEST_DOMAIN_NAME != $NEXTCLOUD_DOMAIN_NAME ]]; then
  95. NEXTCLOUD_DOMAIN_NAME=
  96. dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
  97. else
  98. if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
  99. NEXTCLOUD_CODE=$(cat $data | sed -n 2p)
  100. validate_freedns_code "$NEXTCLOUD_CODE"
  101. if [ ! $VALID_CODE ]; then
  102. NEXTCLOUD_DOMAIN_NAME=
  103. fi
  104. fi
  105. fi
  106. fi
  107. if [ $NEXTCLOUD_DOMAIN_NAME ]; then
  108. NEXTCLOUD_DETAILS_COMPLETE="yes"
  109. fi
  110. done
  111. # remove any invalid characters
  112. if [ ${#NEXTCLOUD_TITLE} -gt 0 ]; then
  113. new_title=$(echo "$NEXTCLOUD_TITLE" | sed "s|'||g")
  114. NEXTCLOUD_TITLE="$new_title"
  115. fi
  116. # save the results in the config file
  117. write_config_param "NEXTCLOUD_CODE" "$NEXTCLOUD_CODE"
  118. fi
  119. write_config_param "NEXTCLOUD_DOMAIN_NAME" "$NEXTCLOUD_DOMAIN_NAME"
  120. APP_INSTALLED=1
  121. }
  122. function change_password_nextcloud {
  123. curr_username="$1"
  124. new_user_password="$2"
  125. read_config_param ${NEXTCLOUD_DOMAIN_NAME}
  126. ${PROJECT_NAME}-pass -u "$curr_username" -a nextcloud -p "$new_user_password"
  127. }
  128. function nextcloud_create_database {
  129. if [ -f $IMAGE_PASSWORD_FILE ]; then
  130. NEXTCLOUD_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
  131. else
  132. if [ ! $NEXTCLOUD_ADMIN_PASSWORD ]; then
  133. NEXTCLOUD_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
  134. fi
  135. fi
  136. if [ ! $NEXTCLOUD_ADMIN_PASSWORD ]; then
  137. return
  138. fi
  139. function_check create_database
  140. create_database nextcloud "$NEXTCLOUD_ADMIN_PASSWORD" $MY_USERNAME
  141. }
  142. function reconfigure_nextcloud {
  143. echo -n ''
  144. }
  145. function configure_interactive_nextcloud {
  146. echo -n ''
  147. }
  148. function upgrade_nextcloud {
  149. if grep -q "nextcloud domain" $COMPLETION_FILE; then
  150. NEXTCLOUD_DOMAIN_NAME=$(get_completion_param "nextcloud domain")
  151. fi
  152. # update to the next commit
  153. function_check set_repo_commit
  154. set_repo_commit /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs "nextcloud commit" "$NEXTCLOUD_COMMIT" $NEXTCLOUD_REPO
  155. chown -R www-data:www-data /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs/config
  156. chown -R www-data:www-data /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs/data
  157. }
  158. function backup_local_nextcloud {
  159. NEXTCLOUD_DOMAIN_NAME='nextcloud'
  160. if grep -q "nextcloud domain" $COMPLETION_FILE; then
  161. NEXTCLOUD_DOMAIN_NAME=$(get_completion_param "nextcloud domain")
  162. fi
  163. source_directory=/var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
  164. if [ -d $source_directory ]; then
  165. dest_directory=nextcloud
  166. function_check suspend_site
  167. suspend_site ${NEXTCLOUD_DOMAIN_NAME}
  168. function_check backup_directory_to_usb
  169. backup_directory_to_usb $source_directory $dest_directory
  170. function_check backup_database_to_usb
  171. backup_database_to_usb nextcloud
  172. function_check restart_site
  173. restart_site
  174. fi
  175. }
  176. function restore_local_nextcloud {
  177. if ! grep -q "nextcloud domain" $COMPLETION_FILE; then
  178. return
  179. fi
  180. NEXTCLOUD_DOMAIN_NAME=$(get_completion_param "nextcloud domain")
  181. if [ $NEXTCLOUD_DOMAIN_NAME ]; then
  182. temp_restore_dir=/root/tempnextcloud
  183. nextcloud_dir=/var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
  184. function_check nextcloud_create_database
  185. nextcloud_create_database
  186. restore_database nextcloud ${NEXTCLOUD_DOMAIN_NAME}
  187. if [ -d $temp_restore_dir ]; then
  188. rm -rf $temp_restore_dir
  189. fi
  190. fi
  191. }
  192. function backup_remote_nextcloud {
  193. if grep -q "nextcloud domain" $COMPLETION_FILE; then
  194. NEXTCLOUD_DOMAIN_NAME=$(get_completion_param "nextcloud domain")
  195. temp_backup_dir=/var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
  196. if [ -d $temp_backup_dir ]; then
  197. function_check suspend_site
  198. suspend_site ${NEXTCLOUD_DOMAIN_NAME}
  199. function_check backup_database_to_friend
  200. backup_database_to_friend nextcloud
  201. echo $"Backing up GNU social installation"
  202. function_check backup_directory_to_friend
  203. backup_directory_to_friend $temp_backup_dir nextcloud
  204. function_check restart_site
  205. restart_site
  206. else
  207. echo $"nextcloud domain specified but not found in ${temp_backup_dir}"
  208. fi
  209. fi
  210. }
  211. function restore_remote_nextcloud {
  212. if grep -q "nextcloud domain" $COMPLETION_FILE; then
  213. echo $"Restoring nextcloud"
  214. NEXTCLOUD_DOMAIN_NAME=$(get_completion_param "nextcloud domain")
  215. function_check nextcloud_create_database
  216. nextcloud_create_database
  217. function_check restore_database_from_friend
  218. restore_database_from_friend nextcloud ${NEXTCLOUD_DOMAIN_NAME}
  219. if [ -d /root/tempnextcloud ]; then
  220. rm -rf /root/tempnextcloud
  221. fi
  222. fi
  223. }
  224. function remove_nextcloud {
  225. if [ ${#NEXTCLOUD_DOMAIN_NAME} -eq 0 ]; then
  226. return
  227. fi
  228. function_check remove_nodejs
  229. remove_nodejs pleroma-nextcloud
  230. read_config_param "NEXTCLOUD_DOMAIN_NAME"
  231. read_config_param "MY_USERNAME"
  232. echo "Removing $NEXTCLOUD_DOMAIN_NAME"
  233. nginx_dissite $NEXTCLOUD_DOMAIN_NAME
  234. remove_certs $NEXTCLOUD_DOMAIN_NAME
  235. if [ -d /var/www/$NEXTCLOUD_DOMAIN_NAME ]; then
  236. rm -rf /var/www/$NEXTCLOUD_DOMAIN_NAME
  237. fi
  238. if [ -f /etc/nginx/sites-available/$NEXTCLOUD_DOMAIN_NAME ]; then
  239. rm /etc/nginx/sites-available/$NEXTCLOUD_DOMAIN_NAME
  240. fi
  241. function_check drop_database
  242. drop_database nextcloud
  243. function_check remove_onion_service
  244. remove_onion_service nextcloud ${NEXTCLOUD_ONION_PORT}
  245. if grep -q "nextcloud" /etc/crontab; then
  246. sed -i "/nextcloud/d" /etc/crontab
  247. fi
  248. remove_app nextcloud
  249. remove_completion_param install_nextcloud
  250. sed -i '/nextcloud/d' $COMPLETION_FILE
  251. remove_backup_database_local nextcloud
  252. function_check remove_ddns_domain
  253. remove_ddns_domain $NEXTCLOUD_DOMAIN_NAME
  254. systemctl restart nginx
  255. }
  256. function install_nextcloud_main {
  257. if [ ! $NEXTCLOUD_DOMAIN_NAME ]; then
  258. echo $'No domain name was given for nextcloud'
  259. exit 7359
  260. fi
  261. if [[ $(app_is_installed nextcloud_main) == "1" ]]; then
  262. return
  263. fi
  264. function_check install_mariadb
  265. install_mariadb
  266. function_check get_mariadb_password
  267. get_mariadb_password
  268. function_check repair_databases_script
  269. repair_databases_script
  270. apt-get -yq install php-gettext php5-curl php5-gd php5-mysql git curl php-xml-parser
  271. apt-get -yq install php5-memcached php5-intl memcached php5-memcached
  272. if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME ]; then
  273. mkdir /var/www/$NEXTCLOUD_DOMAIN_NAME
  274. fi
  275. if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs ]; then
  276. function_check git_clone
  277. git_clone $NEXTCLOUD_REPO /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
  278. if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs ]; then
  279. echo $'Unable to clone nextcloud repo'
  280. exit 87525
  281. fi
  282. fi
  283. cd /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
  284. git submodule update --init
  285. git checkout $NEXTCLOUD_COMMIT -b $NEXTCLOUD_COMMIT
  286. set_completion_param "nextcloud commit" "$NEXTCLOUD_COMMIT"
  287. chmod g+w /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
  288. chown -R www-data:www-data /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
  289. function_check nextcloud_create_database
  290. nextcloud_create_database
  291. if [ ! -f "/etc/aliases" ]; then
  292. touch /etc/aliases
  293. fi
  294. if ! grep -q "www-data: root" /etc/aliases; then
  295. echo 'www-data: root' >> /etc/aliases
  296. fi
  297. function_check add_ddns_domain
  298. add_ddns_domain $NEXTCLOUD_DOMAIN_NAME
  299. nextcloud_nginx_site=/etc/nginx/sites-available/$NEXTCLOUD_DOMAIN_NAME
  300. if [[ $ONION_ONLY == "no" ]]; then
  301. function_check nginx_http_redirect
  302. nginx_http_redirect $NEXTCLOUD_DOMAIN_NAME
  303. echo 'server {' >> $nextcloud_nginx_site
  304. echo ' listen 443 ssl;' >> $nextcloud_nginx_site
  305. echo ' listen [::]:443 ssl;' >> $nextcloud_nginx_site
  306. echo " server_name $NEXTCLOUD_DOMAIN_NAME;" >> $nextcloud_nginx_site
  307. echo '' >> $nextcloud_nginx_site
  308. echo ' # Security' >> $nextcloud_nginx_site
  309. function_check nginx_ssl
  310. nginx_ssl $NEXTCLOUD_DOMAIN_NAME
  311. function_check nginx_disable_sniffing
  312. nginx_disable_sniffing $NEXTCLOUD_DOMAIN_NAME
  313. echo ' add_header Strict-Transport-Security max-age=15768000;' >> $nextcloud_nginx_site
  314. echo '' >> $nextcloud_nginx_site
  315. echo ' # Logs' >> $nextcloud_nginx_site
  316. echo ' access_log /dev/null;' >> $nextcloud_nginx_site
  317. echo ' error_log /dev/null;' >> $nextcloud_nginx_site
  318. echo '' >> $nextcloud_nginx_site
  319. echo ' # Root' >> $nextcloud_nginx_site
  320. echo " root /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs;" >> $nextcloud_nginx_site
  321. echo '' >> $nextcloud_nginx_site
  322. echo ' # Index' >> $nextcloud_nginx_site
  323. echo ' index index.php;' >> $nextcloud_nginx_site
  324. echo '' >> $nextcloud_nginx_site
  325. echo ' # PHP' >> $nextcloud_nginx_site
  326. echo ' location ~ \.php {' >> $nextcloud_nginx_site
  327. echo ' include snippets/fastcgi-php.conf;' >> $nextcloud_nginx_site
  328. echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $nextcloud_nginx_site
  329. echo ' }' >> $nextcloud_nginx_site
  330. echo '' >> $nextcloud_nginx_site
  331. echo ' # Location' >> $nextcloud_nginx_site
  332. echo ' location / {' >> $nextcloud_nginx_site
  333. function_check nginx_limits
  334. nginx_limits $NEXTCLOUD_DOMAIN_NAME '15m'
  335. echo ' try_files $uri $uri/ @nextcloud;' >> $nextcloud_nginx_site
  336. echo ' }' >> $nextcloud_nginx_site
  337. echo '' >> $nextcloud_nginx_site
  338. echo ' # Fancy URLs' >> $nextcloud_nginx_site
  339. echo ' location @nextcloud {' >> $nextcloud_nginx_site
  340. echo ' rewrite ^(.*)$ /index.php?p=$1 last;' >> $nextcloud_nginx_site
  341. echo ' }' >> $nextcloud_nginx_site
  342. echo '' >> $nextcloud_nginx_site
  343. echo ' # Restrict access that is unnecessary anyway' >> $nextcloud_nginx_site
  344. echo ' location ~ /\.(ht|git) {' >> $nextcloud_nginx_site
  345. echo ' deny all;' >> $nextcloud_nginx_site
  346. echo ' }' >> $nextcloud_nginx_site
  347. echo '' >> $nextcloud_nginx_site
  348. # DO NOT ENABLE KEYBASE. nextcloud really doesn't like having a .well-known directory
  349. echo '}' >> $nextcloud_nginx_site
  350. else
  351. echo -n '' > $nextcloud_nginx_site
  352. fi
  353. echo 'server {' >> $nextcloud_nginx_site
  354. echo " listen 127.0.0.1:$NEXTCLOUD_ONION_PORT default_server;" >> $nextcloud_nginx_site
  355. echo " server_name $NEXTCLOUD_DOMAIN_NAME;" >> $nextcloud_nginx_site
  356. echo '' >> $nextcloud_nginx_site
  357. function_check nginx_disable_sniffing
  358. nginx_disable_sniffing $NEXTCLOUD_DOMAIN_NAME
  359. echo '' >> $nextcloud_nginx_site
  360. echo ' # Logs' >> $nextcloud_nginx_site
  361. echo ' access_log /dev/null;' >> $nextcloud_nginx_site
  362. echo ' error_log /dev/null;' >> $nextcloud_nginx_site
  363. echo '' >> $nextcloud_nginx_site
  364. echo ' # Root' >> $nextcloud_nginx_site
  365. echo " root /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs;" >> $nextcloud_nginx_site
  366. echo '' >> $nextcloud_nginx_site
  367. echo ' # Index' >> $nextcloud_nginx_site
  368. echo ' index index.php;' >> $nextcloud_nginx_site
  369. echo '' >> $nextcloud_nginx_site
  370. echo ' # PHP' >> $nextcloud_nginx_site
  371. echo ' location ~ \.php {' >> $nextcloud_nginx_site
  372. echo ' include snippets/fastcgi-php.conf;' >> $nextcloud_nginx_site
  373. echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $nextcloud_nginx_site
  374. echo ' }' >> $nextcloud_nginx_site
  375. echo '' >> $nextcloud_nginx_site
  376. echo ' # Location' >> $nextcloud_nginx_site
  377. echo ' location / {' >> $nextcloud_nginx_site
  378. function_check nginx_limits
  379. nginx_limits $NEXTCLOUD_DOMAIN_NAME '15m'
  380. echo ' try_files $uri $uri/ @nextcloud;' >> $nextcloud_nginx_site
  381. echo ' }' >> $nextcloud_nginx_site
  382. echo '' >> $nextcloud_nginx_site
  383. echo ' # Fancy URLs' >> $nextcloud_nginx_site
  384. echo ' location @nextcloud {' >> $nextcloud_nginx_site
  385. echo ' rewrite ^(.*)$ /index.php?p=$1 last;' >> $nextcloud_nginx_site
  386. echo ' }' >> $nextcloud_nginx_site
  387. echo '' >> $nextcloud_nginx_site
  388. echo ' # Restrict access that is unnecessary anyway' >> $nextcloud_nginx_site
  389. echo ' location ~ /\.(ht|git) {' >> $nextcloud_nginx_site
  390. echo ' deny all;' >> $nextcloud_nginx_site
  391. echo ' }' >> $nextcloud_nginx_site
  392. echo '' >> $nextcloud_nginx_site
  393. echo '}' >> $nextcloud_nginx_site
  394. function_check configure_php
  395. configure_php
  396. function_check create_site_certificate
  397. create_site_certificate $NEXTCLOUD_DOMAIN_NAME 'yes'
  398. # Ensure that the database gets backed up locally, if remote
  399. # backups are not being used
  400. function_check backup_databases_script_header
  401. backup_databases_script_header
  402. function_check backup_database_local
  403. backup_database_local nextcloud
  404. function_check nginx_ensite
  405. nginx_ensite $NEXTCLOUD_DOMAIN_NAME
  406. # NOTE: For the typical case always enable SSL and only
  407. # disable it if in onion only mode. This is due to complexities
  408. # with the way URLs are generated by nextcloud
  409. nextcloud_ssl='always'
  410. if [[ $ONION_ONLY != 'no' ]]; then
  411. nextcloud_ssl='never'
  412. fi
  413. NEXTCLOUD_ONION_HOSTNAME=$(add_onion_service nextcloud 80 ${NEXTCLOUD_ONION_PORT})
  414. NEXTCLOUD_SERVER=${NEXTCLOUD_DOMAIN_NAME}
  415. if [[ $ONION_ONLY != 'no' ]]; then
  416. NEXTCLOUD_SERVER=${NEXTCLOUD_ONION_HOSTNAME}
  417. fi
  418. systemctl restart php5-fpm
  419. systemctl restart nginx
  420. ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$NEXTCLOUD_DOMAIN_NAME" -g nextcloud --public no
  421. ${PROJECT_NAME}-pass -u $MY_USERNAME -a nextcloud -p "$NEXTCLOUD_ADMIN_PASSWORD"
  422. cd /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
  423. chown -R www-data:www-data config
  424. chown -R www-data:www-data data
  425. ./occ maintenance:install --database-name nextcloud --admin-user ${MY_USERNAME} --admin-pass "${NEXTCLOUD_ADMIN_PASSWORD}" --database mysql --database-user root --database-pass "${MARIADB_PASSWORD}"
  426. ./occ check
  427. ./occ status
  428. ./occ app:list
  429. ./occ app:enable passman
  430. ./occ config:system:set defaultapp --value=passman
  431. ./occ config:system:set appstoreenabled --value=true
  432. ./occ config:system:set trusted_domains 2 --value=$NEXTCLOUD_DOMAIN_NAME
  433. set_completion_param "nextcloud domain" "$NEXTCLOUD_DOMAIN_NAME"
  434. install_completed nextcloud_main
  435. }
  436. function install_nextcloud {
  437. if [ ! $ONION_ONLY ]; then
  438. ONION_ONLY='no'
  439. fi
  440. install_nextcloud_main
  441. APP_INSTALLED=1
  442. }
  443. # NOTE: deliberately there is no "exit 0"