diff --git a/conf/amd64.src b/conf/amd64.src index 8840e83..833f81a 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -2,5 +2,6 @@ SOURCE_URL=https://dl.vikunja.io/api/0.18.1/vikunja-v0.18.1-linux-amd64-full SOURCE_SUM=fd259ae3c717bea715e96d0806ac08f2bd462068277ab2b62ebee36fe946f0e2 SOURCE_SUM_PRG=sha256sum SOURCE_IN_SUBDIR=false +SOURCE_FORMAT=zip SOURCE_FILENAME=vikunja -SOURCE_EXTRACT=false +SOURCE_EXTRACT=true diff --git a/conf/arm64.src b/conf/arm64.src index ffae117..3c1f538 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -2,5 +2,6 @@ SOURCE_URL=https://dl.vikunja.io/api/0.18.1/vikunja-v0.18.1-linux-arm64-full SOURCE_SUM=c54c6d70b348c1697ff8519d522f2b1e3c58ffb4401ac1f4c2e729913b392a27 SOURCE_SUM_PRG=sha256sum SOURCE_IN_SUBDIR=false +SOURCE_FORMAT=zip SOURCE_FILENAME=vikunja -SOURCE_EXTRACT=false +SOURCE_EXTRACT=true diff --git a/conf/armhf.src b/conf/armhf.src index 55c08ee..70c5015 100644 --- a/conf/armhf.src +++ b/conf/armhf.src @@ -2,5 +2,6 @@ SOURCE_URL=https://dl.vikunja.io/api/0.18.1/vikunja-v0.18.1-linux-arm-7-full SOURCE_SUM=79548e506538319f8aab07a5630c3c2032906b34386a83c26d1a6cfc9993b39c SOURCE_SUM_PRG=sha256sum SOURCE_IN_SUBDIR=false +SOURCE_FORMAT=zip SOURCE_FILENAME=vikunja -SOURCE_EXTRACT=false +SOURCE_EXTRACT=true diff --git a/scripts/backup b/scripts/backup index 2eaa6b2..f876c34 100644 --- a/scripts/backup +++ b/scripts/backup @@ -36,8 +36,15 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= +# Frontend ynh_backup --src_path="$final_path" +# Config +ynh_backup --src_path="/etc/vikunja/config.yml" + +# Backend +ynh_backup --src_path="/opt/vikunja" + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index faa12b5..8b46920 100644 --- a/scripts/install +++ b/scripts/install @@ -91,28 +91,30 @@ ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name #================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE +# INSTALL FRONTEND #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression --message="Setting up frontend..." --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" --source_id="front" -#ynh_setup_source --dest_dir="$final_path/vikunja" --source_id="$architecture" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" #================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE +# INSTALL BACKEND #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression --message="Setting up backend..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src mkdir -p "/opt/vikunja" mkdir -p "/opt/vikunja/files" -ynh_setup_source --dest_dir="/opt/vikunja" --source_id="$architecture" +tempdir="$(mktemp -d)" +ynh_setup_source --dest_dir=$tempdir --source_id="$architecture" +back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" +cp "$back" "/opt/vikunja/vikunja" chmod +x "/opt/vikunja/vikunja" chown -R $app:www-data "/opt/vikunja/files" diff --git a/scripts/remove b/scripts/remove index 71e049d..23189e4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -92,6 +92,14 @@ ynh_script_progression --message="Removing the dedicated system user..." --weigh # Delete a system user ynh_system_user_delete --username=$app +#================================================= +# REMOVE BACKEND +#================================================= +ynh_script_progression --message="Removing backend..." --weight=1 + +# Delete /opt/vikunja +ynh_secure_remove --file="/opt/vikunja" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 342c673..90f666b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -59,12 +59,19 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= ynh_script_progression --message="Restoring $app main directory..." --weight=4 +# Frontend ynh_restore_file --origin_path="$final_path" - chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chmod +x "$final_path/vikunja" + +# Config +ynh_restore_file --origin_path="/etc/vikunja/config.yml" + +# Backend +ynh_restore_file --origin_path="/opt/vikunja" +chmod +x "/opt/vikunja/vikunja" +chown -R $app:www-data "/opt/vikunja/files" #================================================= # REINSTALL DEPENDENCIES diff --git a/scripts/upgrade b/scripts/upgrade index 508fe1c..8ad7751 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) timezone="$(cat /etc/timezone)" secret=$(ynh_string_random --length=32) +architecture=$YNH_ARCH set_motd=$(ynh_app_setting_get --app=$app --key=set_motd) enable_registration=$(ynh_app_setting_get --app=$app --key=enable_registration) @@ -102,17 +103,22 @@ then ynh_script_progression --message="Upgrading source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src + # Frontend ynh_setup_source --dest_dir="$final_path" --source_id="front" --keep="/etc/vikunja/config.yml" - ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" + + # Backend mkdir -p "/opt/vikunja/files" - + tempdir="$(mktemp -d)" + ynh_setup_source --dest_dir=$tempdir --source_id="$architecture" + back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" + cp "$back" "/opt/vikunja/vikunja" fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chmod +x "$final_path/vikunja" -chown -R $app:www-data "$final_path/files" +chmod +x "/opt/vikunja/vikunja" +chown -R $app:www-data "/opt/vikunja/files" #================================================= # NGINX CONFIGURATION