From f554fff1d2e2214df2eebc34d29c1370786791b2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 18 Oct 2020 23:39:14 +0200 Subject: [PATCH] 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 #=================================================