1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kimai2_ynh.git synced 2024-09-03 19:26:26 +02:00

Cleaning up

This commit is contained in:
ericgaspar 2021-09-27 10:57:49 +02:00
parent f26285511a
commit 32069888a3
No known key found for this signature in database
GPG key ID: 574F281483054D44
9 changed files with 14 additions and 158 deletions

View file

@ -5,11 +5,11 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
admin="john" (USER)
domain="domain.tld"
admin="john"
database="mysql"
registration=1
is_public=1 (PUBLIC|public=1|private=0)
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=0
@ -22,13 +22,7 @@
upgrade=1 from_commit=e5ce0d869526c6c856c1e2398b4b2ce0ba8e7542
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
port_already_use=0
change_url=0
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options
Email=anmol@datamol.org
Notification=change

View file

@ -3,8 +3,8 @@
"id": "kimai2",
"packaging_format": 1,
"description": {
"en": "A multi-user application for time-tracking with support for mobile devices",
"fr": "Une application web de suivi du temps, multi-utilisateurs, et compatible avec les appareils mobiles",
"en": "Multi-user application for time-tracking with support for mobile devices",
"fr": "Application web de suivi du temps, multi-utilisateurs, et compatible avec les appareils mobiles",
"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í"
},
@ -17,47 +17,27 @@
"url": "datamol.org"
},
"requirements": {
"yunohost": ">= 3.8"
"yunohost": ">= 4.2.4"
},
"multi_instance": true,
"services": [
"nginx",
"php7.0-fpm",
"php7.3-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for Kimai2",
"fr": "Choisissez un nom de domaine pour Kimai2",
"de": "Wählen Sie einen Domainnamen für Kimai2",
"cs": "Zvolte doménu pro Kimai2"
},
"example": "kimai2.example.com"
"type": "domain"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user (should be a YunoHost registered user).",
"fr": "Choisissez ladministrateur (should be a YunoHost registered user).",
"de": "Wählen Sie einen Admin Benutzer (sollte ein registrierter YunoHost Benutzer sein).",
"cs": "Zvolte administrátora (musí to být registrovaný uživatel YunoHostu)."
},
"example": "johndoe"
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?",
"de": "Ist dies eine öffentliche Applikation?",
"cs": "Je tato aplikace veřejná?"
},
"default": false
},
{
@ -76,7 +56,7 @@
"name": "registration",
"type": "boolean",
"ask": {
"en": "Are new users allowed to register ?",
"en": "Are new users allowed to register?",
"fr": "Est-ce que de nouveaux utilisateurs peuvent s'y inscrire ?",
"de": "Sollen sich neue Benutzer selber registrieren können ?",
"cs": "Mohou se noví uživatelé registrovat?"

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies=""
YNH_PHP_VERSION="7.3"
YNH_COMPOSER_VERSION="2.0.4"

View file

@ -14,9 +14,6 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors

View file

@ -7,7 +7,6 @@
#=================================================
source _common.sh
source ynh_composer__3
source /usr/share/yunohost/helpers
#=================================================
@ -59,13 +58,12 @@ ynh_app_setting_set --app=$app --key=database --value=$database
ynh_app_setting_set --app=$app --key=random_key --value=$random_key
#=================================================
# STANDARD MODIFICATIONS
# CREATE DEDICATED USER
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..."
ynh_script_progression --message="Configuring system user..."
ynh_install_app_dependencies $pkg_dependencies
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -84,14 +82,6 @@ ynh_script_progression --message="Configuring nginx web server..."
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
@ -182,7 +172,6 @@ ynh_permission_create --permission="super_admin" --allowed "$admin"
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_permission_update --permission "main" --add "visitors"
fi

View file

@ -34,14 +34,6 @@ if [ "$database" = "mysql" ]; then
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
fi
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================

View file

@ -14,9 +14,6 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -37,8 +34,6 @@ database=$(ynh_app_setting_get --app=$app --key=database)
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
@ -85,16 +80,6 @@ ynh_restore_file --origin_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================

View file

@ -7,7 +7,6 @@
#=================================================
source _common.sh
source ynh_composer__3
source /usr/share/yunohost/helpers
#=================================================
@ -38,15 +37,6 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
@ -116,13 +106,6 @@ ynh_script_progression --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================

View file

@ -1,61 +0,0 @@
#!/bin/bash
readonly YNH_DEFAULT_COMPOSER_VERSION=1.10.17
# Declare the actual composer version to use.
# A packager willing to use another version of composer can override the variable into its _common.sh.
YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION}
# Execute a command with Composer
#
# usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute.
ynh_composer_exec () {
# Declare an array to define the options of this helper.
local legacy_args=vwc
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
local phpversion
local workdir
local commands
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --quiet --no-interaction
}
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion]
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
# | arg: -c, --composerversion - Composer version to install
ynh_install_composer () {
# Declare an array to define the options of this helper.
local legacy_args=vwa
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=)
local phpversion
local workdir
local install_args
local composerversion
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
install_args="${install_args:-}"
composerversion="${composerversion:-$YNH_COMPOSER_VERSION}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \
|| ynh_die "Unable to install Composer."
# update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|| ynh_die "Unable to update core dependencies with Composer."
}