mirror of
https://github.com/YunoHost-Apps/emailpoubelle_ynh.git
synced 2024-09-03 18:26:29 +02:00
Update with check_process & package_linter
This commit is contained in:
parent
61378665fe
commit
b8ec4d7595
3 changed files with 87 additions and 2 deletions
11
.project
Normal file
11
.project
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>poubelle_ynh</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
</natures>
|
||||
</projectDescription>
|
38
check_process
Normal file
38
check_process
Normal file
|
@ -0,0 +1,38 @@
|
|||
;; Complete Test
|
||||
# Comment ignored
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/poubelle" (PATH)
|
||||
admin="john" (USER)
|
||||
is_public=0 (PUBLIC|public=1|private=0)
|
||||
password="password"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
incorrect_path=1
|
||||
port_already_use=0 (XXXX)
|
||||
change_url=0
|
||||
;;; Levels
|
||||
Level 1=auto
|
||||
Level 2=auto
|
||||
Level 3=auto
|
||||
Level 4=0
|
||||
Level 5=auto
|
||||
Level 6=auto
|
||||
Level 7=auto
|
||||
Level 8=0
|
||||
Level 9=0
|
||||
Level 10=0
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
# ; commit=65c382d138596fcb32b4c97c39398815a1dcd4e8
|
||||
name=Name of this previous version
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=0&
|
|
@ -7,19 +7,46 @@
|
|||
#=================================================
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
admin=$(ynh_app_setting_get $app admin)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
db_name=$(ynh_app_setting_get $app db_name)
|
||||
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
|
||||
#=================================================
|
||||
#check for matlink's version
|
||||
#=================================================
|
||||
|
||||
cat /etc/yunohost/apps/$app/status.json | grep "matlink"
|
||||
if [[ $?==0 ]]; then
|
||||
#add missing info in settings
|
||||
|
@ -61,6 +88,11 @@ if [[ $?==0 ]]; then
|
|||
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
#change nginx.conf as per https://forum.yunohost.org/t/need-help-on-nginx-conf-cannot-access-resources/6342
|
||||
ynh_replace_string "alias $finalpath/www/ ;" "alias $finalpath/ ;" /etc/yunohost/$domain.d/$app.conf
|
||||
ynh_replace_string "index index.php;" "index www/ndex.php;" /etc/yunohost/$domain.d/$app.conf
|
||||
|
@ -68,6 +100,8 @@ ynh_replace_string "index index.php;" "index www/ndex.php;" /etc/yunohost/$domai
|
|||
#correct template name in index.php
|
||||
ynh_replace_string "Template-exemple" "$domain" $final_path/www/index.php
|
||||
|
||||
|
||||
|
||||
#mysqlpwd setting was implemented in ynh2 - check if saved and if not implement
|
||||
db_pass=$(ynh_app_setting_get $app mysqlpwd)
|
||||
if [ -z $db_pass]; then
|
||||
|
@ -106,7 +140,9 @@ chown -R www-data:www-data $final_path
|
|||
#sudo echo "$cronline" | sudo tee -a /etc/cron.d/emailpoubelle
|
||||
#sudo chmod 644 /etc/cron.d/emailpoubelle
|
||||
|
||||
# Restart services
|
||||
#=================================================
|
||||
# RELOAD SERVICES
|
||||
#=================================================
|
||||
systemctl restart php7.0-fpm
|
||||
systemctl reload nginx
|
||||
systemctl reload postfix
|
||||
|
|
Loading…
Reference in a new issue