From eea2a447baa47f7a72f26360e2666b483197017b Mon Sep 17 00:00:00 2001 From: Krakinou Date: Thu, 1 Jun 2023 23:25:39 +0200 Subject: [PATCH] remove common.sh variables --- scripts/_common.sh | 4 ++++ scripts/install | 7 +------ scripts/restore | 14 +++++++------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..fc1c768 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,10 @@ # COMMON VARIABLES #================================================= +lowercase(){ + echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" +} + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 6fbb089..9bcdb2f 100755 --- a/scripts/install +++ b/scripts/install @@ -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 .*$" --max_retry=5 #Not required in 2023.1 anymore diff --git a/scripts/restore b/scripts/restore index b508e68..fafb142 100755 --- a/scripts/restore +++ b/scripts/restore @@ -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