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

Merge pull request #62 from YunoHost-Apps/testing

This commit is contained in:
Salamandar 2024-07-13 12:21:13 +02:00 committed by GitHub
commit feec85c7ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 159 additions and 136 deletions

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Snipe-IT for YunoHost # Snipe-IT for YunoHost
[![Integration level](https://dash.yunohost.org/integration/snipeit.svg)](https://dash.yunohost.org/appci/app/snipeit) ![Working status](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/snipeit.svg)](https://ci-apps.yunohost.org/ci/apps/snipeit/) ![Working status](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg)
[![Install Snipe-IT with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](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)
@ -18,7 +18,7 @@ It shall NOT be edited by hand.
Snipeit 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. Snipeit 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.
**Shipped version:** 6.4.2~ynh1 **Shipped version:** 7.0.9~ynh1
**Demo:** <https://snipeitapp.com/demo/> **Demo:** <https://snipeitapp.com/demo/>

View file

@ -5,7 +5,7 @@ No se debe editar a mano.
# Snipe-IT para Yunohost # Snipe-IT para Yunohost
[![Nivel de integración](https://dash.yunohost.org/integration/snipeit.svg)](https://dash.yunohost.org/appci/app/snipeit) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg) [![Nivel de integración](https://dash.yunohost.org/integration/snipeit.svg)](https://ci-apps.yunohost.org/ci/apps/snipeit/) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg)
[![Instalar Snipe-IT con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit) [![Instalar Snipe-IT con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit)
@ -18,7 +18,7 @@ No se debe editar a mano.
Snipeit 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. Snipeit 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.
**Versión actual:** 6.4.2~ynh1 **Versión actual:** 7.0.9~ynh1
**Demo:** <https://snipeitapp.com/demo/> **Demo:** <https://snipeitapp.com/demo/>

View file

@ -5,7 +5,7 @@ EZ editatu eskuz.
# Snipe-IT YunoHost-erako # Snipe-IT YunoHost-erako
[![Integrazio maila](https://dash.yunohost.org/integration/snipeit.svg)](https://dash.yunohost.org/appci/app/snipeit) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg) [![Integrazio maila](https://dash.yunohost.org/integration/snipeit.svg)](https://ci-apps.yunohost.org/ci/apps/snipeit/) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg)
[![Instalatu Snipe-IT YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit) [![Instalatu Snipe-IT YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit)
@ -18,7 +18,7 @@ EZ editatu eskuz.
Snipeit 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. Snipeit 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.
**Paketatutako bertsioa:** 6.4.2~ynh1 **Paketatutako bertsioa:** 7.0.9~ynh1
**Demoa:** <https://snipeitapp.com/demo/> **Demoa:** <https://snipeitapp.com/demo/>

View file

@ -5,7 +5,7 @@ Il NE doit PAS être modifié à la main.
# Snipe-IT pour YunoHost # Snipe-IT pour YunoHost
[![Niveau dintégration](https://dash.yunohost.org/integration/snipeit.svg)](https://dash.yunohost.org/appci/app/snipeit) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg) [![Niveau dintégration](https://dash.yunohost.org/integration/snipeit.svg)](https://ci-apps.yunohost.org/ci/apps/snipeit/) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![Statut de maintenance](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) [![Installer Snipe-IT avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit)
@ -18,7 +18,7 @@ Il NE doit PAS être modifié à la main.
Snipeit est un projet FOSS pour la gestion des actifs dans les opérations informatiques. Savoir qui possède quel ordinateur portable, quand il a été acheté pour bien l'amortir, gérer les licences des logiciels, etc. Snipeit est un projet FOSS pour la gestion des actifs dans les opérations informatiques. Savoir qui possède quel ordinateur portable, quand il a été acheté pour bien l'amortir, gérer les licences des logiciels, etc.
**Version incluse:** 6.4.2~ynh1 **Version incluse:** 7.0.9~ynh1
**Démo:** <https://snipeitapp.com/demo/> **Démo:** <https://snipeitapp.com/demo/>

View file

@ -5,7 +5,7 @@ NON debe editarse manualmente.
# Snipe-IT para YunoHost # Snipe-IT para YunoHost
[![Nivel de integración](https://dash.yunohost.org/integration/snipeit.svg)](https://dash.yunohost.org/appci/app/snipeit) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg) [![Nivel de integración](https://dash.yunohost.org/integration/snipeit.svg)](https://ci-apps.yunohost.org/ci/apps/snipeit/) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg)
[![Instalar Snipe-IT con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit) [![Instalar Snipe-IT con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit)
@ -18,7 +18,7 @@ NON debe editarse manualmente.
Snipeit 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. Snipeit 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.
**Versión proporcionada:** 6.4.2~ynh1 **Versión proporcionada:** 7.0.9~ynh1
**Demo:** <https://snipeitapp.com/demo/> **Demo:** <https://snipeitapp.com/demo/>

View file

@ -5,7 +5,7 @@
# YunoHost 上的 Snipe-IT # YunoHost 上的 Snipe-IT
[![集成程度](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) [![集成程度](https://dash.yunohost.org/integration/snipeit.svg)](https://ci-apps.yunohost.org/ci/apps/snipeit/) ![工作状态](https://ci-apps.yunohost.org/ci/badges/snipeit.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/snipeit.maintain.svg)
[![使用 YunoHost 安装 Snipe-IT](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit) [![使用 YunoHost 安装 Snipe-IT](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snipeit)
@ -18,7 +18,7 @@
Snipeit 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. Snipeit 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.
**分发版本:** 6.4.2~ynh1 **分发版本:** 7.0.9~ynh1
**演示:** <https://snipeitapp.com/demo/> **演示:** <https://snipeitapp.com/demo/>

View file

@ -18,6 +18,7 @@ PUBLIC_FILESYSTEM_DISK=local_public
#PRIVATE_FILESYSTEM_DISK=s3_private #PRIVATE_FILESYSTEM_DISK=s3_private
#PUBLIC_FILESYSTEM_DISK=s3_public #PUBLIC_FILESYSTEM_DISK=s3_public
# -------------------------------------------- # --------------------------------------------
# REQUIRED: DATABASE SETTINGS # REQUIRED: DATABASE SETTINGS
# -------------------------------------------- # --------------------------------------------
@ -41,6 +42,7 @@ DB_SSL_KEY_PATH=null
DB_SSL_CERT_PATH=null DB_SSL_CERT_PATH=null
DB_SSL_CA_PATH=null DB_SSL_CA_PATH=null
DB_SSL_CIPHER=null DB_SSL_CIPHER=null
DB_SSL_VERIFY_SERVER=null
# -------------------------------------------- # --------------------------------------------
# REQUIRED: OUTGOING MAIL SERVER SETTINGS # REQUIRED: OUTGOING MAIL SERVER SETTINGS
@ -50,12 +52,16 @@ MAIL_HOST=127.0.0.1
MAIL_PORT=25 MAIL_PORT=25
MAIL_USERNAME=__APP__ MAIL_USERNAME=__APP__
MAIL_PASSWORD=__MAIL_PWD__ MAIL_PASSWORD=__MAIL_PWD__
MAIL_ENCRYPTION=null
MAIL_FROM_ADDR=__APP__@__DOMAIN__ MAIL_FROM_ADDR=__APP__@__DOMAIN__
MAIL_FROM_NAME='Snip-IT' MAIL_FROM_NAME='Snip-IT'
MAIL_REPLYTO_ADDR=__APP__@__DOMAIN__ MAIL_REPLYTO_ADDR=__APP__@__DOMAIN__
MAIL_REPLYTO_NAME='Snipe-IT' MAIL_REPLYTO_NAME='Snipe-IT'
MAIL_AUTO_EMBED_METHOD='attachment' MAIL_AUTO_EMBED_METHOD='attachment'
MAIL_TLS_VERIFY_PEER=true
# MAIL_ENCRYPTION is no longer supported. SymfonyMailer will use tls if it's
# advertised, and won't if it's not. If you want to use your mail server's IP but it's failing
# because of certificate errors, set MAIL_TLS_VERIFY_PEER-true
# -------------------------------------------- # --------------------------------------------
# REQUIRED: IMAGE LIBRARY # REQUIRED: IMAGE LIBRARY
@ -63,6 +69,7 @@ MAIL_AUTO_EMBED_METHOD='attachment'
# -------------------------------------------- # --------------------------------------------
IMAGE_LIB=gd IMAGE_LIB=gd
# -------------------------------------------- # --------------------------------------------
# OPTIONAL: BACKUP SETTINGS # OPTIONAL: BACKUP SETTINGS
# -------------------------------------------- # --------------------------------------------
@ -83,6 +90,8 @@ COOKIE_NAME=snipeit_session
COOKIE_DOMAIN=null COOKIE_DOMAIN=null
SECURE_COOKIES=false SECURE_COOKIES=false
API_TOKEN_EXPIRATION_YEARS=15 API_TOKEN_EXPIRATION_YEARS=15
BS_TABLE_STORAGE=cookieStorage
BS_TABLE_DEEPLINK=true
# -------------------------------------------- # --------------------------------------------
# OPTIONAL: SECURITY HEADER SETTINGS # OPTIONAL: SECURITY HEADER SETTINGS
@ -91,6 +100,7 @@ APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1
ALLOW_IFRAMING=false ALLOW_IFRAMING=false
REFERRER_POLICY=same-origin REFERRER_POLICY=same-origin
ENABLE_CSP=false ENABLE_CSP=false
ADDITIONAL_CSP_URLS=null
CORS_ALLOWED_ORIGINS=null CORS_ALLOWED_ORIGINS=null
ENABLE_HSTS=false ENABLE_HSTS=false
@ -146,6 +156,7 @@ AWS_DEFAULT_REGION=null
# -------------------------------------------- # --------------------------------------------
LOGIN_MAX_ATTEMPTS=5 LOGIN_MAX_ATTEMPTS=5
LOGIN_LOCKOUT_DURATION=60 LOGIN_LOCKOUT_DURATION=60
LOGIN_AUTOCOMPLETE=false
# -------------------------------------------- # --------------------------------------------
# OPTIONAL: FORGOTTEN PASSWORD SETTINGS # OPTIONAL: FORGOTTEN PASSWORD SETTINGS
@ -173,6 +184,15 @@ REQUIRE_SAML=false
API_THROTTLE_PER_MINUTE=120 API_THROTTLE_PER_MINUTE=120
CSV_ESCAPE_FORMULAS=true CSV_ESCAPE_FORMULAS=true
# --------------------------------------------
# OPTIONAL: HASHING
# --------------------------------------------
HASHING_DRIVER='bcrypt'
BCRYPT_ROUNDS=10
ARGON_MEMORY=1024
ARGON_THREADS=2
ARGON_TIME=2
# -------------------------------------------- # --------------------------------------------
# OPTIONAL: SCIM # OPTIONAL: SCIM
# -------------------------------------------- # --------------------------------------------

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2 packaging_format = 2
id = "snipeit" id = "snipeit"
@ -5,7 +7,7 @@ name = "Snipe-IT"
description.en = "Manage assets for IT operations" description.en = "Manage assets for IT operations"
description.fr = "Gestionnaire de ressources informatiques" description.fr = "Gestionnaire de ressources informatiques"
version = "6.4.2~ynh1" version = "7.0.9~ynh1"
maintainers = [] maintainers = []
@ -50,8 +52,8 @@ ram.runtime = "50M"
[resources] [resources]
[resources.sources] [resources.sources]
[resources.sources.main] [resources.sources.main]
url = "https://github.com/snipe/snipe-it/archive/refs/tags/v6.4.2.tar.gz" url = "https://github.com/snipe/snipe-it/archive/refs/tags/v7.0.9.tar.gz"
sha256 = "b2b3c9fa4501e0b81c41562db40798a786e92dd932e1de40bbc8e731c1474135" sha256 = "632ebcbd982da019eff6749b23c53b304b20b416cf1636e6e9cbd5bccf7e3367"
autoupdate.strategy = "latest_github_tag" autoupdate.strategy = "latest_github_tag"
[resources.system_user] [resources.system_user]
@ -63,7 +65,19 @@ ram.runtime = "50M"
main.url = "/" main.url = "/"
[resources.apt] [resources.apt]
packages = "mariadb-server, openssl, php8.1-curl, php8.1-ldap, php8.1-mysql, php8.1-gd, php8.1-xml, php8.1-mbstring, php8.1-zip, php8.1-bcmath, php8.1-redis" packages = [
"mariadb-server",
"openssl",
"php8.1-curl",
"php8.1-ldap",
"php8.1-mysql",
"php8.1-gd",
"php8.1-xml",
"php8.1-mbstring",
"php8.1-zip",
"php8.1-bcmath",
"php8.1-redis",
]
[resources.database] [resources.database]
type = "mysql" type = "mysql"

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
@ -22,19 +20,13 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC STARTING
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
@ -21,7 +19,14 @@ ynh_change_url_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_replace_string --match_string="APP_URL=https://$old_domain" --replace_string="APP_URL=https://$new_domain" --target_file=$install_dir/.env ynh_replace_string --target_file="$install_dir/.env" \
--match_string="APP_URL=https://$old_domain" \
--replace_string="APP_URL=https://$new_domain"
pushd "$install_dir"
ynh_exec_as "$app" "php$phpversion" artisan config:clear -n
ynh_exec_as "$app" "php$phpversion" artisan config:cache -n
popd
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
@ -10,7 +8,13 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) # INITIALIZE AND STORE SETTINGS
#=================================================
# fr -> fr-FR
language="${language}-${language^^}"
ynh_app_setting_set --app="$app" --key="language" --value="$language"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -18,7 +22,48 @@ ynh_script_progression --message="Setting up source files..." --weight=2
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
chown -R $app:www-data "$install_dir" chown -R "$app:www-data" "$install_dir"
# setup page tries to access https://$domain$path/.env and fails on self signed certs
ynh_replace_string --target_file="$install_dir/app/Http/Controllers/SettingsController.php" \
--match_string="->get(URL::to('.env'))" \
--replace_string="->withoutVerifying()->get(URL::to('.env'))"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding $app's configuration file..." --weight=1
app_key=""
ynh_add_config --template="snipeit.env" --destination="$install_dir/.env"
chmod 600 "$install_dir/.env"
chown "$app:$app" "$install_dir/.env"
#=================================================
# BUILDING
#=================================================
ynh_script_progression --message="Building $app..."
ynh_install_composer
# setup application config
pushd "$install_dir"
ynh_exec_as "$app" "php$phpversion" artisan key:generate -n --force --env
ynh_exec_as "$app" "php$phpversion" artisan migrate -n --force
ynh_exec_as "$app" "php$phpversion" artisan config:clear -n
ynh_exec_as "$app" "php$phpversion" artisan config:cache -n
popd
app_key="$(grep "^APP_KEY=" "$install_dir/.env" | cut -d= -f2)"
ynh_app_setting_set --app="$app" --key="app_key" --value="$app_key"
ynh_store_file_checksum --file="$install_dir/.env"
# Set permissions to app files
chown -R "$app:www-data" "$install_dir"
chmod -R o-rwx "$install_dir"
chmod -R 755 "$install_dir/storage"
chmod -R 755 "$install_dir/public/uploads"
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
@ -29,44 +74,6 @@ ynh_add_fpm_config
ynh_add_nginx_config ynh_add_nginx_config
ynh_install_composer
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
app_key=""
ynh_add_config --template="snipeit.env" --destination="$install_dir/.env"
chmod 600 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#=================================================
# BUILDING
#=================================================
ynh_script_progression --message="Building..."
# setup application config
pushd "$install_dir"
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
app_key="$(grep "^APP_KEY=" "$install_dir/.env" | cut -d= -f2)"
ynh_app_setting_set --app=$app --key=app_key --value=$app_key
ynh_store_file_checksum --file="$install_dir/.env"
# Set permissions to app files
chown -R $app:www-data $install_dir
chmod -R o-rwx $install_dir
chmod -R 755 $install_dir/storage
chmod -R 755 $install_dir/public/uploads
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
@ -18,14 +16,14 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the MySQL database..." ynh_script_progression --message="Restoring the MySQL database..."
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
#================================================= #=================================================
# RESTORE SYSTEM CONFIGURATIONS # RESTORE SYSTEM CONFIGURATIONS
@ -36,14 +34,12 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
@ -9,14 +7,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -28,21 +18,59 @@ if [ -z "$app_key" ]; then
ynh_app_setting_set --app=$app --key=app_key --value=$app_key ynh_app_setting_set --app=$app --key=app_key --value=$app_key
fi fi
#================================================= if (( ${#language} == 2 )); then
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN COMPOSER BUILD...) # fr -> fr-FR
language="${language}-${language^^}"
ynh_app_setting_set --app="$app" --key="language" --value="$language"
fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=7
if [ "$upgrade_type" == "UPGRADE_APP" ] # Download, check integrity, uncompress and patch the source from app.src
then ynh_setup_source --dest_dir="$install_dir" --keep=".env storage/oauth-private.key storage/oauth-public.key storage/private_uploads public/uploads"
ynh_script_progression --message="Upgrading source files..." --weight=7
# Download, check integrity, uncompress and patch the source from app.src chown -R "$app:www-data" "$install_dir"
ynh_setup_source --dest_dir="$install_dir" --keep=".env storage/oauth-private.key storage/oauth-public.key storage/private_uploads public/uploads"
fi
chown -R $app:www-data "$install_dir" # setup page tries to access https://$domain$path/.env and fails on self signed certs
ynh_replace_string --target_file="$install_dir/app/Http/Controllers/SettingsController.php" \
--match_string="->get(URL::to('.env'))" \
--replace_string="->withoutVerifying()->get(URL::to('.env'))"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_backup_if_checksum_is_different --file="$install_dir/.env"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$install_dir/.env"
# XXX: Regenerate .env instead ?
# ynh_add_config --template="snipeit.env" --destination="$install_dir/.env"
#=================================================
# BUILDING
#=================================================
ynh_script_progression --message="Building $app..."
ynh_install_composer
ynh_exec_warn_less ynh_composer_exec --commands="dump-autoload"
pushd "$install_dir"
ynh_exec_as "$app" "php$phpversion" artisan migrate -n --force
ynh_exec_as "$app" "php$phpversion" artisan config:clear -n
ynh_exec_as "$app" "php$phpversion" artisan config:cache -n
popd
# Set permissions on app files
chown -R "$app:www-data" "$install_dir"
chmod -R o-rwx "$install_dir"
chmod -R 755 "$install_dir/storage"
chmod -R 755 "$install_dir/public/uploads"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
@ -53,43 +81,6 @@ ynh_add_fpm_config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# INSTALL AND INITIALIZE COMPOSER
#=================================================
ynh_script_progression --message="Installing Composer..." --weight=15
ynh_install_composer
ynh_exec_warn_less ynh_composer_exec --commands="dump-autoload"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_backup_if_checksum_is_different --file="$install_dir/.env"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$install_dir/.env"
# XXX: Regenerate .env instead ?
# ynh_add_config --template="snipeit.env" --destination="$install_dir/.env"
#=================================================
# BUILDING
#=================================================
ynh_script_progression --message="Building..."
pushd "$install_dir"
php$phpversion artisan migrate -n --force
php$phpversion artisan config:clear -n
php$phpversion artisan config:cache -n
popd
# Set permissions on app files
chown -R $app:www-data $install_dir
chmod -R o-rwx $install_dir
chmod -R 755 $install_dir/storage
chmod -R 755 $install_dir/public/uploads
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================