1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/focalboard_ynh.git synced 2024-09-03 18:36:19 +02:00
This commit is contained in:
ericgaspar 2022-09-16 08:21:30 +02:00
parent 386eb4146e
commit 1acc03352f
5 changed files with 29 additions and 21 deletions

View file

@ -7,7 +7,7 @@
"useSSL": false, "useSSL": false,
"webpath": "./pack", "webpath": "./pack",
"filesdriver": "local", "filesdriver": "local",
"filespath": "./files", "filespath": "__FILES_PATH__/files",
"telemetry": false, "telemetry": false,
"session_expire_time": 2592000, "session_expire_time": 2592000,
"session_refresh_time": 18000, "session_refresh_time": 18000,

View file

@ -41,6 +41,6 @@ location / {
more_clear_input_headers 'Accept-Encoding'; more_clear_input_headers 'Accept-Encoding';
} }
#location /uploads/ { location /uploads/ {
# alias __FILES_PATH__/uploads/ ; alias __FILES_PATH__/uploads/ ;
#} }

View file

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Focalboard server Description=Focalboard: kanban board
[Service] [Service]
Type=simple Type=simple

View file

@ -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." [ $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" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path # Register (book) web path

View file

@ -38,6 +38,18 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 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 if [ -z "$enable_public_boards" ]; then
enable_public_boards="false" enable_public_boards="false"
ynh_app_setting_set --app=$app --key=enable_public_boards --value=$enable_public_boards 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" ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
fi 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 # 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" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." --weight=1 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 # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" #--keep="config.json" ynh_setup_source --dest_dir="/var/www/$app"
# 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"
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"