mirror of
https://github.com/YunoHost-Apps/kimai2_ynh.git
synced 2024-09-03 19:26:26 +02:00
commit
d50fb475b2
10 changed files with 107 additions and 108 deletions
|
@ -1,6 +1,7 @@
|
|||
# Kimai2 app for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/kimai2)  
|
||||
[](https://dash.yunohost.org/appci/app/kimai2)  
|
||||
|
||||
[](https://install-app.yunohost.org/?app=kimai2)
|
||||
|
||||
> *This package allows you to install kimai2 quickly and simply on a YunoHost server.
|
||||
|
@ -12,7 +13,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
|
||||
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
admin="john" (USER)
|
||||
database="mysql"
|
||||
registration=1
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
; Checks
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
setup_root=1
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
@ -82,7 +68,6 @@
|
|||
"cs": "Mohou se noví uživatelé registrovat?"
|
||||
},
|
||||
"default": false
|
||||
}
|
||||
]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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=""
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -29,10 +29,9 @@ 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
|
||||
update=0
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
|
@ -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=random_key --value=$random_key
|
||||
ynh_app_setting_set --app=$app --key=update --value=$update
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
git clone -b $tag --depth 1 https://github.com/kevinpapst/kimai2.git $final_path
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -110,34 +111,28 @@ 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
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -17,14 +17,14 @@ ynh_script_progression --message="Loading installation settings..."
|
|||
|
||||
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)
|
||||
database=$(ynh_app_setting_get --app=$app --key=database)
|
||||
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
|
||||
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
|
||||
update=$(ynh_app_setting_get --app=$app --key=update)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -72,9 +72,21 @@ 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"
|
||||
if [ $update -eq 1 ]
|
||||
then
|
||||
git fetch origin tag $latest_tag --no-tags
|
||||
git checkout $latest_tag
|
||||
else
|
||||
git fetch origin tag $tag --no-tags
|
||||
git checkout $tag
|
||||
fi
|
||||
popd
|
||||
else
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
|
||||
# Create a temporary directory and backup config
|
||||
|
@ -92,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
|
||||
|
@ -106,8 +126,10 @@ then
|
|||
fi
|
||||
|
||||
ynh_secure_remove --file="$tmpdir"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -161,23 +183,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"
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue