diff --git a/conf/config.json b/conf/config.json index fad0d01..264d0c3 100644 --- a/conf/config.json +++ b/conf/config.json @@ -7,7 +7,7 @@ "useSSL": false, "webpath": "./pack", "filesdriver": "local", - "filespath": "./files", + "filespath": "__FILES_PATH__/files", "telemetry": false, "session_expire_time": 2592000, "session_refresh_time": 18000, diff --git a/conf/nginx.conf b/conf/nginx.conf index 82e5ff5..46e1a5c 100755 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -41,6 +41,6 @@ location / { more_clear_input_headers 'Accept-Encoding'; } -#location /uploads/ { -# alias __FILES_PATH__/uploads/ ; -#} +location /uploads/ { + alias __FILES_PATH__/uploads/ ; +} diff --git a/conf/systemd.service b/conf/systemd.service index c1c8648..3f050d5 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Focalboard server +Description=Focalboard: kanban board [Service] Type=simple diff --git a/scripts/install b/scripts/install index f012038..26fba57 100755 --- a/scripts/install +++ b/scripts/install @@ -39,7 +39,7 @@ ynh_script_progression --message="Validating installation parameters..." --weigh [ $YNH_ARCH == "amd64" ] || ynh_die --message="Unfortunately, Focalboard only provides binaries for AMD64 systems." -final_path=/opt/yunohost/$app +final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path diff --git a/scripts/upgrade b/scripts/upgrade index 1ed2f2d..8eeb558 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,6 +38,18 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# If db_name doesn't exist, create it +if [ -z "$db_name" ]; then + db_name=$(ynh_sanitize_dbid --db_name=$app) + ynh_app_setting_set --app=$app --key=db_name --value=$db_name +fi + +# If final_path doesn't exist, create it +if [ -z "$final_path" ]; then + final_path=/var/www/$app + ynh_app_setting_set --app=$app --key=final_path --value=$final_path +fi + if [ -z "$enable_public_boards" ]; then enable_public_boards="false" ynh_app_setting_set --app=$app --key=enable_public_boards --value=$enable_public_boards @@ -55,6 +67,16 @@ if ! ynh_permission_exists --permission="api"; then ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" fi +# Move files to new files path +if [ -z "/opt/yunohost/$app/files" ]; then + mkdir -p $files_path/files + mv /opt/yunohost/$app/files $files_path/files + + chmod -R 755 $files_path + chmod -R o-rwx $files_path + chown -R $app:www-data $files_path +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -93,23 +115,9 @@ ynh_system_user_create --username=$app --home_dir="$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 - - # Create a temporary directory - tmpdir="$(mktemp -d)" - - # Backup the config file in the temp dir - cp -a "$final_path/config.json" "$tmpdir/config.json" - - # Remove the app directory securely - ynh_secure_remove --file="$final_path" # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" #--keep="config.json" - # Copy the admin saved settings from tmp directory to final path - cp -a "$tmpdir/config.json" "$final_path/config.json" - - # Remove the tmp directory securely - ynh_secure_remove --file="$tmpdir" + ynh_setup_source --dest_dir="/var/www/$app" fi chmod 750 "$final_path"