diff --git a/conf/amd64.src b/conf/amd64.src deleted file mode 100644 index aa14472..0000000 --- a/conf/amd64.src +++ /dev/null @@ -1,11 +0,0 @@ -SOURCE_URL=https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_9.0.2_x86-64.tar.gz -SOURCE_SUM=5adb3c800cd48de38b6e5d9b073e03ff375cfa30208a7291c481cdf1e1cf167b -# (Optional) Program to check the integrity (sha256sum, md5sum...) -# default: sha256 -SOURCE_SUM_PRG=sha256sum -# (Optional) Archive format -# default: tar.gz -SOURCE_FORMAT=tar.gz -# (Optional) Put false if sources are directly in the archive root -# default: true -SOURCE_IN_SUBDIR=true diff --git a/conf/amd64_7_0.src b/conf/amd64_7_0.src deleted file mode 100644 index 4bd9e8a..0000000 --- a/conf/amd64_7_0.src +++ /dev/null @@ -1,11 +0,0 @@ -SOURCE_URL=https://download.seadrive.org/seafile-server_7.0.5_x86-64.tar.gz -SOURCE_SUM=7eb8814f1bc8ee78c80741fa08cbdce2b5ea8895a87730bde2a1b32d031e8f53 -# (Optional) Program to check the integrity (sha256sum, md5sum...) -# default: sha256 -SOURCE_SUM_PRG=sha256sum -# (Optional) Archive format -# default: tar.gz -SOURCE_FORMAT=tar.gz -# (Optional) Put false if sources are directly in the archive root -# default: true -SOURCE_IN_SUBDIR=true diff --git a/conf/arm64.src b/conf/arm64.src deleted file mode 100644 index fa48fe7..0000000 --- a/conf/arm64.src +++ /dev/null @@ -1,11 +0,0 @@ -SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v9.0.2/seafile-server-9.0.2-buster-arm64v8l.tar.gz -SOURCE_SUM=0332a57364f92eaefe0109e5a65f8e3a3b909c3805b9113431d4bde2a962d78c -# (Optional) Program to check the integrity (sha256sum, md5sum...) -# default: sha256 -SOURCE_SUM_PRG=sha256sum -# (Optional) Archive format -# default: tar.gz -SOURCE_FORMAT=tar.gz -# (Optional) Put false if sources are directly in the archive root -# default: true -SOURCE_IN_SUBDIR=true diff --git a/conf/arm64_7_0.src b/conf/arm64_7_0.src deleted file mode 100644 index 7cb9b0d..0000000 --- a/conf/arm64_7_0.src +++ /dev/null @@ -1,11 +0,0 @@ -SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz -SOURCE_SUM=dae9ab5d232a2b56f129aa29e7e54d2de05d838f0479955543cebcb14c9417db -# (Optional) Program to check the integrity (sha256sum, md5sum...) -# default: sha256 -SOURCE_SUM_PRG=sha256sum -# (Optional) Archive format -# default: tar.gz -SOURCE_FORMAT=tar.gz -# (Optional) Put false if sources are directly in the archive root -# default: true -SOURCE_IN_SUBDIR=true diff --git a/conf/armhf.src b/conf/armhf.src deleted file mode 100644 index b23bf4e..0000000 --- a/conf/armhf.src +++ /dev/null @@ -1,11 +0,0 @@ -SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v9.0.2/seafile-server-9.0.2-buster-arm32v7l.tar.gz -SOURCE_SUM=2aa42caa1420842435ee8a386fb9f3244a0d286a4c1f829a97cba49b41b274df -# (Optional) Program to check the integrity (sha256sum, md5sum...) -# default: sha256 -SOURCE_SUM_PRG=sha256sum -# (Optional) Archive format -# default: tar.gz -SOURCE_FORMAT=tar.gz -# (Optional) Put false if sources are directly in the archive root -# default: true -SOURCE_IN_SUBDIR=true diff --git a/conf/armhf_7_0.src b/conf/armhf_7_0.src deleted file mode 100644 index 7cb9b0d..0000000 --- a/conf/armhf_7_0.src +++ /dev/null @@ -1,11 +0,0 @@ -SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz -SOURCE_SUM=dae9ab5d232a2b56f129aa29e7e54d2de05d838f0479955543cebcb14c9417db -# (Optional) Program to check the integrity (sha256sum, md5sum...) -# default: sha256 -SOURCE_SUM_PRG=sha256sum -# (Optional) Archive format -# default: tar.gz -SOURCE_FORMAT=tar.gz -# (Optional) Put false if sources are directly in the archive root -# default: true -SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index d21490c..8acb823 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -26,7 +26,7 @@ location /seafhttp/ { location __PATH__/media/ { - alias __FINALPATH__/seafile-server-latest/seahub/media/; + alias __INSTALL_DIR__/seafile-server-latest/seahub/media/; } location /seafdav { diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 7355e88..0000000 --- a/manifest.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "name": "Seafile", - "id": "seafile", - "packaging_format": 1, - "license": "AGPL-3.0,Apache-2.0,MIT,GPL-2.0", - "url": "https://www.seafile.com", - "upstream": { - "license": "AGPL-3.0,Apache-2.0,MIT,GPL-2.0", - "website": "https://www.seafile.com", - "demo": "https://demo.seafile.com", - "admindoc": "https://manual.seafile.com", - "code": "https://github.com/haiwen/seafile-server" - }, - "version": "9.0.2~ynh2", - "description": { - "en": "Open Source Cloud Storage", - "fr": "Stockage Cloud Open Source" - }, - "maintainer": { - "name": "Josué Tille", - "email": "josue@tille.ch" - }, - "previous_maintainers": { - "name": "mbugeia", - "email": "maxime@max.privy.place" - }, - "multi_instance": false, - "services": [ - "nginx", - "mysql" - ], - "requirements": { - "yunohost": ">= 4.3" - }, - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "default": "/seafile" - }, - { - "name": "server_name", - "type": "string", - "ask": { - "en": "Choose a name (3 - 15 letters or digits)", - "fr": "Choisissez un nom (3 - 15 letters or digits)" - }, - "example": "Seafile", - "default": "Seafile" - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "admin_password", - "type": "password", - "ask": { - "en": "Enter a password for the administrator", - "fr": "Entrez un mot de passe pour l'administrateur" - } - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If it's not public, everybody which want to access to any page of seafile need to be authenticated on the SSO. On the public mode anybody can access to the authentication page. The shared link will be olso accessible by anybody who has this link.", - "fr": "Si n'est pas publique, n'importe qui veux accéder à n'importe quelle page de seafile doit être authentifié dans le SSO. Dans le mode publique n'importe qui peut accéder à la page d'authentification de seafile. Les liens partagé seront aussi accessible par n'import qui qui à ce liens." - }, - "default": true - } - ] - } -} diff --git a/scripts/_common.sh b/scripts/_common.sh index 6f2ee35..ff2453b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -2,50 +2,20 @@ # SET ALL CONSTANTS #================================================= -app=$YNH_APP_INSTANCE_NAME +db_user=seafile +time_zone=$(cat /etc/timezone) #================================================= # DEFINE ALL COMMON FONCTIONS #================================================= -install_source() { - mkdir "$final_path/seafile-server-$seafile_version" - if [ $YNH_ARCH == "i386" ] || [ $YNH_ARCH == "armel" ] - then - ynh_die --message "Error : this architecture is no longer supported by the upstream. Please create en issue here : https://github.com/YunoHost-Apps/seafile_ynh/issues to ask to discuss about a support of this architecture" - fi - ynh_setup_source "$final_path/seafile-server-$seafile_version" "$YNH_ARCH" - - # Drop some conflicting package cf: https://forum.seafile.com/t/seahub-fails-to-start-nameerror-name-mysql-is-not-defined/14566/3 - ynh_secure_remove --file=$final_path/seafile-server-$seafile_version/seahub/thirdpart/MySQLdb - ynh_secure_remove --file=$final_path/seafile-server-$seafile_version/seahub/thirdpart/cffi - ynh_secure_remove --file=$final_path/seafile-server-$seafile_version/seahub/thirdpart/PIL -} - -install_source_7_0() { - if ! [ -e $final_path/seafile-server-7.0.5 ]; then - mkdir "$final_path/seafile-server-7.0.5" - if [ $YNH_ARCH == "i386" ] || [ $YNH_ARCH == "armel" ] - then - ynh_die --message "Error : this architecture is no longer supported by the upstream. Please create en issue here : https://github.com/YunoHost-Apps/seafile_ynh/issues to ask to discuss about a support of this architecture" - fi - ynh_setup_source "$final_path/seafile-server-7.0.5" "$YNH_ARCH"_7_0 - fi -} - install_dependance() { - ynh_install_app_dependencies python3 python3-setuptools python3-pip python3-requests python3-dev libmariadb-dev-compat libmariadb-dev \ - expect ffmpeg \ - memcached libmemcached-dev \ - python3-scipy python3-matplotlib \ - libjpeg62-turbo-dev zlib1g-dev libffi-dev # For building pillow ynh_add_swap --size=2000 # We need to do that because we can have some issue about the permission access to the pip cache without this - chown -R $seafile_user:$seafile_user $final_path + chown -R $seafile_user:$seafile_user $install_dir # Note that we install imageio to force the dependance, without this imageio 2.8 is installed and it need python3.5 sudo -u $seafile_user pip3 install --user --no-warn-script-location --upgrade future mysqlclient PyMySQL Pillow pylibmc captcha Jinja2 SQLAlchemy psd-tools django-pylibmc django-simple-captcha python3-ldap pycryptodome==3.12.0 cffi==1.14.0 - # TODO add dependance when upgrade to seafile 8: django==2.2.* ynh_del_swap } @@ -57,14 +27,14 @@ mv_expect_scripts() { } set_permission() { - chown -R $seafile_user:$seafile_user $final_path - chmod -R g-wx,o= $final_path - setfacl -m user:www-data:rX $final_path - setfacl -m user:www-data:rX $final_path/seafile-server-$seafile_version + chown -R $seafile_user:$seafile_user $install_dir + chmod -R g-wx,o= $install_dir + setfacl -m user:www-data:rX $install_dir + setfacl -m user:www-data:rX $install_dir/seafile-server-$seafile_version # At install time theses directory are not available - test -e $final_path/seafile-server-latest/seahub && setfacl -m user:www-data:rX $final_path/seafile-server-latest/seahub - test -e $final_path/seafile-server-latest/seahub/media && setfacl -R -m user:www-data:rX $final_path/seafile-server-latest/seahub/media - test -e $final_path/seahub-data && setfacl -R -m user:www-data:rX $final_path/seahub-data +#REMOVEME? test -e $install_dir/seafile-server-latest/seahub && setfacl -m user:www-data:rX $install_dir/seafile-server-latest/seahub +#REMOVEME? test -e $install_dir/seafile-server-latest/seahub/media && setfacl -R -m user:www-data:rX $install_dir/seafile-server-latest/seahub/media +#REMOVEME? test -e $install_dir/seahub-data && setfacl -R -m user:www-data:rX $install_dir/seahub-data # check that this directory exist because in some really old install the data could still be in the main seafile directory # We also check at the install time when data directory is not already initialised @@ -73,10 +43,3 @@ set_permission() { chmod -R o= /home/yunohost.app/seafile-data fi } - -ynh_clean_setup () { - pkill -f seafile-controller - pkill -f seaf-server - pkill -f ccnet-server - pkill -f seahub -} diff --git a/scripts/backup b/scripts/backup index f051206..c550a03 100644 --- a/scripts/backup +++ b/scripts/backup @@ -11,17 +11,8 @@ source ../settings/scripts/_common.sh # Source YunoHost helpers source /usr/share/yunohost/helpers -# Stop script if errors -ynh_abort_if_errors - -ynh_print_info --message="Loading installation settings..." - # retrieve useful param -domain=$(ynh_app_setting_get --app $app --key domain) -db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) -final_path=$(ynh_app_setting_get --app $app --key final_path) seafile_version=$(ynh_app_upstream_version) -seafile_user=$app if [[ ! "$(systemctl status seafile)" =~ "Active: inactive (dead)" ]] || [[ ! "$(systemctl status seahub)" =~ "Active: failed (Result: signal)" ]]; then ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop seafile service and seahub service with this command before to run the backup 'systemctl stop seafile.service seahub.service'" @@ -33,7 +24,7 @@ fi # # Backup app files ynh_print_info --message="Backing up code..." -ynh_backup --src_path $final_path +ynh_backup --src_path $install_dir ynh_print_info --message="Backing up user data..." ynh_backup --src_path=/home/yunohost.app/seafile-data --dest_path="data" --is_big=1 ynh_print_info --message="Backing up configuration..." diff --git a/scripts/change_url b/scripts/change_url index 60023cf..eb0e28b 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -12,19 +12,19 @@ source ./_common.sh source /usr/share/yunohost/helpers # Stop script if errors -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." # Retrive arguments -old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN domain=$YNH_APP_NEW_DOMAIN -old_path=$(ynh_normalize_url_path --path_url $YNH_APP_OLD_PATH) -path_url=$(ynh_normalize_url_path --path_url $YNH_APP_NEW_PATH) -seahub_port=$(ynh_app_setting_get --app $app --key seahub_port) -fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port) -webdav_port=$(ynh_app_setting_get --app $app --key webdav_port) -final_path=$(ynh_app_setting_get --app $app --key final_path) +#REMOVEME? old_path=$(ynh_normalize_url_path --path $YNH_APP_OLD_PATH) +path=$(ynh_normalize_url_path --path $YNH_APP_NEW_PATH) +#REMOVEME? seahub_port=$(ynh_app_setting_get --app $app --key seahub_port) +#REMOVEME? fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port) +#REMOVEME? webdav_port=$(ynh_app_setting_get --app $app --key webdav_port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app $app --key install_dir) seafile_user=$app # Create special path with / at the end @@ -35,31 +35,31 @@ else old_path2=$old_path'/' fi -if [[ $path_url == '/' ]] +if [[ $path == '/' ]] then - path_url2=$path_url + path2=$path else - path_url2=$path_url'/' + path2=$path'/' fi #================================================= # STANDARD MODIFICATIONS #================================================= -ynh_script_progression --message="Updating nginx configuration..." +#REMOVEME? ynh_script_progression --message="Updating nginx configuration..." -# Update nginx config +#REMOVEME? # Update nginx config if [ "$old_domain" != "$domain" ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file "/etc/nginx/conf.d/$old_domain.d/$app.conf" +#REMOVEME? ynh_delete_file_checksum --file "/etc/nginx/conf.d/$old_domain.d/$app.conf" - mv "/etc/nginx/conf.d/$old_domain.d/$app.conf" "/etc/nginx/conf.d/$domain.d/$app.conf" +#REMOVEME? mv "/etc/nginx/conf.d/$old_domain.d/$app.conf" "/etc/nginx/conf.d/$domain.d/$app.conf" # Store file checksum for the new config file location - ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf" +#REMOVEME? ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf" fi -ynh_add_nginx_config 'seahub_port fileserver_port webdav_port' +#REMOVEME? ynh_add_nginx_config 'seahub_port fileserver_port webdav_port' ynh_script_progression --message="Stoping services..." @@ -75,16 +75,16 @@ pkill -f seahub || true ynh_script_progression --message="Updating seafile configuration..." # Update Seafile Config -ynh_replace_string --match_string "SERVICE_URL = https://$old_domain$old_path" --replace_string "SERVICE_URL = https://$domain$path_url" --target_file $final_path/conf/ccnet.conf +ynh_replace_string --match_string "SERVICE_URL = https://$old_domain$old_path" --replace_string "SERVICE_URL = https://$domain$path" --target_file $install_dir/conf/ccnet.conf -ynh_replace_string --match_string 'FILE_SERVER_ROOT = "https://'"$old_domain"'/seafhttp"' --replace_string 'FILE_SERVER_ROOT = "https://'"$domain"'/seafhttp"' --target_file $final_path/conf/seahub_settings.py -ynh_replace_string --match_string 'SITE_ROOT = "'"$old_path2"'"' --replace_string 'SITE_ROOT = "'"$path_url2"'"' --target_file $final_path/conf/seahub_settings.py -ynh_replace_string --match_string 'MEDIA_URL = "'"$old_path2"'media/"' --replace_string 'MEDIA_URL = "'"$path_url2"'media/"' --target_file $final_path/conf/seahub_settings.py -ynh_replace_string --match_string "LOGIN_URL = '${old_path2}accounts/login/'" --replace_string "LOGIN_URL = '${path_url2}accounts/login/'" --target_file $final_path/conf/seahub_settings.py -ynh_replace_string --match_string ' = "seafile@'"$old_domain"'"' --replace_string ' = "seafile@'"$domain"'"' --target_file $final_path/conf/seahub_settings.py -sed --in-place "s@ALLOWED_HOSTS = \['${old_domain}'\]@ALLOWED_HOSTS = \['${domain}'\]@g" $final_path/conf/seahub_settings.py -ynh_replace_string --match_string "REMOTE_USER_DOMAIN = '$old_domain'" --replace_string "REMOTE_USER_DOMAIN = '$domain'" --target_file $final_path/conf/seahub_settings.py -sed --in-place "s@REMOTE_USER_PROTECTED_PATH = \['$old_path', '$old_path/accounts/login'\]@REMOTE_USER_PROTECTED_PATH = \['$path_url', '$path_url/accounts/login'\]@g" $final_path/conf/seahub_settings.py +ynh_replace_string --match_string 'FILE_SERVER_ROOT = "https://'"$old_domain"'/seafhttp"' --replace_string 'FILE_SERVER_ROOT = "https://'"$domain"'/seafhttp"' --target_file $install_dir/conf/seahub_settings.py +ynh_replace_string --match_string 'SITE_ROOT = "'"$old_path2"'"' --replace_string 'SITE_ROOT = "'"$path2"'"' --target_file $install_dir/conf/seahub_settings.py +ynh_replace_string --match_string 'MEDIA_URL = "'"$old_path2"'media/"' --replace_string 'MEDIA_URL = "'"$path2"'media/"' --target_file $install_dir/conf/seahub_settings.py +ynh_replace_string --match_string "LOGIN_URL = '${old_path2}accounts/login/'" --replace_string "LOGIN_URL = '${path2}accounts/login/'" --target_file $install_dir/conf/seahub_settings.py +ynh_replace_string --match_string ' = "seafile@'"$old_domain"'"' --replace_string ' = "seafile@'"$domain"'"' --target_file $install_dir/conf/seahub_settings.py +sed --in-place "s@ALLOWED_HOSTS = \['${old_domain}'\]@ALLOWED_HOSTS = \['${domain}'\]@g" $install_dir/conf/seahub_settings.py +ynh_replace_string --match_string "REMOTE_USER_DOMAIN = '$old_domain'" --replace_string "REMOTE_USER_DOMAIN = '$domain'" --target_file $install_dir/conf/seahub_settings.py +sed --in-place "s@REMOTE_USER_PROTECTED_PATH = \['$old_path', '$old_path/accounts/login'\]@REMOTE_USER_PROTECTED_PATH = \['$path', '$path/accounts/login'\]@g" $install_dir/conf/seahub_settings.py # Avoid the current effect sleep 2 diff --git a/scripts/install b/scripts/install index 5023e1b..26af352 100644 --- a/scripts/install +++ b/scripts/install @@ -11,84 +11,29 @@ source ./_common.sh # Source YunoHost helpers source /usr/share/yunohost/helpers -# Stop script if errors -ynh_abort_if_errors - -ynh_script_progression --message="Validating installation parameters..." - -# Retrieve arguments -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -server_name="$YNH_APP_ARG_SERVER_NAME" -admin=$YNH_APP_ARG_ADMIN -is_public=$YNH_APP_ARG_IS_PUBLIC -seafile_data=/home/yunohost.app/seafile-data -final_path=/opt/yunohost/$app -seafile_user=$app -admin_password=$YNH_APP_ARG_ADMIN_PASSWORD seafile_version=$(ynh_app_upstream_version) # Create special path with / at the end -if [[ $path_url == '/' ]] +if [[ $path == '/' ]] then - path_url2=$path_url + path2=$path else - path_url2=$path_url"/" + path2=$path"/" fi -# Register (book) web path -ynh_webpath_register --app $app --domain $domain --path_url $path_url - -# Check Final Path availability -test ! -e "$final_path" || ynh_die --message "This path already contains a folder" -if [ -e "$seafile_data" ]; then - old_data_dir_path="$seafile_data$(date '+%Y%m%d.%H%M%S')" - ynh_print_warn "A data directory already exist. Data was renamed to $old_data_dir_path" - mv "$seafile_data" "$old_data_dir_path" -fi - -# Find available ports -ynh_script_progression --message="Finding available ports..." -seahub_port=$(ynh_find_port --port 8000) -fileserver_port=$(ynh_find_port --port 8082) -webdav_port=$(ynh_find_port --port 8080) - -if [ $fileserver_port -eq $webdav_port ]; then - webdav_port=$(ynh_find_port --port $((fileserver_port + 1))) -fi - -# store config in yunohost -ynh_script_progression --message="Storing installation settings..." -ynh_app_setting_set --app $app --key server_name --value "$server_name" -ynh_app_setting_set --app $app --key final_path --value $final_path -ynh_app_setting_set --app $app --key seafile_user --value $seafile_user -ynh_app_setting_set --app $app --key admin --value $admin -ynh_app_setting_set --app $app --key seahub_port --value $seahub_port -ynh_app_setting_set --app $app --key fileserver_port --value $fileserver_port -ynh_app_setting_set --app $app --key webdav_port --value $webdav_port - #================================================= # STANDARD MODIFICATIONS #================================================= ynh_script_progression --message="Creating base directory..." -mkdir -p $final_path -mkdir -p $final_path/installed -mkdir -p $final_path/logs -mkdir -p $seafile_data -ln -s $seafile_data $final_path/seafile-data - -# Create User -ynh_script_progression --message="Configuring system user..." -ynh_system_user_create --username $seafile_user --home_dir $final_path +ln -s $data_dir $install_dir/seafile-data # Check dependencies -ynh_script_progression --message="Installing dependencies..." --weight=7 install_dependance # Download new version from sources ynh_script_progression --message="Installing sources files..." --weight=7 -install_source +ynh_setup_source --dest_dir=$install_dir/seafile-server-$seafile_version # init databases ynh_script_progression --message="Configuring MySQL database..." @@ -101,76 +46,33 @@ ynh_script_progression --message="Configuring application..." --weight=3 # Run install script mv_expect_scripts -chmod +x $final_path/seafile-server-$seafile_version/setup-seafile-mysql.sh +chmod +x $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh set_permission -sudo -u $seafile_user $expect_scripts_dir/install.exp "$final_path/seafile-server-$seafile_version" "$server_name" "$domain" "$fileserver_port" "$db_pwd" +sudo -u $seafile_user $expect_scripts_dir/install.exp "$install_dir/seafile-server-$seafile_version" "$server_name" "$domain" "$fileserver_port" "$db_pwd" sleep 3 -# Update seafile config -ynh_replace_string --match_string http:// --replace_string https:// --target_file $final_path/conf/ccnet.conf -ynh_replace_string --match_string :8000 --replace_string $path_url --target_file $final_path/conf/ccnet.conf -echo 'FILE_SERVER_ROOT = "https://'$domain'/seafhttp"' | tee -a $final_path/conf/seahub_settings.py -echo 'SITE_ROOT = "'$path_url2'"' | tee -a $final_path/conf/seahub_settings.py -echo 'SERVE_STATIC = False' | tee -a $final_path/conf/seahub_settings.py -echo 'MEDIA_URL = "'$path_url2'media/"' | tee -a $final_path/conf/seahub_settings.py -echo 'COMPRESS_URL = MEDIA_URL' | tee -a $final_path/conf/seahub_settings.py -echo "STATIC_URL = MEDIA_URL + 'assets/'" | tee -a $final_path/conf/seahub_settings.py -echo "LOGIN_URL = '"$path_url2"accounts/login/'" | tee -a $final_path/conf/seahub_settings.py -echo "ALLOWED_HOSTS = ['"$domain"']" | tee -a $final_path/conf/seahub_settings.py +# Retrive values from auto generated config file +seahub_secret_key=$(grep -P 'SECRET_KEY\s*=\s*"[\w-]+"' $install_dir/conf/seahub_settings.py | cut -d'"' -f2) +ccnet_id=$(grep -P 'ID\s*=\s*\w+$' $install_dir/conf/ccnet.conf | cut -d= -f2 | grep -o -P '\w+') +ynh_app_setting_set --app $app --key seahub_secret_key --value $seahub_secret_key +ynh_app_setting_set --app $app --key ccnet_id --value $ccnet_id -# Email configuration -echo 'EMAIL_USE_TLS = False' | tee -a $final_path/conf/seahub_settings.py -echo 'EMAIL_HOST = "localhost"' | tee -a $final_path/conf/seahub_settings.py -echo 'EMAIL_HOST_USER = "seafile@'$domain'"' | tee -a $final_path/conf/seahub_settings.py -echo 'EMAIL_PORT = "25"' | tee -a $final_path/conf/seahub_settings.py -echo 'DEFAULT_FROM_EMAIL = "seafile@'$domain'"' | tee -a $final_path/conf/seahub_settings.py -echo 'SERVER_EMAIL = "seafile@'$domain'"' | tee -a $final_path/conf/seahub_settings.py -echo 'EMAIL_HOST_PASSWORD = ""' | tee -a $final_path/conf/seahub_settings.py -echo "TIME_ZONE = \"$(cat /etc/timezone)\"" | tee -a $final_path/conf/seahub_settings.py - -# SSO authentication -echo 'ENABLE_REMOTE_USER_AUTHENTICATION = True' | tee -a $final_path/conf/seahub_settings.py -echo "REMOTE_USER_HEADER = 'HTTP_EMAIL'" | tee -a $final_path/conf/seahub_settings.py -echo 'REMOTE_USER_CREATE_UNKNOWN_USER = False' | tee -a $final_path/conf/seahub_settings.py -echo "REMOTE_USER_PROTECTED_PATH = ['$path_url', '$path_url/accounts/login']" | tee -a $final_path/conf/seahub_settings.py - -# LDAP configuration -echo '[LDAP]' | tee -a $final_path/conf/ccnet.conf -echo 'HOST = ldap://localhost:389' | tee -a $final_path/conf/ccnet.conf -echo 'BASE = ou=users,dc=yunohost,dc=org' | tee -a $final_path/conf/ccnet.conf -echo 'LOGIN_ATTR = mail' | tee -a $final_path/conf/ccnet.conf -echo "FILTER = permission=cn=$app.main,ou=permission,dc=yunohost,dc=org" | tee -a $final_path/conf/ccnet.conf - -# Enable manually wiki -echo 'ENABLE_WIKI = True' | tee -a $final_path/conf/seahub_settings.py - -# Enable memcached -cat >> $final_path/conf/seahub_settings.py <> $final_path/conf/seahub_settings.py <