From f554fff1d2e2214df2eebc34d29c1370786791b2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 18 Oct 2020 23:39:14 +0200 Subject: [PATCH 1/8] Upgrade to 4.9.5 --- README.md | 34 ++++++++++++--------- check_process | 11 ------- conf/app.src | 4 +-- conf/nginx.conf | 9 ++++-- manifest.json | 18 +++++++----- scripts/_common.sh | 3 +- scripts/backup | 23 +++++---------- scripts/install | 73 +--------------------------------------------- scripts/remove | 4 --- scripts/restore | 6 ---- scripts/upgrade | 22 +------------- 11 files changed, 51 insertions(+), 156 deletions(-) diff --git a/README.md b/README.md index 9d5db75..542a36f 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ +# Snipe-IT for YunoHost -# Snipe-IT app for YunoHost - -[![Integration level](https://dash.yunohost.org/integration/snipeit.svg)](https://dash.yunohost.org/appci/app/snipeit) -[![Install snipeit with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=snipeit) - +[![Integration level](https://dash.yunohost.org/integration/snipeit.svg)](https://dash.yunohost.org/appci/app/snipeit) ![](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg) +[![Install Snipe-IT with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=snipeit) +> *This package allows you to install Snipe-IT quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -This is a FOSS project for asset management in IT Operations. Knowing who has which laptop, when it was purchased in order to depreciate it correctly, handling software licenses, etc. +This is a FOSS project for asset management in IT Operations. Knowing who has which laptop, when it was purchased in order to depreciate it correctly, handling software licenses, etc. It is built on Laravel 5.4. -It is built on Laravel 5.4. - -**Shipped version:** 4.9.2 +**Shipped version:** 4.9.5 +## Screenshots +![](https://snipeitapp.com/img/screenshots/screenshot-license-list.png) ## Demo @@ -25,14 +25,10 @@ It is built on Laravel 5.4. 1. No LDAP support yet. 1. This app is multi-instance (you can have more then one instance of this app running on a YunoHost server) - - #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/snipeit%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/snipeit/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/snipeit%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/snipeit/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/snipeit%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/snipeit/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/snipeit%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/snipeit/) - ## Links @@ -43,3 +39,13 @@ It is built on Laravel 5.4. --- +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/snipeit_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/snipeit_ynh/tree/testing --debug +or +sudo yunohost app upgrade snipeit -u https://github.com/YunoHost-Apps/snipeit_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index 00f1bde..7c39ec0 100644 --- a/check_process +++ b/check_process @@ -25,18 +25,7 @@ port_already_use=0 change_url=0 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: If the app supports LDAP and SSOwat, turn level 4 to '1' and add a link to an issue or a part of your code to show it. -# If the app does not use LDAP nor SSOwat, and can't use them, turn level 4 to 'na' and explain as well. - Level 4=0 Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email=anmol@datamol.org Notification=change diff --git a/conf/app.src b/conf/app.src index c863ec4..bf51e7a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/snipe/snipe-it/archive/v4.9.2.tar.gz -SOURCE_SUM=57b15469492f063f6c893da20ccaf34921810ea40f83f56186cee8aff91fe161 +SOURCE_URL=https://github.com/snipe/snipe-it/archive/v4.9.5.tar.gz +SOURCE_SUM=0f277dc712af511a90d722e0f3fc7ab1731356f823b9122c7df8eca85892ce5d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 50e6a3c..7d5d614 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,11 +1,16 @@ -location ^~ __PATH__ { +location ^~ __PATH__/ { + alias __FINALPATH__/public/; + try_files $uri $uri/ @snipe; + index index.php; - # Force https + + # Force https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } + location ~ \.php { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php/php__YNH_PHP_VERSION__-fpm-__NAME__.sock; diff --git a/manifest.json b/manifest.json index 2e6f354..0e6b82c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Manage assets for IT operations", "fr": "Gestionnaire de ressources informatiques" }, - "version": "4.9.2~ynh1", + "version": "4.9.5~ynh1", "url": "https://snipeitapp.com/", "license": "MIT", "maintainer": { @@ -19,7 +19,7 @@ "multi_instance": true, "services": [ "nginx", - "php-fpm", + "php7.0-fpm", "mysql" ], "arguments": { @@ -28,7 +28,8 @@ "name": "domain", "type": "domain", "ask": { - "en": "Choose a domain name for SnipeIT" + "en": "Choose a domain name for Snipe-IT", + "fr": "Choisissez un nom de domaine pour Snipe-IT" }, "example": "example.com" }, @@ -36,7 +37,8 @@ "name": "admin", "type": "user", "ask": { - "en": "Choose an admin user" + "en": "Choose an admin user", + "fr": "Choisissez l'administrateur" }, "example": "johndoe" }, @@ -44,7 +46,8 @@ "name": "is_public", "type": "boolean", "ask": { - "en": "Is it a public application?" + "en": "Is it a public application?", + "fr": "Est-ce une application publique ?" }, "default": true }, @@ -52,9 +55,10 @@ "name": "language", "type": "string", "ask": { - "en": "Choose the application language" + "en": "Choose the application language", + "fr": "Choisissez la langue de l'application" }, - "choices": ["en", "en-GB", "af", "ar", "bg", "zh-CN", "zh-TW", "hr", "cs", "da", "nl", "et", "fi", "fr", "de", "el", "he", "hu", "id", "en-ID", "ga-IE", "it", "ja", "ko", "lv", "lt", "ms", "mi", "mn", "no", "fa", "pl", "pt-PT", "pt-BR", "ro", "ru", "es-ES", "es-CO", "sv-SE", "ta", "tr", "vi", "zu"], + "choices": ["en", "fr"], "default": "en" } ] diff --git a/scripts/_common.sh b/scripts/_common.sh index 80bf0d9..8b17821 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,6 +10,7 @@ pkg_dependencies="openssl" YNH_PHP_VERSION=7.3 + extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-common php${YNH_PHP_VERSION}-gd" #================================================= @@ -83,4 +84,4 @@ ynh_install_composer () { # update dependencies to create composer.lock ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \ || ynh_die "Unable to update core dependencies with Composer." -} \ No newline at end of file +} diff --git a/scripts/backup b/scripts/backup index 41c31aa..6f3ff9f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,17 +14,12 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -33,41 +28,37 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." --time --weight=1 ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1 ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Backing up php-fpm configuration..." --time --weight=1 ynh_backup --src_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Backing up the MySQL database..." --time --weight=1 +ynh_print_info --message="Backing up the MySQL database..." ynh_mysql_dump_db --database="$db_name" > db.sql -#================================================= -# SPECIFIC BACKUP -#================================================= - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 3afb5ab..5eb33da 100755 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -30,33 +29,13 @@ admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -### About --weight and --time -### ynh_script_progression will show to your final users the progression of each scripts. -### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script. -### --time is a packager option, it will show you the execution time since the previous call. -### This option should be removed before releasing your app. -### Use the execution time, given by --time, to estimate the weight of a step. -### A common way to do it is to set a weight equal to the execution time in second +1. -### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call. ynh_script_progression --message="Validating installation parameters..." --time --weight=1 -### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -74,23 +53,11 @@ 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=language --value=$language -#================================================= -# STANDARD MODIFICATIONS -#================================================= - #================================================= # INSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Installing dependencies..." --time --weight=1 -### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. -### Those deb packages will be installed as dependencies of this package. -### If you're not using this helper: -### - Remove the section "REMOVE DEPENDENCIES" in the remove script -### - Remove the variable "pkg_dependencies" in _common.sh -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - ynh_install_app_dependencies $pkg_dependencies #================================================= @@ -98,15 +65,6 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= ynh_script_progression --message="Creating a MySQL database..." --time --weight=1 -### Use these lines if you need a database for the application. -### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. -### The password will be stored as 'mysqlpwd' into the app settings, -### and will be available as $db_pwd -### If you're not using these lines: -### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script -### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script -### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script - db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name @@ -116,10 +74,6 @@ ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name #================================================= ynh_script_progression --message="Setting up source files..." --time --weight=1 -### `ynh_setup_source` is used to install an app from a zip or tar.gz file, -### downloaded from an upstream source, like a git repository. -### `ynh_setup_source` use the file conf/app.src - 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" @@ -129,8 +83,6 @@ ynh_setup_source --dest_dir="$final_path" #================================================= ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 -### `ynh_add_nginx_config` will use the file conf/nginx.conf - # Create a dedicated nginx config ynh_add_nginx_config YNH_PHP_VERSION @@ -147,17 +99,6 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 -### `ynh_add_fpm_config` is used to set up a PHP config. -### You can remove it if your app doesn't use PHP. -### `ynh_add_fpm_config` will use the files conf/php-fpm.conf and conf/php-fpm.ini -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script -### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script -### With the reload at the end of the script. -### - And the section "PHP-FPM CONFIGURATION" in the upgrade script - # Create a dedicated php-fpm config ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" @@ -171,10 +112,6 @@ ynh_script_progression --message="Installing composer..." --time --weight=1 # Install composer ynh_install_composer -#================================================= -# MODIFY A CONFIG FILE -#================================================= - #================================================= # SPECIFIC SETUP #================================================= @@ -183,7 +120,7 @@ ynh_install_composer email=$(ynh_user_get_info $admin 'mail') # setup application config -sudo cp ../conf/.env $final_path/.env +cp ../conf/.env $final_path/.env db_name=$(ynh_sanitize_dbid $app) @@ -203,10 +140,6 @@ ynh_replace_string "__LANGUAGE__" "$language" "$final_path/.env" # STORE THE CONFIG FILE CHECKSUM #================================================= -### `ynh_store_file_checksum` is used to store the checksum of a file. -### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`, -### you can make a backup of this file before modifying it again if the admin had modified it. - # Calculate and store the config file checksum into the app settings ynh_store_file_checksum "$final_path/.env" @@ -216,10 +149,6 @@ ynh_store_file_checksum "$final_path/.env" # SECURE FILES AND DIRECTORIES #================================================= -### For security reason, any app should set the permissions to root: before anything else. -### Then, if write authorization is needed, any access should be given only to directories -### that really need such authorization. - # Set permissions to app files chown -R $app: $final_path chmod -R 755 $final_path/storage diff --git a/scripts/remove b/scripts/remove index 572caa5..9316285 100755 --- a/scripts/remove +++ b/scripts/remove @@ -65,10 +65,6 @@ ynh_script_progression --message="Removing php-fpm configuration" --time --weigh # Remove the dedicated php-fpm config ynh_remove_fpm_config -#================================================= -# SPECIFIC REMOVE -#================================================= - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 933c5a1..9948497 100755 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -14,11 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2fbfc42..392b317 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,12 +28,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) # CHECK VERSION #================================================= -### This helper will compare the version of the currently installed app and the version of the upstream package. -### $upgrade_type can have 2 different values -### - UPGRADE_APP if the upstream app version has changed -### - UPGRADE_PACKAGE if only the YunoHost package has changed -### ynh_check_app_version_changed will stop the upgrade if the app is up to date. -### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) #================================================= @@ -76,18 +70,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -# N.B. : this is for app installations before YunoHost 2.7 -# where this value might be something like /foo/ or foo/ -# instead of /foo .... -# If nobody installed your app before 2.7, then you may -# safely remove this line -path_url=$(ynh_normalize_url_path --path_url=$path_url) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -108,7 +90,7 @@ fi ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 # Create a dedicated nginx config -ynh_add_nginx_config YNH_PHP_VERSION +ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES @@ -155,11 +137,9 @@ ynh_backup_if_checksum_is_different --file="$final_path/.env" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$final_path/.env" - #================================================= # GENERIC FINALIZATION #================================================= -#================================================= # SECURE FILES AND DIRECTORIES #================================================= From 9bc23a280be8b025f42c9d599915f6e7d1e81512 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Oct 2020 09:19:03 +0200 Subject: [PATCH 2/8] small typos --- README.md | 4 ++-- scripts/backup | 3 +-- scripts/install | 18 +++++++----------- scripts/remove | 14 ++++++-------- scripts/restore | 8 ++++---- scripts/upgrade | 16 ++++++++-------- 6 files changed, 28 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 542a36f..7813c18 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -This is a FOSS project for asset management in IT Operations. Knowing who has which laptop, when it was purchased in order to depreciate it correctly, handling software licenses, etc. It is built on Laravel 5.4. +Snipe-IT is a FOSS project for asset management in IT Operations. Knowing who has which laptop, when it was purchased in order to depreciate it correctly, handling software licenses, etc. It is built on Laravel 5.4. **Shipped version:** 4.9.5 @@ -34,7 +34,7 @@ This is a FOSS project for asset management in IT Operations. Knowing who has wh * Report a bug: https://github.com/YunoHost-Apps/snipeit_ynh/issues * Snipe-IT website: https://snipeitapp.com/ - * Github reop for Snipe-IT: https://github.com/snipe/snipe-it + * GitHub reop for Snipe-IT: https://github.com/snipe/snipe-it * YunoHost website: https://yunohost.org/ --- diff --git a/scripts/backup b/scripts/backup index 6f3ff9f..12128ac 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -61,4 +60,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for Snipe-IT. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 5eb33da..1ab98a5 100755 --- a/scripts/install +++ b/scripts/install @@ -13,10 +13,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 #================================================= @@ -81,9 +77,9 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config YNH_PHP_VERSION #================================================= @@ -97,9 +93,9 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 +ynh_script_progression --message="Configuring PHP-FPM..." --time --weight=1 -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" #================================================= @@ -107,7 +103,7 @@ ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --p #================================================= # INSTALL AND INITIALIZE COMPOSER #================================================= -ynh_script_progression --message="Installing composer..." --time --weight=1 +ynh_script_progression --message="Installing Composer..." --time --weight=1 # Install composer ynh_install_composer @@ -169,7 +165,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -177,4 +173,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --time --last +ynh_script_progression --message="Installation of Snipe-IT completed" --last diff --git a/scripts/remove b/scripts/remove index 9316285..9fd9346 100755 --- a/scripts/remove +++ b/scripts/remove @@ -23,8 +23,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE -#================================================= - #================================================= # REMOVE THE MYSQL DATABASE #================================================= @@ -44,7 +42,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory" --time --weight=1 +ynh_script_progression --message="Removing Snipe-IT main directory" --time --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -52,17 +50,17 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration" --time --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration" --time --weight=1 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration" --time --weight=1 +ynh_script_progression --message="Removing PHP-FPM configuration" --time --weight=1 -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= @@ -79,4 +77,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal ofSnipe-IT completed" --last diff --git a/scripts/restore b/scripts/restore index 9948497..8c561ce 100755 --- a/scripts/restore +++ b/scripts/restore @@ -48,7 +48,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 +ynh_script_progression --message="Restoring Snipe-IT main directory..." --time --weight=1 ynh_restore_file --origin_path="$final_path" @@ -80,7 +80,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Reconfiguring php-fpm..." --time --weight=1 +ynh_script_progression --message="Reconfiguring PHP-FPM..." --time --weight=1 # Restore the file first, so it can have a backup if different ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" @@ -101,7 +101,7 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./ #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --time --weight=1 ynh_systemd_action --service_name=php${YNH_PHP_VERSION}-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload @@ -110,4 +110,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for Snipe-IT" --last diff --git a/scripts/upgrade b/scripts/upgrade index 392b317..67ca7fa 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -59,7 +59,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up Snipe-IT before upgrading (may take a while)..." --time --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -87,9 +87,9 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading NGINS web server configuration..." --time --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -110,9 +110,9 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --time --weight=1 -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" #================================================= @@ -120,7 +120,7 @@ ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --p #================================================= # INSTALL AND INITIALIZE COMPOSER #================================================= -ynh_script_progression --message="Installing composer..." --time --weight=1 +ynh_script_progression --message="Installing Composer..." --time --weight=1 # Install composer ynh_install_composer @@ -163,7 +163,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -171,4 +171,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last +ynh_script_progression --message="Upgrade of Snipe-IT completed" --last From f6a12ece8e3d90e95e5758589a27b970f49f9bf5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Oct 2020 09:40:19 +0200 Subject: [PATCH 3/8] Fix time --- scripts/install | 29 +++++++++++++++-------------- scripts/remove | 14 +++++++------- scripts/restore | 16 ++++++++-------- scripts/upgrade | 30 +++++++++--------------------- 4 files changed, 39 insertions(+), 50 deletions(-) diff --git a/scripts/install b/scripts/install index 1ab98a5..700328e 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --time --weight=1 +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -41,7 +41,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --time --weight=1 +ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -52,14 +52,14 @@ ynh_app_setting_set --app=$app --key=language --value=$language #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --time --weight=1 +ynh_script_progression --message="Installing dependencies..." --weight=3 ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." --time --weight=1 +ynh_script_progression --message="Creating a MySQL database..." --weight=8 db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set --app=$app --key=db_name --value=$db_name @@ -68,7 +68,7 @@ ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --time --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=2 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src @@ -77,7 +77,7 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --weight=5 # Create a dedicated NGINX config ynh_add_nginx_config YNH_PHP_VERSION @@ -85,7 +85,7 @@ ynh_add_nginx_config YNH_PHP_VERSION #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user ynh_system_user_create --username=$app @@ -93,7 +93,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." --time --weight=1 +ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" @@ -103,7 +103,7 @@ ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --p #================================================= # INSTALL AND INITIALIZE COMPOSER #================================================= -ynh_script_progression --message="Installing Composer..." --time --weight=1 +ynh_script_progression --message="Installing Composer..." --weight=21 # Install composer ynh_install_composer @@ -153,19 +153,20 @@ chmod -R 755 $final_path/public/uploads #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 +ynh_script_progression --message="Configuring SSOwat..." --weight=33 -# Make app public if necessary +# Make app public if necessary or protect it if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission "main" --add "visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index 9fd9346..4fadaa3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -26,7 +26,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database" --time --weight=1 +ynh_script_progression --message="Removing the MySQL database" --weight=1 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name @@ -34,7 +34,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies" --time --weight=1 +ynh_script_progression --message="Removing dependencies" --weight=2 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -42,7 +42,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing Snipe-IT main directory" --time --weight=1 +ynh_script_progression --message="Removing Snipe-IT main directory" --weight=5 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -50,7 +50,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration" --time --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration" --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config @@ -58,7 +58,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing PHP-FPM configuration" --time --weight=1 +ynh_script_progression --message="Removing PHP-FPM configuration" --weight=2 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config @@ -68,7 +68,7 @@ ynh_remove_fpm_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user" --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user" --weight=1 # Delete a system user ynh_system_user_delete --username=$app diff --git a/scripts/restore b/scripts/restore index 8c561ce..c015f6a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -18,7 +18,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --time --weight=1 +ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -30,7 +30,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=2 ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -48,14 +48,14 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring Snipe-IT main directory..." --time --weight=1 +ynh_script_progression --message="Restoring Snipe-IT main directory..." --weight=7 ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app @@ -72,7 +72,7 @@ chown -R $app: $final_path #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 +ynh_script_progression --message="Reinstalling dependencies..." --weight=8 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies @@ -80,7 +80,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Reconfiguring PHP-FPM..." --time --weight=1 +ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=1 # Restore the file first, so it can have a backup if different ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" @@ -90,7 +90,7 @@ ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --p #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --time --weight=1 +ynh_script_progression --message="Restoring the MySQL database..." --weight=3 db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd @@ -101,7 +101,7 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./ #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_systemd_action --service_name=php${YNH_PHP_VERSION}-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 67ca7fa..fb34555 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -33,7 +33,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then @@ -59,7 +59,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up Snipe-IT before upgrading (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up Snipe-IT before upgrading (may take a while)..." --weight=4 # Backup the current version of the app ynh_backup_before_upgrade @@ -78,7 +78,7 @@ ynh_abort_if_errors if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --time --weight=1 + ynh_script_progression --message="Upgrading source files..." --weight=7 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" @@ -87,7 +87,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINS web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading NGINS web server configuration..." --weight=3 # Create a dedicated NGINX config ynh_add_nginx_config @@ -95,7 +95,7 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 +ynh_script_progression --message="Upgrading dependencies..." --weight=3 ynh_install_app_dependencies $pkg_dependencies @@ -110,7 +110,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" @@ -120,7 +120,7 @@ ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --p #================================================= # INSTALL AND INITIALIZE COMPOSER #================================================= -ynh_script_progression --message="Installing Composer..." --time --weight=1 +ynh_script_progression --message="Installing Composer..." --weight=15 # Install composer ynh_install_composer @@ -148,22 +148,10 @@ chown -R $app: $final_path chmod -R 755 $final_path/storage chmod -R 755 $final_path/public/uploads -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload From bd16c17b49602907912fc76eb9ec5849796a2afa Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Oct 2020 10:50:50 +0200 Subject: [PATCH 4/8] fix --- scripts/install | 14 ++++++-------- scripts/upgrade | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/install b/scripts/install index 700328e..9e57038 100755 --- a/scripts/install +++ b/scripts/install @@ -80,7 +80,7 @@ ynh_setup_source --dest_dir="$final_path" ynh_script_progression --message="Configuring NGINX web server..." --weight=5 # Create a dedicated NGINX config -ynh_add_nginx_config YNH_PHP_VERSION +ynh_add_nginx_config #================================================= # CREATE DEDICATED USER @@ -118,13 +118,11 @@ email=$(ynh_user_get_info $admin 'mail') # setup application config cp ../conf/.env $final_path/.env -db_name=$(ynh_sanitize_dbid $app) - -ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/.env" -ynh_replace_string "__DB_PASS__" "$db_pwd" "$final_path/.env" -ynh_replace_string "__DB_USER__" "$db_name" "$final_path/.env" -ynh_replace_string "yunodomain" "$domain" "$final_path/.env" -ynh_replace_string "__LANGUAGE__" "$language" "$final_path/.env" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.env" +ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/.env" +ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$final_path/.env" +ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$final_path/.env" +ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/.env" # setup application config ( cd $final_path && php$YNH_PHP_VERSION artisan key:generate -n --force --env) diff --git a/scripts/upgrade b/scripts/upgrade index fb34555..2ae6dd9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -87,7 +87,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINS web server configuration..." --weight=3 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=3 # Create a dedicated NGINX config ynh_add_nginx_config From b2c5b653b63e4bfc8915af90f3cfdb81e0c1b755 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 1 Nov 2020 12:37:36 +0100 Subject: [PATCH 5/8] Small fixes --- conf/.env | 6 +++--- manifest.json | 2 +- scripts/backup | 3 ++- scripts/install | 13 ++++++++----- scripts/restore | 3 ++- scripts/upgrade | 9 ++++++--- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/conf/.env b/conf/.env index d5add3f..129bc5d 100644 --- a/conf/.env +++ b/conf/.env @@ -4,7 +4,7 @@ APP_ENV=production APP_DEBUG=false APP_KEY=ChangeMe -APP_URL= +APP_URL=http://__DOMAIN__ APP_TIMEZONE='UTC' APP_LOCALE=__LANGUAGE__ @@ -39,9 +39,9 @@ MAIL_PORT=25 MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION=null -MAIL_FROM_ADDR=snipeit@yunodomain +MAIL_FROM_ADDR=snipeit@__DOMAIN__ MAIL_FROM_NAME='Snip-IT' -MAIL_REPLYTO_ADDR=snipeit@yunodomain +MAIL_REPLYTO_ADDR=snipeit@__DOMAIN__ MAIL_REPLYTO_NAME='Snipe-IT' # -------------------------------------------- diff --git a/manifest.json b/manifest.json index 0e6b82c..e84b48d 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "anmol@datamol.org" }, "requirements": { - "yunohost": ">= 3.8" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ diff --git a/scripts/backup b/scripts/backup index 12128ac..84e5d45 100755 --- a/scripts/backup +++ b/scripts/backup @@ -25,6 +25,7 @@ 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) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -47,7 +48,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index 9e57038..68b7ad5 100755 --- a/scripts/install +++ b/scripts/install @@ -97,6 +97,7 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC SETUP @@ -121,14 +122,16 @@ cp ../conf/.env $final_path/.env ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.env" ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/.env" ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$final_path/.env" -ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$final_path/.env" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/.env" ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/.env" # setup application config -( cd $final_path && php$YNH_PHP_VERSION artisan key:generate -n --force --env) -( cd $final_path && php$YNH_PHP_VERSION artisan migrate -n --force) -( cd $final_path && php$YNH_PHP_VERSION artisan config:clear -n) -( cd $final_path && php$YNH_PHP_VERSION artisan config:cache -n) +pushd "$final_path" + php$phpversion artisan key:generate -n --force --env + php$phpversion artisan migrate -n --force + php$phpversion artisan config:clear -n + php$phpversion artisan config:cache -n +popd #================================================= # STORE THE CONFIG FILE CHECKSUM diff --git a/scripts/restore b/scripts/restore index c015f6a..118113d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -26,6 +26,7 @@ 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) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -103,7 +104,7 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./ #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 -ynh_systemd_action --service_name=php${YNH_PHP_VERSION}-fpm --action=reload +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2ae6dd9..9666da7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,7 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -127,9 +128,11 @@ ynh_install_composer ynh_exec_warn_less ynh_composer_exec --commands=\"dump-autoload\" -( cd $final_path && php$YNH_PHP_VERSION artisan migrate -n --force) -( cd $final_path && php$YNH_PHP_VERSION artisan config:clear -n ) -( cd $final_path && php$YNH_PHP_VERSION artisan config:cache -n ) +pushd "$final_path" + php$phpversion artisan migrate -n --force + php$phpversion artisan config:clear -n + php$phpversion artisan config:cache -n +popd ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. From aac7aaebe9abe4392592f2c5b3592edee83faec0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 1 Nov 2020 13:48:16 +0100 Subject: [PATCH 6/8] Remove multi_instance --- check_process | 2 +- manifest.json | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/check_process b/check_process index 7c39ec0..7f3f978 100644 --- a/check_process +++ b/check_process @@ -20,7 +20,7 @@ upgrade=1 upgrade=1 from_commit=f0ce10dd27b78009dd754c4210111aa0eff12ad9 backup_restore=1 - multi_instance=1 + multi_instance=0 incorrect_path=1 port_already_use=0 change_url=0 diff --git a/manifest.json b/manifest.json index e84b48d..0afb2e1 100644 --- a/manifest.json +++ b/manifest.json @@ -16,7 +16,7 @@ "requirements": { "yunohost": ">= 3.8.1" }, - "multi_instance": true, + "multi_instance": false, "services": [ "nginx", "php7.0-fpm", diff --git a/scripts/upgrade b/scripts/upgrade index 9666da7..52b95ea 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,7 +103,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) ynh_system_user_create --username=$app From 2593911faa436a3ca140a7cf67ebcd52c46a3659 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 9 Nov 2020 11:09:35 +0100 Subject: [PATCH 7/8] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 0afb2e1..3a89ad3 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "anmol@datamol.org" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.0.0" }, "multi_instance": false, "services": [ From a8f4319982a931d89e4e1c12bc56f0e924b98677 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 9 Nov 2020 11:12:19 +0100 Subject: [PATCH 8/8] Upgrade to 5.0.4 --- README.md | 2 +- conf/app.src | 4 ++-- issue_template.md | 6 +++--- manifest.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0e0473b..1c8d02f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview Snipe-IT is a FOSS project for asset management in IT Operations. Knowing who has which laptop, when it was purchased in order to depreciate it correctly, handling software licenses, etc. It is built on Laravel 5.4. -**Shipped version:** 4.9.5 +**Shipped version:** 5.0.4 ## Screenshots diff --git a/conf/app.src b/conf/app.src index bf51e7a..ed58018 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/snipe/snipe-it/archive/v4.9.5.tar.gz -SOURCE_SUM=0f277dc712af511a90d722e0f3fc7ab1731356f823b9122c7df8eca85892ce5d +SOURCE_URL=https://github.com/snipe/snipe-it/archive/v5.0.4.tar.gz +SOURCE_SUM=b06eef8d8f7a3063d93ebfcfe10c1d238c8879d555d0b48e01cc854e9d3d1d44 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/issue_template.md b/issue_template.md index b1cc06e..a975880 100644 --- a/issue_template.md +++ b/issue_template.md @@ -7,7 +7,7 @@ about: When creating a bug report, please use the following template to provide **How to post a meaningful bug report** 1. *Read this whole template first.* 2. *Make sure you are on the right place:* - - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* - *In doubt, ask here and we will figure it out together.* 3. *Delete these italic comments as you write over them below, and remove this guide.* @@ -36,8 +36,8 @@ about: When creating a bug report, please use the following template to provide - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* 1. *Go to '...'* - 2. *Click on '....'* - 3. *Scroll down to '....'* + 2. *Click on '...'* + 3. *Scroll down to '...'* 4. *See error* ### Expected behavior diff --git a/manifest.json b/manifest.json index 3a89ad3..f742d29 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Manage assets for IT operations", "fr": "Gestionnaire de ressources informatiques" }, - "version": "4.9.5~ynh1", + "version": "5.0.4~ynh1", "url": "https://snipeitapp.com/", "license": "MIT", "maintainer": {