From e5d026cf5330bbe91702e3c5f24c597b23f55fa2 Mon Sep 17 00:00:00 2001 From: poka Date: Tue, 19 May 2020 17:22:46 +0200 Subject: [PATCH] Add data-dir in .zen/nextcloud for nextcloud flavor --- .install/nextcloud/install.sh | 28 +++++++++++++++------------- cron_MINUTE.sh | 1 + 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.install/nextcloud/install.sh b/.install/nextcloud/install.sh index 0554d7b..7a0f0bd 100755 --- a/.install/nextcloud/install.sh +++ b/.install/nextcloud/install.sh @@ -10,12 +10,14 @@ nc_domain="" # Votre nom de domaine pour votre nextcloud. Si vide il prendra le premier argument que vous passerez, sinon le hostname de votre machine nc_port=10050 # Numéro de port d'écoute de nginx -admin_user="admin" # Le pseudo du compte admin -admin_pass="admin" # Le mot de passe que vous désirez pour le compte admin -db_pass="" # Le mot de passe que vous désirez pour MariaDB. Si vide, un mot de passe aléatoire sécurisé sera choisi -isSSL=false # true si nextcloud et nginx doivent être configuré en https +YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) +admin_user="$YOU" # Le pseudo du compte admin +admin_pass="0penS0urce!" # Le mot de passe que vous désirez pour le compte admin +db_pass="" # Le mot de passe que vous désirez pour MariaDB. Si vide, un mot de passe aléatoire sécurisé sera choisi +data_dir="/home/$YOU/.zen/nextcloud" # Le répertoir data de nextcloud, toutes les données utilisateurs s'y trouvent +isSSL=false # true si nextcloud et nginx doivent être configuré en https configMaria=auto # Mettez manual ou auto, attention auto est expérimental et vraiment pas recommendé -p2env=false # true si vous êtes dans un environnement p2p.legal +p2env=false # true si vous êtes dans un environnement p2p.legal ################# @@ -34,10 +36,10 @@ nc_domain=$(../../zen/tools/nodename) db_pass_root="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9~!@#$%^&*_-' | fold -w 32 | head -n 1)" if [[ p2env == "true" ]]; then - cd /nextcloud/.install_templates/ + cd /nextcloud/templates/ else - [[ ! -e .install_templates ]] && echo "Erreur: Le dossier .install_templates n'existe pas, installation impossible." && exit 1 - cd .install_templates + [[ ! -e templates ]] && echo "Erreur: Le dossier templates n'existe pas, installation impossible." && exit 1 + cd templates fi ## Set apt key and upgrade system @@ -108,10 +110,10 @@ if [[ ! -e /var/www/nextcloud ]]; then tar -xjf latest.tar.bz2 -C /var/www && chown -R www-data:www-data /var/www/ && rm -f latest.tar.bz2 fi -if [[ ! -e /var/nextcloud ]]; then - mkdir -p /var/nextcloud - chown www-data:www-data /var/nextcloud - chmod 750 /var/nextcloud || (echo "Erreur quelque part ..." && exit 1) +if [[ ! -e $data_dir ]]; then + mkdir -p $data_dir + chown www-data:www-data $data_dir + chmod 750 $data_dir || (echo "Erreur quelque part ..." && exit 1) fi ## Add local IP as secondary trust domain @@ -121,7 +123,7 @@ ip_local=$(/sbin/ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){ [[ $nc_port == 80 ]] && nc_port_loc="" || nc_port_loc=":$nc_port" [[ -e /var/www/nextcloud/config/config.php ]] && isNCConfig=$(cat /var/www/nextcloud/config/config.php | grep "'installed' => true") -[[ -z "$isNCConfig" ]] && sudo -u www-data php /var/www/nextcloud/occ maintenance:install --database "mysql" --database-name "nextcloud" --database-user "nextcloud" --database-pass "$db_pass" --admin-user "$admin_user" --admin-pass "$admin_pass" --data-dir "/var/nextcloud/" +[[ -z "$isNCConfig" ]] && sudo -u www-data php /var/www/nextcloud/occ maintenance:install --database "mysql" --database-name "nextcloud" --database-user "nextcloud" --database-pass "$db_pass" --admin-user "$admin_user" --admin-pass "$admin_pass" --data-dir "$data_dir" sleep 0.2 sudo -u www-data php /var/www/nextcloud/occ config:system:set mysql.utf8mb4 --type boolean --value="true" sudo -u www-data php /var/www/nextcloud/occ config:system:set trusted_domains 0 --value=$nc_domain diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index a5d8d40..9b62ffc 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -14,6 +14,7 @@ ME="${0##*/}" # Write what you thing about the situation # AND how you would like to 'fix it'... # Then friends can read and enhance solution. +# WARNING: This script must be precessing less than 1 minute, so do not charge too much this script # _ _____ ____ _ _______ ________ ____ # | | / / | / __ \/ | / / _/ | / / ____/ / / / # | | /| / / /| | / /_/ / |/ // // |/ / / __ / / /