From 6c28659239a7fa136d11e03d7b8bfa9386f59dca Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 10:01:25 +0100 Subject: [PATCH 01/21] Fix --- conf/amd64.src | 6 ++++++ conf/api.src | 7 ------- conf/arm64.src | 6 ++++++ conf/armhf.src | 6 ++++++ scripts/install | 8 ++++---- 5 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 conf/amd64.src delete mode 100644 conf/api.src create mode 100644 conf/arm64.src create mode 100644 conf/armhf.src diff --git a/conf/amd64.src b/conf/amd64.src new file mode 100644 index 0000000..8840e83 --- /dev/null +++ b/conf/amd64.src @@ -0,0 +1,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_FILENAME=vikunja +SOURCE_EXTRACT=false 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..ffae117 --- /dev/null +++ b/conf/arm64.src @@ -0,0 +1,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_FILENAME=vikunja +SOURCE_EXTRACT=false diff --git a/conf/armhf.src b/conf/armhf.src new file mode 100644 index 0000000..55c08ee --- /dev/null +++ b/conf/armhf.src @@ -0,0 +1,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_FILENAME=vikunja +SOURCE_EXTRACT=false diff --git a/scripts/install b/scripts/install index 71f5866..33a90ef 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 @@ -108,12 +109,11 @@ chown -R $app:www-data "$final_path" #================================================= 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 - +mkdir -p "/opt/vikunja" mkdir -p "/opt/vikunja/files" +ynh_setup_source --dest_dir="/opt/vikunja" --source_id="$architecture" + chmod +x "/opt/vikunja/vikunja" chown -R $app:www-data "/opt/vikunja/files" From 02a9be2b2e1fbcb696237d8fcf50da94072df2ee Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 10:09:58 +0100 Subject: [PATCH 02/21] Fix --- conf/config.yml | 2 +- conf/systemd.service | 4 ++-- scripts/install | 17 ++++------------- scripts/upgrade | 22 +++------------------- 4 files changed, 10 insertions(+), 35 deletions(-) diff --git a/conf/config.yml b/conf/config.yml index 384ad0f..88b1401 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -10,7 +10,7 @@ service: # The base path on the file system where the binary and assets are. # Vikunja will also look in this path for a config file, so you could provide only this variable to point to a folder # with a config file which will then be used. - rootpath: "/opt/vikunja/" + rootpath: "__FINALPATH__" # The max number of items which can be returned per page maxitemsperpage: 50 # Enable the caldav endpoint, see the docs for more details diff --git a/conf/systemd.service b/conf/systemd.service index 8f38aa5..59181d0 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,8 +7,8 @@ Requires=postgresql.service redis.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=/opt/vikunja -ExecStart=/opt/vikunja/vikunja +WorkingDirectory=__FINALPATH__/ +ExecStart=__FINALPATH__/vikunja RestartSec=2s Restart=always diff --git a/scripts/install b/scripts/install index 33a90ef..81509de 100644 --- a/scripts/install +++ b/scripts/install @@ -99,23 +99,14 @@ ynh_script_progression --message="Setting up source files..." --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" --source_id="$architecture" + +mkdir -p "$final_path/files" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" - -#================================================= -# INSTALL BACKEND -#================================================= -ynh_script_progression --message="Installing backend..." --weight=15 - -mkdir -p "/opt/vikunja" -mkdir -p "/opt/vikunja/files" - -ynh_setup_source --dest_dir="/opt/vikunja" --source_id="$architecture" - -chmod +x "/opt/vikunja/vikunja" -chown -R $app:www-data "/opt/vikunja/files" +chmod +x "$final_path/vikunja" #================================================= # NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 9d1a724..508fe1c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -99,17 +99,11 @@ 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 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" mkdir -p "/opt/vikunja/files" fi @@ -117,18 +111,8 @@ fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" 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" +chmod +x "$final_path/vikunja" +chown -R $app:www-data "$final_path/files" #================================================= # NGINX CONFIGURATION From 4fbdfe76c920c2ef6b45ddbcc73adf7cc465fb1e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 10:11:30 +0100 Subject: [PATCH 03/21] Fix --- scripts/backup | 2 -- scripts/restore | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/scripts/backup b/scripts/backup index f131305..2eaa6b2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -37,8 +37,6 @@ ynh_print_info --message="Declaring files to be backed up..." #================================================= ynh_backup --src_path="$final_path" -ynh_backup --src_path="/etc/vikunja/config.yml" -ynh_backup --src_path="/opt/vikunja" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index a5f7ea0..342c673 100644 --- a/scripts/restore +++ b/scripts/restore @@ -64,12 +64,7 @@ ynh_restore_file --origin_path="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" - -ynh_restore_file --origin_path="/etc/vikunja/config.yml" - -ynh_restore_file --origin_path="/opt/vikunja" -chmod +x "/opt/vikunja/vikunja" -chown -R $app:www-data "/opt/vikunja/files" +chmod +x "$final_path/vikunja" #================================================= # REINSTALL DEPENDENCIES From 3312e67269d37c677a3914fab4c7241151d2290e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 10:18:16 +0100 Subject: [PATCH 04/21] Update install --- scripts/install | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index 81509de..4d5e092 100644 --- a/scripts/install +++ b/scripts/install @@ -40,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 @@ -122,9 +120,9 @@ ynh_add_nginx_config 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 400 "/etc/vikunja/config.yml" -chown $app:$app "/etc/vikunja/config.yml" +ynh_add_config --template="../conf/config.yml" --destination="$final_path/config.yml" +chmod 400 "$final_path/config.yml" +chown $app:$app "$final_path/config.yml" #================================================= # SETUP SYSTEMD From 16991ac66d1f3a7683abd6df9a1b8fd75e2ef042 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 10:19:10 +0100 Subject: [PATCH 05/21] Update remove --- scripts/remove | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index c17afff..71e049d 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="/etc/vikunja" #================================================= # REMOVE NGINX CONFIGURATION From f942dbfa4e22be0e7dcc23a70858072beb89081f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 10:34:16 +0100 Subject: [PATCH 06/21] Fix --- conf/config.yml | 2 +- scripts/install | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/config.yml b/conf/config.yml index 88b1401..79a41cc 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -10,7 +10,7 @@ service: # The base path on the file system where the binary and assets are. # Vikunja will also look in this path for a config file, so you could provide only this variable to point to a folder # with a config file which will then be used. - rootpath: "__FINALPATH__" + rootpath: "__FINALPATH__/vikunja" # The max number of items which can be returned per page maxitemsperpage: 50 # Enable the caldav endpoint, see the docs for more details diff --git a/scripts/install b/scripts/install index 4d5e092..9b1bd91 100644 --- a/scripts/install +++ b/scripts/install @@ -97,7 +97,7 @@ ynh_script_progression --message="Setting up source files..." --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" --source_id="$architecture" +ynh_setup_source --dest_dir="$final_path/vikunja" --source_id="$architecture" mkdir -p "$final_path/files" @@ -120,9 +120,9 @@ ynh_add_nginx_config 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="$final_path/config.yml" -chmod 400 "$final_path/config.yml" -chown $app:$app "$final_path/config.yml" +ynh_add_config --template="../conf/config.yml" --destination="$final_path/vikunja/config.yml" +chmod 400 "$final_path/vikunja/config.yml" +chown $app:$app "$final_path/vikunja/config.yml" #================================================= # SETUP SYSTEMD From 8fd084965c1586cb3205bf85f6f8d3b71658b0aa Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 10:34:44 +0100 Subject: [PATCH 07/21] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 9b1bd91..15167bd 100644 --- a/scripts/install +++ b/scripts/install @@ -144,7 +144,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 From c7ed9b62155241635818c5c369716452010a6091 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 10:39:24 +0100 Subject: [PATCH 08/21] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 15167bd..dfb38c3 100644 --- a/scripts/install +++ b/scripts/install @@ -104,7 +104,7 @@ mkdir -p "$final_path/files" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chmod +x "$final_path/vikunja" +chmod +x "$final_path/vikunja/vikunja" #================================================= # NGINX CONFIGURATION From e294dbbf520acd58858e6c23690274ecc6fbc45d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 10:53:57 +0100 Subject: [PATCH 09/21] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index dfb38c3..9fb0008 100644 --- a/scripts/install +++ b/scripts/install @@ -104,6 +104,7 @@ mkdir -p "$final_path/files" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +chown -R root:root "$final_path/vikunja" chmod +x "$final_path/vikunja/vikunja" #================================================= From 1f52f6c9e32ddfb21d08e33764858c96ceb06946 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 10:54:45 +0100 Subject: [PATCH 10/21] Update systemd.service --- conf/systemd.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 59181d0..8939059 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,8 +7,8 @@ Requires=postgresql.service redis.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/vikunja +WorkingDirectory=__FINALPATH__/vikunja +ExecStart=__FINALPATH__/vikunja/vikunja RestartSec=2s Restart=always From aabec50ede168fb5744c76b785d1425cf18b7532 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 11:05:15 +0100 Subject: [PATCH 11/21] Fix --- conf/systemd.service | 4 ++-- scripts/install | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 8939059..8f38aa5 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,8 +7,8 @@ Requires=postgresql.service redis.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/vikunja -ExecStart=__FINALPATH__/vikunja/vikunja +WorkingDirectory=/opt/vikunja +ExecStart=/opt/vikunja/vikunja RestartSec=2s Restart=always diff --git a/scripts/install b/scripts/install index 9fb0008..ea047b6 100644 --- a/scripts/install +++ b/scripts/install @@ -107,6 +107,20 @@ chown -R $app:www-data "$final_path" chown -R root:root "$final_path/vikunja" chmod +x "$final_path/vikunja/vikunja" + +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Setting up source files..." --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" + +chmod +x "/opt/vikunja/vikunja" +chown -R $app:www-data "/opt/vikunja/files" + #================================================= # NGINX CONFIGURATION #================================================= @@ -121,9 +135,9 @@ ynh_add_nginx_config 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="$final_path/vikunja/config.yml" -chmod 400 "$final_path/vikunja/config.yml" -chown $app:$app "$final_path/vikunja/config.yml" +ynh_add_config --template="../conf/config.yml" --destination="/opt/vikunja/config.yml" +chmod 400 "/opt/vikunja/config.yml" +chown $app:$app "/opt/vikunja/config.yml" #================================================= # SETUP SYSTEMD From 4300a70b62976f1cb87a08207434450e6871dce4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 11:07:00 +0100 Subject: [PATCH 12/21] Fix --- conf/config.yml | 4 ++-- scripts/install | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/conf/config.yml b/conf/config.yml index 79a41cc..f80e62e 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -10,7 +10,7 @@ service: # The base path on the file system where the binary and assets are. # Vikunja will also look in this path for a config file, so you could provide only this variable to point to a folder # with a config file which will then be used. - rootpath: "__FINALPATH__/vikunja" + rootpath: "/opt/vikunja/" # The max number of items which can be returned per page maxitemsperpage: 50 # Enable the caldav endpoint, see the docs for more details @@ -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/scripts/install b/scripts/install index ea047b6..0ea25b8 100644 --- a/scripts/install +++ b/scripts/install @@ -85,9 +85,10 @@ 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 @@ -104,9 +105,6 @@ mkdir -p "$final_path/files" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chown -R root:root "$final_path/vikunja" -chmod +x "$final_path/vikunja/vikunja" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE From a7cdc79cb0ac21e9fa59b8d0484df6adfe792978 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 11:11:39 +0100 Subject: [PATCH 13/21] Update install --- scripts/install | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 0ea25b8..87d746a 100644 --- a/scripts/install +++ b/scripts/install @@ -100,8 +100,6 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_setup_source --dest_dir="$final_path" --source_id="front" ynh_setup_source --dest_dir="$final_path/vikunja" --source_id="$architecture" -mkdir -p "$final_path/files" - chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -112,8 +110,8 @@ chown -R $app:www-data "$final_path" ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -mkdir -p "$/opt/vikunja" -mkdir -p "$/opt/vikunja/files" +mkdir -p "/opt/vikunja" +mkdir -p "/opt/vikunja/files" ynh_setup_source --dest_dir="/opt/vikunja" --source_id="$architecture" chmod +x "/opt/vikunja/vikunja" From f475160cc3626a74a3498d9eff13c73b0227343a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 11:16:07 +0100 Subject: [PATCH 14/21] Update remove --- scripts/remove | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index c17afff..8a11c0c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -74,7 +74,7 @@ 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="/etc/vikunja" +ynh_secure_remove --file="/opt/vikunja" #================================================= # REMOVE NGINX CONFIGURATION From 5db94d1c5d4a18d36180b19198ac8d52fad94ef5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Feb 2022 11:17:38 +0100 Subject: [PATCH 15/21] Update install --- scripts/install | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 87d746a..ab2a509 100644 --- a/scripts/install +++ b/scripts/install @@ -130,10 +130,11 @@ 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="/opt/vikunja/config.yml" -chmod 400 "/opt/vikunja/config.yml" -chown $app:$app "/opt/vikunja/config.yml" +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" #================================================= # SETUP SYSTEMD From ea9414d9523f7ddc9f6156a9f2c73473a7623ccb Mon Sep 17 00:00:00 2001 From: DorianBDev Date: Mon, 14 Feb 2022 17:46:52 +0100 Subject: [PATCH 16/21] Fix non-working backend The bug occurred because the downloaded backend's file type was wrong. It was used as a binary file rather a zip file. This commit also adds a clearer separation between backend and frontend in the scripts. --- conf/amd64.src | 3 ++- conf/arm64.src | 3 ++- conf/armhf.src | 3 ++- scripts/backup | 4 ++++ scripts/install | 14 ++++++++------ scripts/remove | 8 ++++++++ scripts/restore | 5 +++++ scripts/upgrade | 10 ++++++++-- 8 files changed, 39 insertions(+), 11 deletions(-) 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..4649990 100644 --- a/scripts/backup +++ b/scripts/backup @@ -36,8 +36,12 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= +# Frontend ynh_backup --src_path="$final_path" +# Backend +ynh_backup --src_path="/opt/vikunja" + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index ab2a509..e8651c9 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..9fcba45 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 +rm -rf "/opt/vikunja" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 342c673..8be991c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -59,8 +59,13 @@ 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" +# Backend +ynh_restore_file --origin_path="/opt/vikunja" + +chmod +x "/opt/vikunja/vikunja" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index 508fe1c..802fbab 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -102,12 +102,18 @@ 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 +x "/opt/vikunja/vikunja" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" From 7a5e59b9ed9b68dd78a759776a1eedc622f4fd04 Mon Sep 17 00:00:00 2001 From: DorianBDev Date: Tue, 15 Feb 2022 15:18:19 +0100 Subject: [PATCH 17/21] Fix issues with scripts - Change an "rm -rf" to "ynh_secure_remove" for the remove script. - Add the config file to the backup and restore scripts. - Fix incorrect "chmod" for the restore and upgrade scripts. - Fix missing "architecture" variable for the upgrade script. --- scripts/backup | 3 +++ scripts/remove | 2 +- scripts/restore | 14 ++++++++------ scripts/upgrade | 6 +++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/backup b/scripts/backup index 4649990..f876c34 100644 --- a/scripts/backup +++ b/scripts/backup @@ -39,6 +39,9 @@ ynh_print_info --message="Declaring files to be backed up..." # 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/remove b/scripts/remove index 9fcba45..23189e4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -98,7 +98,7 @@ ynh_system_user_delete --username=$app ynh_script_progression --message="Removing backend..." --weight=1 # Delete /opt/vikunja -rm -rf "/opt/vikunja" +ynh_secure_remove --file="/opt/vikunja" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 8be991c..90f666b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -61,15 +61,17 @@ ynh_script_progression --message="Restoring $app main directory..." --weight=4 # Frontend ynh_restore_file --origin_path="$final_path" - -# Backend -ynh_restore_file --origin_path="/opt/vikunja" - -chmod +x "/opt/vikunja/vikunja" 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 802fbab..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) @@ -113,12 +114,11 @@ then cp "$back" "/opt/vikunja/vikunja" fi -chmod +x "/opt/vikunja/vikunja" 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 From aafed2a742c011fec65c191ba36985b8ecaf6116 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 20 Feb 2022 09:41:27 +0100 Subject: [PATCH 18/21] Update install --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index ab2a509..faa12b5 100644 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_script_progression --message="Setting up source files..." --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" +#ynh_setup_source --dest_dir="$final_path/vikunja" --source_id="$architecture" chmod 750 "$final_path" chmod -R o-rwx "$final_path" @@ -133,6 +133,7 @@ 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" From 66f82e6245c109187b1dc24650d49d38a702617b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 20 Feb 2022 16:28:45 +0100 Subject: [PATCH 19/21] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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", From ea8242b15568d1228c9e88c74781426705adda74 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 20 Feb 2022 15:28:55 +0000 Subject: [PATCH 20/21] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 From f58e456b412f9036a5390c857f8e15b18380054c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 20 Feb 2022 16:30:40 +0100 Subject: [PATCH 21/21] Update remove --- scripts/remove | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index fe340ac..23189e4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -74,8 +74,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 #=================================================