1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snipeit_ynh.git synced 2024-09-03 20:26:16 +02:00
* 5.3.1
This commit is contained in:
Éric Gaspar 2021-11-14 15:23:14 +01:00 committed by GitHub
parent 4adb6ca252
commit f8885d4981
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 124 additions and 204 deletions

View file

@ -1,43 +1,37 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Snipe-IT for YunoHost
[![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)
[![Install Snipe-IT with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit)
*[Lire ce readme en français.](./README_fr.md)*
> *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
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:** 5.0.4
Manage assets for IT operations
**Shipped version:** 5.3.1~ynh1
**Demo:** https://snipeitapp.com/demo/
## Screenshots
![](https://snipeitapp.com/img/screenshots/screenshot-license-list.png)
![](./doc/screenshots/screenshot-license-list.png)
## Demo
## Documentation and resources
* [Official demo](https://snipeitapp.com/demo/)
## Configuration
1. Require dedicated domain like **asset.domain.tld**.
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-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/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/snipeit_ynh/issues
* App website: https://snipeitapp.com/
* Upstream app repository: https://github.com/snipe/snipe-it
* YunoHost website: https://yunohost.org/
---
* Official app website: https://snipeitapp.com/
* Official admin documentation: https://snipe-it.readme.io/docs
* Upstream app code repository: https://github.com/snipe/snipe-it
* YunoHost documentation for this app: https://yunohost.org/app_snipeit
* Report a bug: https://github.com/YunoHost-Apps/snipeit_ynh/issues
## Developer info
@ -49,3 +43,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/snipeit_ynh/tree/test
or
sudo yunohost app upgrade snipeit -u https://github.com/YunoHost-Apps/snipeit_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

43
README_fr.md Normal file
View file

@ -0,0 +1,43 @@
# Snipe-IT pour YunoHost
[![Niveau d'intégration](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)
[![Installer Snipe-IT avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Snipe-IT rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Gestionnaire de ressources informatiques
**Version incluse :** 5.3.1~ynh1
**Démo :** https://snipeitapp.com/demo/
## Captures d'écran
![](./doc/screenshots/screenshot-license-list.png)
## Documentations et ressources
* Site officiel de l'app : https://snipeitapp.com/
* Documentation officielle de l'admin : https://snipe-it.readme.io/docs
* Dépôt de code officiel de l'app : https://github.com/snipe/snipe-it
* Documentation YunoHost pour cette app : https://yunohost.org/app_snipeit
* Signaler un bug : https://github.com/YunoHost-Apps/snipeit_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/snipeit_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/snipeit_ynh/tree/testing --debug
ou
sudo yunohost app upgrade snipeit -u https://github.com/YunoHost-Apps/snipeit_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,15 +1,10 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (USER)
domain="domain.tld"
path="/path"
admin="john"
language="fr"
is_public=1 (PUBLIC|public=1|private=0)
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=0
@ -22,7 +17,6 @@
backup_restore=1
multi_instance=0
incorrect_path=1
port_already_use=0
change_url=0
;;; Options
Email=anmol@datamol.org

View file

@ -15,7 +15,7 @@ DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=__DB_NAME__
DB_USERNAME=__DB_USER__
DB_PASSWORD=__DB_PASS__
DB_PASSWORD=__DB_PWD__
DB_PREFIX=null
DB_DUMP_PATH='/usr/bin'
DB_CHARSET=utf8mb4

View file

@ -1,6 +1,5 @@
SOURCE_URL=https://github.com/snipe/snipe-it/archive/v5.0.4.tar.gz
SOURCE_SUM=b06eef8d8f7a3063d93ebfcfe10c1d238c8879d555d0b48e01cc854e9d3d1d44
SOURCE_URL=https://github.com/snipe/snipe-it/archive/v5.3.1.tar.gz
SOURCE_SUM=0870373e35dbe34574322d49da647a4c5cf8912a153ab520eb065cc4b06787e0
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 KiB

View file

@ -6,49 +6,42 @@
"en": "Manage assets for IT operations",
"fr": "Gestionnaire de ressources informatiques"
},
"version": "5.0.4~ynh2",
"version": "5.3.1~ynh1",
"url": "https://snipeitapp.com/",
"upstream": {
"license": "MIT",
"website": "https://snipeitapp.com/",
"demo": "https://snipeitapp.com/demo/",
"admindoc": "https://snipe-it.readme.io/docs",
"code": "https://github.com/snipe/snipe-it"
},
"license": "MIT",
"maintainer": {
"name": "Anmol Sharma",
"email": "anmol@datamol.org"
},
"requirements": {
"yunohost": ">= 4.0.0"
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [
"nginx",
"php7.0-fpm",
"php7.3-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for Snipe-IT",
"fr": "Choisissez un nom de domaine pour Snipe-IT"
},
"example": "example.com"
"type": "domain"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user",
"fr": "Choisissez l'administrateur"
},
"example": "johndoe"
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true
},
{

View file

@ -6,12 +6,11 @@
# Packages requirements: https://snipe-it.readme.io/docs/requirements
# dependencies used by the app
pkg_dependencies="openssl"
YNH_PHP_VERSION="7.3"
YNH_PHP_VERSION=7.3
pkg_dependencies="openssl 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}-gd"
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"
YNH_COMPOSER_VERSION=2.0.14
#=================================================
# PERSONAL HELPERS
@ -21,79 +20,6 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cur
# EXPERIMENTAL HELPERS
#=================================================
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval $@
else
sudo -u "$USER" $@
fi
}
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
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 --message="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 --message="Unable to update core dependencies with Composer."
}

View file

@ -28,6 +28,8 @@ path_url="/"
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
email=$(ynh_user_get_info --username=$admin --key=mail)
key=
app=$YNH_APP_INSTANCE_NAME
@ -50,7 +52,6 @@ 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
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
#=================================================
@ -103,7 +104,7 @@ ynh_system_user_create --username=$app
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=low --footprint=low
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
@ -121,17 +122,10 @@ ynh_install_composer
#=================================================
ynh_script_progression --message="Building..."
# Get admin email
email=$(ynh_user_get_info $admin 'mail')
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
# setup application config
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="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/.env"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/.env"
chmod 600 "$final_path/.env"
chown $app:$app "$final_path/.env"
# setup application config
pushd "$final_path"
@ -141,14 +135,6 @@ pushd "$final_path"
php$phpversion artisan config:cache -n
popd
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_script_progression --message="Storing the config file checksum..." --weight=1
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/.env"
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -158,6 +144,7 @@ ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions to app files
chown -R $app: $final_path
chmod -R o-rwx $final_path
chmod -R 755 $final_path/storage
chmod -R 755 $final_path/public/uploads
@ -169,8 +156,6 @@ ynh_script_progression --message="Configuring SSOwat..." --weight=3
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission "main" --add "visitors"
fi

View file

@ -38,8 +38,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
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}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
@ -74,6 +72,7 @@ ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path
chmod -R o-rwx $final_path
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
@ -84,7 +83,7 @@ ynh_script_progression --message="Restoring PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=low --footprint=low
#=================================================
# SPECIFIC RESTORATION

View file

@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
@ -28,36 +27,9 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# 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 db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -72,6 +44,30 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -83,7 +79,7 @@ then
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"
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/.env"
fi
#=================================================
@ -115,7 +111,7 @@ ynh_system_user_create --username=$app
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=low --footprint=low
#=================================================
# SPECIFIC UPGRADE
@ -148,21 +144,10 @@ ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions on app files
chown -R $app: $final_path
chmod -R o-rwx $final_path
chmod -R 755 $final_path/storage
chmod -R 755 $final_path/public/uploads
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..."
# 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
#=================================================