diff --git a/README.md b/README.md index 4e14c87..dce3626 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Vikunja is a self-hosted open-source to-do list application for all platforms. - CalDAV - Links -**Shipped version:** 0.18.2~ynh1 +**Shipped version:** 0.18.2~ynh2 **Demo:** https://try.vikunja.io/login diff --git a/README_fr.md b/README_fr.md index eb5817d..4754089 100644 --- a/README_fr.md +++ b/README_fr.md @@ -22,7 +22,7 @@ Vikunja est une application de liste de tâches Open Source auto-hébergée pour - CalDAV - Links -**Version incluse :** 0.18.2~ynh1 +**Version incluse :** 0.18.2~ynh2 **Démo :** https://try.vikunja.io/login diff --git a/conf/amd64.src b/conf/amd64.src new file mode 100644 index 0000000..833f81a --- /dev/null +++ b/conf/amd64.src @@ -0,0 +1,7 @@ +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=true diff --git a/conf/api.src b/conf/api.src deleted file mode 100644 index d9f9321..0000000 --- a/conf/api.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://dl.vikunja.io/api/0.18.1/vikunja-unstable-amd64.deb -SOURCE_SUM=3bf5d1109727b37b461840e0bc8b60dc86dc569655551e6485c8dbe7b6de5ddb -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=deb -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=vikunja-unstable-amd64.deb -SOURCE_EXTRACT=false \ No newline at end of file diff --git a/conf/arm64.src b/conf/arm64.src new file mode 100644 index 0000000..3c1f538 --- /dev/null +++ b/conf/arm64.src @@ -0,0 +1,7 @@ +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=true diff --git a/conf/armhf.src b/conf/armhf.src new file mode 100644 index 0000000..70c5015 --- /dev/null +++ b/conf/armhf.src @@ -0,0 +1,7 @@ +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=true diff --git a/conf/config.yml b/conf/config.yml index 384ad0f..f80e62e 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -44,7 +44,7 @@ database: # Database type to use. Supported types are mysql, postgres and sqlite. type: "postgres" # Database user which is used to connect to the database. - user: "__DB_NAME__" + user: "__DB_USER__" # Database password password: "__DB_PWD__" # Database host diff --git a/manifest.json b/manifest.json index 14bc238..b0d1b4c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Self-hosted To-Do list application", "fr": "Application de liste de tâches auto-hébergée" }, - "version": "0.18.2~ynh1", + "version": "0.18.2~ynh2", "url": "https://vikunja.io/", "upstream": { "license": "GPL-3.0", diff --git a/scripts/backup b/scripts/backup index f131305..f876c34 100644 --- a/scripts/backup +++ b/scripts/backup @@ -36,8 +36,13 @@ 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" #================================================= diff --git a/scripts/install b/scripts/install index 71f5866..8b46920 100644 --- a/scripts/install +++ b/scripts/install @@ -25,6 +25,7 @@ path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC timezone="$(cat /etc/timezone)" secret=$(ynh_string_random --length=32) +architecture=$YNH_ARCH app=$YNH_APP_INSTANCE_NAME @@ -39,8 +40,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -mkdir -p "/etc/vikunja" - # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -86,14 +85,15 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_name --db_name=$db_name +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 @@ -106,13 +106,15 @@ chown -R $app:www-data "$final_path" #================================================= # INSTALL BACKEND #================================================= -ynh_script_progression --message="Installing backend..." --weight=15 - -tempdir="$(mktemp -d)" -ynh_setup_source --dest_dir=$tempdir --source_id=api -ynh_exec_warn_less dpkg -i $tempdir/vikunja-unstable-amd64.deb +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" +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" @@ -130,8 +132,10 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 +mkdir -p "/etc/vikunja" redis_db=$(ynh_redis_get_free_db) ynh_add_config --template="../conf/config.yml" --destination="/etc/vikunja/config.yml" + chmod 400 "/etc/vikunja/config.yml" chown $app:$app "/etc/vikunja/config.yml" @@ -155,7 +159,7 @@ yunohost service add $app --description="Self-hosted To-Do list application" --l ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="server started on" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="server started on" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 8a11c0c..23189e4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -58,7 +58,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_remove_app_dependencies -dpkg --purge vikunja #================================================= # REMOVE THE REDIS DATABASE @@ -74,7 +73,6 @@ ynh_script_progression --message="Removing $app main directory..." --weight=6 # Remove the app directory securely ynh_secure_remove --file="$final_path" -ynh_secure_remove --file="/opt/vikunja" #================================================= # REMOVE NGINX CONFIGURATION @@ -94,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 a5f7ea0..90f666b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -59,14 +59,16 @@ 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" +# 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" diff --git a/scripts/upgrade b/scripts/upgrade index 9d1a724..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) @@ -99,19 +100,18 @@ ynh_system_user_create --username=$app --home_dir="$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Installing backend..." --weight=5 - - tempdir="$(mktemp -d)" - ynh_setup_source --dest_dir=$tempdir --source_id=api - ynh_exec_warn_less N | dpkg -i $tempdir/vikunja-unstable-amd64.deb - 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" - + + # 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" @@ -120,16 +120,6 @@ chown -R $app:www-data "$final_path" chmod +x "/opt/vikunja/vikunja" chown -R $app:www-data "/opt/vikunja/files" -#================================================= -# ADD A CONFIGURATION -#================================================= -#ynh_script_progression --message="Adding a configuration file..." --weight=1 - -# redis_db=$(ynh_redis_get_free_db) -# ynh_add_config --template="../conf/config.yml" --destination="/etc/vikunja/config.yml" - -#chmod 600 "/etc/vikunja/config.yml" - #================================================= # NGINX CONFIGURATION #=================================================