1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/emailpoubelle_ynh.git synced 2024-09-03 18:26:29 +02:00
This commit is contained in:
ericgaspar 2021-11-10 08:24:44 +01:00
parent d72aadbfa6
commit 5bb36ed99f
3 changed files with 14 additions and 54 deletions

View file

@ -12,8 +12,8 @@
setup_root=1
setup_private=1
setup_public=1
# upgrade=1 from_commit=1d375c45011ad5ab92c038120c7275580479fbc6
upgrade=1
# upgrade=1 from_commit=1d375c45011ad5ab92c038120c7275580479fbc6
backup_restore=1
multi_instance=0
change_url=1

View file

@ -23,11 +23,12 @@ ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name)
admin=$(ynh_app_setting_get $app admin)
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)
db_user=$db_name
admin=$(ynh_app_setting_get --app=$app --key=admin)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -45,8 +46,9 @@ ynh_user_exists "$admin"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
@ -108,7 +110,7 @@ fi
#=================================================
ynh_script_progression --message="Reinstall cron job" --weight=1
ynh_restore_file "/etc/cron.d/$app"
ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION

View file

@ -21,6 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
#=================================================
# CHECK VERSION
@ -66,55 +67,12 @@ then
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
#check for matlink's version - DEPRECATED - uninstall & reinstall
#=================================================
#deprecated - not maintained for more than a year...
#cat /etc/yunohost/apps/$app/status.json | grep "matlink"
#if [[ $?==0 ]]; then
#add missing info in settings
# final_path=/var/www/$app
# db_name=emailPoubelle
# ynh_app_setting_set $app db_name $db_name
# ynh_app_setting_set $app final_path $final_path
#install geoip dependencies
# ynh_install_app_dependencies $pkg_dependencies
#install locale packages
# for i in $lang ; do
# ynh_replace_string "# $i" "$i" /etc/locale.gen
# done
# locale-gen
#change folder locale => lang as per src2.0
# rm -rf $final_path/locale
# mkdir -p $final_path/lang
#add new index.php
# cp ../conf/index_source.php $final_path/www/index.php
#switch from previous (modified) conf.php to new one (emailpoubelle original)
# cp ../src/conf-dist.php $final_path/conf-dist.new.php
#insert domain in line 24, DB in line 31, DBUSER in line 32, etc.
# rep=$(cat $final_path/conf.php | grep "^[^//]" | grep "define('DOMAIN',")
# sed -i "24s/.*/${rep}/" $final_path/conf-dist.new.php
# rep=$(cat $final_path/conf.php | grep "^[^//]" | grep "define('DB',")
# sed -i "31s/.*/${rep}/" $final_path/conf-dist.new.php
# rep=$(cat $final_path/conf.php | grep "^[^//]" | grep "define('DBUSER',")
# sed -i "32s/.*/${rep}/" $final_path/conf-dist.new.php
# rep=$(cat $final_path/conf.php | grep "^[^//]" | grep "define('DBPASS',")
# sed -i "33s/.*/${rep}/" $final_path/conf-dist.new.php
#replace old conf and process with install command
# mv $final_path/conf.php $final_path/conf.php.old
# mv $final_path/conf-dist.new.php $final_path/conf.php
# ynh_replace_string "define('DB', 'sqlite:'" "//define('DB', 'sqlite:'" $final_path/conf.php
# ynh_replace_string "define('ALIASLIMITBYMAIL" "//define('ALIASLIMITBYMAIL" $final_path/conf.php
# #setting conf file not world-readable (dude, there is a plain-text password !)
# sudo chmod o-r $final_path/conf.php
#fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..."
ynh_script_progression --message="Upgrading NGINX web server configuration..."
ynh_backup_if_checksum_is_different "/etc/nginx/conf.d/$domain.d/$app.conf"
@ -156,10 +114,10 @@ fi
#Temporaire - mettre en config
if [ ! -e $final_path/lang/fr_FR ]; then
ln -s $final_path/lang/fr $final_path/lang/fr_FR
ln -s $final_path/lang/fr $final_path/lang/fr_FR
fi
if [ ! -e $final_path/lang/it_IT ]; then
ln -s $final_path/lang/it $final_path/lang/it_IT
ln -s $final_path/lang/it $final_path/lang/it_IT
fi
#setting postfix to use virtual aliases file