From f3afca2a85e7373c5227370b6b8dc212ae2d899b Mon Sep 17 00:00:00 2001 From: Amo Date: Wed, 26 May 2021 02:33:20 +0530 Subject: [PATCH 1/9] 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" #================================================= From 1f6d296135fe59ad450b625461dc9eb0df2206b1 Mon Sep 17 00:00:00 2001 From: Amo Date: Thu, 27 May 2021 11:51:22 +0530 Subject: [PATCH 2/9] Remove database variable from install --- scripts/install | 35 ++++++++++++++++++----------------- scripts/upgrade | 14 +++++++------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/scripts/install b/scripts/install index 0f2489b..b83533c 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,6 @@ admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC registration=$YNH_APP_ARG_REGISTRATION random_key=$(ynh_string_random 32) - app=$YNH_APP_INSTANCE_NAME #================================================= @@ -54,7 +53,6 @@ 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 #================================================= @@ -75,6 +73,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$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 #================================================= @@ -111,10 +110,12 @@ ynh_script_progression --message="Configuring Kimai2..." local_conf="$final_path/config/packages/local.yaml" # Configure registration cp ../conf/local.yaml $local_conf -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$local_conf" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$local_conf" + +# Registration should be allowed or not if [ $registration -eq 1 ] then - ynh_replace_string --match_string="__REGISTRATION__" --replace_string="true" --target_file="$local_conf" + ynh_replace_string --match_string="__REGISTRATION__" --replace_string="true" --target_file="$local_conf" else ynh_replace_string --match_string="__REGISTRATION__" --replace_string="false" --target_file="$local_conf" fi @@ -124,21 +125,21 @@ fi 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" +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 #================================================= ynh_script_progression --message="Building Kimai2..." -ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --install_args="--optimize-autoloader" -ynh_composer_exec --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --commands="require laminas/laminas-ldap" +ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --install_args="--optimize-autoloader" +ynh_composer_exec --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --commands="require laminas/laminas-ldap" pushd "$final_path" php${YNH_PHP_VERSION} bin/console kimai:install -n @@ -147,7 +148,7 @@ popd #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= -ynh_script_progression --message="Storing the config file checksum..." +ynh_script_progression --message="Storing the config file checksum..." # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$local_conf" @@ -168,9 +169,9 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Configuring SSOwat..." -ynh_permission_create --permission="teamlead" -ynh_permission_create --permission="admin" -ynh_permission_create --permission="super_admin" --allowed "$admin" +ynh_permission_create --permission="teamlead" +ynh_permission_create --permission="admin" +ynh_permission_create --permission="super_admin" --allowed "$admin" # Make app public if necessary if [ $is_public -eq 1 ] diff --git a/scripts/upgrade b/scripts/upgrade index 1126fa3..1574c7a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,15 +15,15 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +app= $YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -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) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +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) -random_key=$(ynh_app_setting_get --app=$app --key=random_key) +random_key=$(ynh_app_setting_get --app=$app --key=random_key) #================================================= # CHECK VERSION From 9d97fe3097e741c0bd65ff9c4cb77f3eadd06af0 Mon Sep 17 00:00:00 2001 From: Amo Date: Thu, 27 May 2021 22:40:52 +0530 Subject: [PATCH 3/9] Updated readme, variable errors in install and upgrade --- README.md | 3 ++- scripts/install | 2 +- scripts/upgrade | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3238ad0..f2a4b9c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Kimai2 app for YunoHost -[![Integration level](https://dash.yunohost.org/integration/kimai2.svg)](https://dash.yunohost.org/appci/app/kimai2) ![](https://ci-apps.yunohost.org/ci/badges/kimai2.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/kimai2.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/kimai2.svg)](https://dash.yunohost.org/appci/app/kimai2) ![](https://ci-apps.yunohost.org/ci/badges/kimai2.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/kimai2.maintain.svg) + [![Install Kimai2 with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=kimai2) > *This package allows you to install kimai2 quickly and simply on a YunoHost server. diff --git a/scripts/install b/scripts/install index b83533c..f648bde 100755 --- a/scripts/install +++ b/scripts/install @@ -120,7 +120,7 @@ else ynh_replace_string --match_string="__REGISTRATION__" --replace_string="false" --target_file="$local_conf" fi - +env_conf="$final_path/.env" # setup application config cp ../conf/.env.mysql $env_conf db_name=$(ynh_sanitize_dbid --db_name=$app) diff --git a/scripts/upgrade b/scripts/upgrade index 1574c7a..6f0af00 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -77,7 +77,7 @@ then if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then pushd "$final_path" git fetch --tags - git checkout latest_tag + git checkout $latest_tag popd else ynh_script_progression --message="Upgrading source files..." From f71603be6ab4cb037723fccfc11b6f9f4deae566 Mon Sep 17 00:00:00 2001 From: Amo Date: Fri, 28 May 2021 14:46:12 +0530 Subject: [PATCH 4/9] Fix upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6f0af00..5830c99 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Loading installation settings..." -app= $YNH_APP_INSTANCE_NAME +app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) From c2bedff12cf03c636611495ea5b29f34c0a905db Mon Sep 17 00:00:00 2001 From: Amo Date: Tue, 1 Jun 2021 22:29:51 +0530 Subject: [PATCH 5/9] Use git with tags and an option to force upgrade for user --- check_process | 3 ++- manifest.json | 9 +++++++++ scripts/_common.sh | 3 +++ scripts/install | 5 +++-- scripts/upgrade | 21 ++++++++++++++++++--- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/check_process b/check_process index 23c886c..478cacc 100644 --- a/check_process +++ b/check_process @@ -9,7 +9,8 @@ admin="john" (USER) registration=1 is_public=1 (PUBLIC|public=1|private=0) - ; Checks + update=0 + ; Checks pkg_linter=1 setup_sub_dir=0 setup_root=1 diff --git a/manifest.json b/manifest.json index 9629ff5..69642c0 100644 --- a/manifest.json +++ b/manifest.json @@ -68,6 +68,15 @@ "cs": "Mohou se noví uživatelé registrovat?" }, "default": false + }, + { + + "name": "update", + "type": "boolean", + "ask":{ + "en": "Making this option to true will give you an option to force upgrade to new version without the package being updated to that version. WARNING: This can be risky and break your app if specific version have additional steps than noraml upgrade. Keep the option false, if you are not sure." + }, + "default": false } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index c6f97cf..32558b8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,9 @@ # COMMON VARIABLES #================================================= +# Latest tag +latest_tag=$(curl -s https://api.github.com/repos/kevinpapst/kimai2/releases/latest | grep 'tag_name' | cut -d\" -f4) +tag="1.14.3" # dependencies used by the app pkg_dependencies="" diff --git a/scripts/install b/scripts/install index f648bde..06d8e7b 100755 --- a/scripts/install +++ b/scripts/install @@ -31,6 +31,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC registration=$YNH_APP_ARG_REGISTRATION random_key=$(ynh_string_random 32) app=$YNH_APP_INSTANCE_NAME +update=$YNH_APP_ARG_UPDATE #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -54,6 +55,7 @@ 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=random_key --value=$random_key +ynh_app_setting_set --app=$app --key=update --value=$update #================================================= # STANDARD MODIFICATIONS @@ -72,9 +74,8 @@ ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$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 +git clone -b $tag --depth 1 https://github.com/kevinpapst/kimai2.git $final_path #================================================= # NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 5830c99..0653907 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,7 @@ 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) random_key=$(ynh_app_setting_get --app=$app --key=random_key) +update=$(ynh_app_setting_get --app=$app --key=update) #================================================= # CHECK VERSION @@ -76,8 +77,14 @@ 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 + if [ $update -eq 1 ] + then + git fetch --tags + git checkout $latest_tag + else + git fetch --tags + git checkout $tag + fi popd else ynh_script_progression --message="Upgrading source files..." @@ -97,7 +104,15 @@ then ynh_secure_remove --file="$final_path" # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + if [ $update -eq 1 ] + then + git clone -b $latest_tag --depth 1 https://github.com/kevinpapst/kimai2.git $final_path + else + git clone -b $tag --depth 1 https://github.com/kevinpapst/kimai2.git $final_path + fi + + + # Restore config if [ -f $tmpdir/local.yaml ]; then From 2d8707440d556779acb26a562db6afa0411199b0 Mon Sep 17 00:00:00 2001 From: Amo Date: Wed, 2 Jun 2021 01:44:07 +0530 Subject: [PATCH 6/9] No option for force upgrade to user --- check_process | 1 - manifest.json | 12 +----------- scripts/install | 2 +- scripts/upgrade | 4 ++-- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/check_process b/check_process index 478cacc..a1fa64f 100644 --- a/check_process +++ b/check_process @@ -9,7 +9,6 @@ admin="john" (USER) registration=1 is_public=1 (PUBLIC|public=1|private=0) - update=0 ; Checks pkg_linter=1 setup_sub_dir=0 diff --git a/manifest.json b/manifest.json index 69642c0..0e90bae 100644 --- a/manifest.json +++ b/manifest.json @@ -68,16 +68,6 @@ "cs": "Mohou se noví uživatelé registrovat?" }, "default": false - }, - { - - "name": "update", - "type": "boolean", - "ask":{ - "en": "Making this option to true will give you an option to force upgrade to new version without the package being updated to that version. WARNING: This can be risky and break your app if specific version have additional steps than noraml upgrade. Keep the option false, if you are not sure." - }, - "default": false - } - ] + } ] } } diff --git a/scripts/install b/scripts/install index 06d8e7b..be264f7 100755 --- a/scripts/install +++ b/scripts/install @@ -31,7 +31,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC registration=$YNH_APP_ARG_REGISTRATION random_key=$(ynh_string_random 32) app=$YNH_APP_INSTANCE_NAME -update=$YNH_APP_ARG_UPDATE +update=0 #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS diff --git a/scripts/upgrade b/scripts/upgrade index 0653907..d2ce465 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,10 +79,10 @@ then pushd "$final_path" if [ $update -eq 1 ] then - git fetch --tags + git fetch origin tag $latest_tag --no-tags git checkout $latest_tag else - git fetch --tags + git fetch origin tag $tag --no-tags git checkout $tag fi popd From b93f5913a452dcdc671d72789045c63dc23a9d21 Mon Sep 17 00:00:00 2001 From: anmol26s <5068843+anmol26s@users.noreply.github.com> Date: Thu, 1 Jul 2021 20:26:34 +0000 Subject: [PATCH 7/9] Update scripts/install Co-authored-by: yalh76 --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index be264f7..41ddc83 100755 --- a/scripts/install +++ b/scripts/install @@ -149,7 +149,7 @@ popd #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= -ynh_script_progression --message="Storing the config file checksum..." +ynh_script_progression --message="Storing the config file checksum..." # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$local_conf" From 279677d722c59ade799dbef44d47ebf32d9f01f5 Mon Sep 17 00:00:00 2001 From: anmol26s <5068843+anmol26s@users.noreply.github.com> Date: Thu, 1 Jul 2021 20:26:50 +0000 Subject: [PATCH 8/9] Update scripts/install Co-authored-by: yalh76 --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 41ddc83..cf6a509 100755 --- a/scripts/install +++ b/scripts/install @@ -170,9 +170,9 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Configuring SSOwat..." -ynh_permission_create --permission="teamlead" -ynh_permission_create --permission="admin" -ynh_permission_create --permission="super_admin" --allowed "$admin" +ynh_permission_create --permission="teamlead" +ynh_permission_create --permission="admin" +ynh_permission_create --permission="super_admin" --allowed "$admin" # Make app public if necessary if [ $is_public -eq 1 ] From 3581089633a218c15120c2387a6a11ef9feb6075 Mon Sep 17 00:00:00 2001 From: anmol26s <5068843+anmol26s@users.noreply.github.com> Date: Thu, 1 Jul 2021 20:27:04 +0000 Subject: [PATCH 9/9] Update scripts/install Co-authored-by: yalh76 --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index cf6a509..e1a6cee 100755 --- a/scripts/install +++ b/scripts/install @@ -139,8 +139,8 @@ ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" #================================================= ynh_script_progression --message="Building Kimai2..." -ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --install_args="--optimize-autoloader" -ynh_composer_exec --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --commands="require laminas/laminas-ldap" +ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --install_args="--optimize-autoloader" +ynh_composer_exec --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --commands="require laminas/laminas-ldap" pushd "$final_path" php${YNH_PHP_VERSION} bin/console kimai:install -n