1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/domoticz_ynh.git synced 2024-09-03 18:26:17 +02:00

remove common.sh variables

This commit is contained in:
Krakinou 2023-06-01 23:25:39 +02:00
parent 47e2c52ca0
commit eea2a447ba
3 changed files with 12 additions and 13 deletions

View file

@ -4,6 +4,10 @@
# COMMON VARIABLES
#=================================================
lowercase(){
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -15,13 +15,9 @@ source /usr/share/yunohost/helpers
ynh_script_progression --message="Storing installation settings..."
#Will be used in restore script to check that we're restoring on the same OS/Board type
lowercase(){
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}
OS=`lowercase \`uname -s\``
mach=`uname -m`
if [ ${mach} = "armv6l" ]
if [ "${mach}" = "armv6l" ]
then
mach="armv7l"
fi
@ -166,7 +162,6 @@ if [ ! -f "$log_file" ]; then
chown $app: "$log_file"
fi
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="$log_file" --failregex="^.*Error: Failed login attempt from <HOST>.*$" --max_retry=5
#Not required in 2023.1 anymore

View file

@ -10,9 +10,13 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#Have to reload them as otherwise they are all the same
current_os=`lowercase \`uname -s\``
current_mach=`uname -m`
if [ ${current_mach} = "armv6l" ]
then
current_mach="armv7l"
fi
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -25,8 +29,8 @@ test "$OS" = "$current_os" \
test "$mach" = "$current_mach" \
|| ynh_die --message="Cannot restore : previous machine type is $mach, current machine type is $current_mach, please reinstall"
ynh_app_setting_set --app="$app" --key=OS --value="$OS"
ynh_app_setting_set --app="$app" --key=mach --value="$mach"
ynh_app_setting_set --app="$app" --key=OS --value="$current_os"
ynh_app_setting_set --app="$app" --key=mach --value="$current_mach"
#=================================================
# STANDARD RESTORATION STEPS
@ -69,10 +73,6 @@ chown -R "$app":"$app" "$install_dir"
#=================================================
if [ "$domain" != "$mqtt_domain" ]; then
ynh_script_progression --message="Reinstalling up mosquitto..." --weight=5
#Installing packages
ynh_install_extra_app_dependencies --repo="deb https://repo.mosquitto.org/debian buster main" --package="$extra_pkg_dependencies" --key="http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key"
#reinstalling settings
ynh_restore_file --origin_path="/etc/mosquitto/conf.d" --not_mandatory
fi