From f3afca2a85e7373c5227370b6b8dc212ae2d899b Mon Sep 17 00:00:00 2001 From: Amo Date: Wed, 26 May 2021 02:33:20 +0530 Subject: [PATCH] Updated to v1.14.3 --- README.md | 2 +- check_process | 8 ++++---- conf/app.src | 4 ++-- manifest.json | 20 +++---------------- scripts/backup | 11 +++++------ scripts/install | 51 +++++++++++++++++++++---------------------------- scripts/remove | 16 ++++++++-------- scripts/restore | 15 ++++++--------- scripts/upgrade | 42 ++++++++++++++++++++++------------------ 9 files changed, 74 insertions(+), 95 deletions(-) diff --git a/README.md b/README.md index 78d1b93..3238ad0 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This is the reloaded version of the open source timetracker Kimai. Right now its Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic ideas of time-tracking and the current development team. It is based on a lot of great frameworks. Special thanks to Symfony v4, Doctrine, AdminThemeBundle (based on AdminLTE). https://github.com/kevinpapst/kimai2 -Shipped Version: **1.11.1** +Shipped Version: **1.14.3** ## Screenshots diff --git a/check_process b/check_process index 765d710..23c886c 100644 --- a/check_process +++ b/check_process @@ -7,7 +7,6 @@ ; Manifest domain="domain.tld" (DOMAIN) admin="john" (USER) - database="mysql" registration=1 is_public=1 (PUBLIC|public=1|private=0) ; Checks @@ -19,8 +18,9 @@ setup_public=1 upgrade=1 # 1.9~ynh1 - upgrade=1 from_commit=e5ce0d869526c6c856c1e2398b4b2ce0ba8e7542 - backup_restore=1 + upgrade=1 + from_commit=f26285511a167a1ed591a7fa96ae786ea89efb1e + backup_restore=1 multi_instance=1 # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. # incorrect_path=1 @@ -30,7 +30,7 @@ # If the level 5 (Package linter) is forced to 1. Please add justifications here. Level 5=auto ;;; Options -Email=anmol@datamol.org +Email= Notification=change ;;; Upgrade options ; commit=e5ce0d869526c6c856c1e2398b4b2ce0ba8e7542 diff --git a/conf/app.src b/conf/app.src index 05d59b1..39973ce 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.11.1.tar.gz -SOURCE_SUM=ebca79e6fc4597a4a914a3005c3a450bbe956fd05fce8a4d962d9ca943589a28 +SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/refs/tags/1.14.3.tar.gz +SOURCE_SUM=1a5d084fbac071ca7c5897ef439bd4bec5fb1f367e6f39b029917590110fda7d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index b9f5043..9629ff5 100644 --- a/manifest.json +++ b/manifest.json @@ -8,16 +8,14 @@ "de": "Eine web-basierte Mehrbenutzer-Zeiterfassung mit Rechnungsdruck mit Unterstützung für mobile Endgeräte", "cs": "Víceuživatelská webová aplikace pro sledování času s podporou mobilních zařízení" }, - "version": "1.11.1~ynh1", + "version": "1.14.3~ynh1", "url": "https://www.kimai.org", "license": "MIT", "maintainer": { - "name": "Anmol Sharma", - "email": "anmol@datamol.org", - "url": "datamol.org" + "name": "Anmol Sharma" }, "requirements": { - "yunohost": ">= 3.8" + "yunohost": ">= 4.0.0" }, "multi_instance": true, "services": [ @@ -60,18 +58,6 @@ }, "default": false }, - { - "name": "database", - "type": "string", - "ask": { - "en": "Choose the database to use (for production usage choose: mysql)", - "fr": "Choisissez le type de base de données à utiliser (mysql pour un usage en production)", - "de": "Wählen Sie die zu nutzende Datenbank (für produktive Zwecke wähle: mysql)", - "cs": "Zvolte databázi (pro produkční použití vyberte: mysql)" - }, - "choices": ["mysql","sqlite"], - "default": "mysql" - }, { "name": "registration", "type": "boolean", diff --git a/scripts/backup b/scripts/backup index bc8674a..2b2278a 100755 --- a/scripts/backup +++ b/scripts/backup @@ -29,7 +29,6 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) -database=$(ynh_app_setting_get --app=$app --key=database) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -58,11 +57,11 @@ ynh_backup --src_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf" # BACKUP THE MYSQL DATABASE #================================================= -if [ "$database" = "mysql" ]; then - ynh_print_info --message="Backing up the MySQL database..." - db_name=$(ynh_app_setting_get --app=$app --key=db_name) - ynh_mysql_dump_db --database="$db_name" > db.sql -fi + +ynh_print_info --message="Backing up the MySQL database..." +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +ynh_mysql_dump_db --database="$db_name" > db.sql + #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index fa80023..0f2489b 100755 --- a/scripts/install +++ b/scripts/install @@ -29,7 +29,6 @@ path_url="/" admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC registration=$YNH_APP_ARG_REGISTRATION -database=$YNH_APP_ARG_DATABASE random_key=$(ynh_string_random 32) app=$YNH_APP_INSTANCE_NAME @@ -50,13 +49,13 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= ynh_script_progression --message="Storing installation settings..." -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public +ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=admin --value=$admin +ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=registration --value=$registration -ynh_app_setting_set --app=$app --key=database --value=$database -ynh_app_setting_set --app=$app --key=random_key --value=$random_key +ynh_app_setting_set --app=$app --key=database --value=$database +ynh_app_setting_set --app=$app --key=random_key --value=$random_key #================================================= # STANDARD MODIFICATIONS @@ -73,8 +72,10 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Setting up source files..." 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" + +# Clone the latest version +latest_tag=$(curl -s https://api.github.com/repos/kevinpapst/kimai2/releases/latest | grep 'tag_name' | cut -d\" -f4) +git clone -b $latest_tag --depth 1 https://github.com/kevinpapst/kimai2.git $final_path #================================================= # NGINX CONFIGURATION @@ -118,26 +119,18 @@ else ynh_replace_string --match_string="__REGISTRATION__" --replace_string="false" --target_file="$local_conf" fi -env_conf="$final_path/.env" -# Configure environement -if [ "$database" = "mysql" ]; then - # setup application config - cp ../conf/.env.mysql $env_conf - 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_mysql_setup_db --db_user=$db_user --db_name=$db_name - ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$env_conf" - ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$env_conf" - ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string="$db_pwd" --target_file="$env_conf" - ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$env_conf" - ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$env_conf" -else - # setup application config - cp ../conf/.env.sqlite $env_conf - ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$env_conf" - ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$env_conf" -fi + +# setup application config +cp ../conf/.env.mysql $env_conf +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_mysql_setup_db --db_user=$db_user --db_name=$db_name +ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$env_conf" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$env_conf" +ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string="$db_pwd" --target_file="$env_conf" +ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$env_conf" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$env_conf" #================================================= # BUILD KIMAI2 diff --git a/scripts/remove b/scripts/remove index 7e410b0..a971096 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,7 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -database=$(ynh_app_setting_get --app=$app --key=database) + #================================================= # STANDARD REMOVE @@ -26,13 +26,13 @@ database=$(ynh_app_setting_get --app=$app --key=database) # REMOVE THE MYSQL DATABASE #================================================= -if [ "$database" = "mysql" ]; then - ynh_script_progression --message="Removing the MySQL database..." - db_name=$(ynh_app_setting_get --app=$app --key=db_name) - db_user=$db_name - # Remove a database if it exists, along with the associated user - ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -fi + +ynh_script_progression --message="Removing the MySQL database..." +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +# Remove a database if it exists, along with the associated user +ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name + #================================================= # REMOVE DEPENDENCIES diff --git a/scripts/restore b/scripts/restore index b3bda5a..c9ddafa 100755 --- a/scripts/restore +++ b/scripts/restore @@ -30,7 +30,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -database=$(ynh_app_setting_get --app=$app --key=database) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -99,14 +98,12 @@ ynh_install_app_dependencies $pkg_dependencies # RESTORE THE MYSQL DATABASE #================================================= -if [ "$database" = "mysql" ]; then - ynh_script_progression --message="Restoring the MySQL database..." - db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) - db_name=$(ynh_app_setting_get --app=$app --key=db_name) - db_user=$db_name - ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -fi +ynh_script_progression --message="Restoring the MySQL database..." +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index ebf44e1..1126fa3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,7 +23,6 @@ admin=$(ynh_app_setting_get --app=$app --key=admin) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) registration=$(ynh_app_setting_get --app=$app --key=registration) -database=$(ynh_app_setting_get --app=$app --key=database) random_key=$(ynh_app_setting_get --app=$app --key=random_key) #================================================= @@ -72,9 +71,15 @@ ynh_abort_if_errors #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= - +latest_tag=$(curl -s https://api.github.com/repos/kevinpapst/kimai2/releases/latest | grep 'tag_name' | cut -d\" -f4) if [ "$upgrade_type" == "UPGRADE_APP" ] then + if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then + pushd "$final_path" + git fetch --tags + git checkout latest_tag + popd + else ynh_script_progression --message="Upgrading source files..." # Create a temporary directory and backup config @@ -106,8 +111,10 @@ then fi ynh_secure_remove --file="$tmpdir" + fi fi + #================================================= # NGINX CONFIGURATION #================================================= @@ -161,23 +168,20 @@ ynh_store_file_checksum --file="$local_conf" env_conf=$final_path/.env ynh_backup_if_checksum_is_different --file="$env_conf" # Configure environement -if [ "$database" = "mysql" ]; then - # setup application config - cp ../conf/.env.mysql $env_conf - db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) - db_name=$(ynh_app_setting_get --app=$app --key=db_name) - db_user=$db_name - ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$env_conf" - ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$env_conf" - ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string="$db_pwd" --target_file="$env_conf" - ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$env_conf" - ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$env_conf" -else - # setup application config - cp ../conf/.env.sqlite $env_conf - ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$env_conf" - ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$env_conf" -fi + +# setup application config + +cp ../conf/.env.mysql $env_conf + +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$env_conf" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$env_conf" +ynh_replace_string --match_string="__DB_PASSWORD__" --replace_string="$db_pwd" --target_file="$env_conf" +ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$env_conf" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$env_conf" + ynh_store_file_checksum --file="$env_conf" #=================================================