From 0d2f5f5c4023eb245ca5b085fb2890cc5d7854af Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 29 Nov 2020 03:42:47 +0100 Subject: [PATCH] Fix install miserably failing + other weird stuff --- check_process | 11 ---------- scripts/install | 57 ++++++++++++++++++++++++------------------------- scripts/restore | 2 +- scripts/upgrade | 3 +-- 4 files changed, 30 insertions(+), 43 deletions(-) diff --git a/check_process b/check_process index 3ea4a37..fd6a678 100644 --- a/check_process +++ b/check_process @@ -20,17 +20,6 @@ incorrect_path=1 port_already_use=0 change_url=0 -;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto - Level 4=na - Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Upgrade options ; commit=546fd17712c7a9df428a4f26e7f8e4394884aaaf name=29 Jan 2019 diff --git a/scripts/install b/scripts/install index dad2fe0..c9f241b 100644 --- a/scripts/install +++ b/scripts/install @@ -104,6 +104,7 @@ ynh_app_setting_set --app=$app --key=domain --value="$domain" ynh_app_setting_set --app=$app --key=wifi_ssid --value="$wifi_ssid" ynh_app_setting_set --app=$app --key=wifi_passphrase --value="$wifi_passphrase" ynh_app_setting_set --app=$app --key=firmware_nonfree --value="$firmware_nonfree" +ynh_app_setting_set --app=$app --key=service_name --value=$service_name #================================================= # STANDARD MODIFICATIONS @@ -148,14 +149,6 @@ ynh_script_progression --message="Installing dependencies" ynh_install_app_dependencies "$pkg_dependencies" "$packages" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring nginx web server..." - -# Create a dedicated nginx config -ynh_add_nginx_config - #================================================= # CREATE DEDICATED USER #================================================= @@ -168,15 +161,6 @@ ynh_system_user_create --username=$app install -b -o root -g root -m 0440 ../conf/sudoers.conf /etc/sudoers.d/${app}_ynh ynh_replace_string --match_string="__HOTSPOT_SYSUSER__" --replace_string="${app}" --target_file="/etc/sudoers.d/${app}_ynh" -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring php-fpm..." - -# Create a dedicated php-fpm config -ynh_add_fpm_config -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - #================================================= # INSTALL CUSTOM SCRIPTS #================================================= @@ -220,7 +204,6 @@ ynh_app_setting_set --app=$app --key=ip4_dns0 --value=80.67.188.188 ynh_app_setting_set --app=$app --key=ip4_dns1 --value=80.67.169.12 ynh_app_setting_set --app=$app --key=ip4_nat_prefix --value=10.0.242 ynh_app_setting_set --app=$app --key=vpnclient --value=no -ynh_app_setting_set --app=$app --key=service_name --value=$service_name if [[ -z $wifi_device ]]; then ynh_app_setting_set --app=$app --key=service_enabled --value=0 @@ -243,12 +226,12 @@ install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq # Copy init script install -o root -g root -m 0755 ../conf/$service_name /usr/local/bin/ -ynh_replace_string --match_string="__PHPVERSION__" --replace_string="${phpversion}" --target_file="/usr/local/bin/$service_name" +ynh_replace_string --match_string="__PHPVERSION__" --replace_string="${YNH_PHP_VERSION}" --target_file="/usr/local/bin/$service_name" #================================================= # COPY WEB SOURCES #================================================= -ynh_script_progression --message="Copy web sources..." +ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path mkdir -pm 0755 ${final_path}/ @@ -259,9 +242,25 @@ chmod -R 0644 ${final_path}/* find ${final_path}/ -type d -exec chmod +x {} \; #================================================= -# FIX CONFIGS +# NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Fix config..." +ynh_script_progression --message="Configuring nginx web server..." + +# Create a dedicated nginx config +ynh_add_nginx_config + +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring php-fpm..." + +# Create a dedicated php-fpm config +ynh_add_fpm_config + +#================================================= +# CONFIGURE HOSTAPD +#================================================= +ynh_script_progression --message="Configuring hostapd..." ## hostapd ynh_replace_string --match_string="^DAEMON_CONF=$" --replace_string="&/etc/hostapd/hostapd.conf" --target_file=/etc/init.d/hostapd @@ -273,6 +272,13 @@ echo "DAEMON_CONF=/etc/hostapd/hostapd.conf" > /etc/default/hostapd # Fix sources ynh_replace_string --match_string="__PATH__" --replace_string="${path_url}" --target_file="$final_path/config.php" +# Set default inits +# The boot order of these services are important, so they are disabled by default +# and the ynh-hotspot service handles them. +systemctl disable hostapd --quiet +systemctl stop hostapd +systemctl unmask hostapd # On some system e.g. RPi, for some reason hostapd is masked after install ... + #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= @@ -290,13 +296,6 @@ ynh_script_progression --message="Configuring a systemd service..." # Create a dedicated systemd config ynh_add_systemd_config --service=$service_name -# Set default inits -# The boot order of these services are important, so they are disabled by default -# and the ynh-hotspot service handles them. -systemctl disable hostapd -systemctl stop hostapd -systemctl unmask hostapd # On some system e.g. RPi, for some reason hostapd is masked after install ... - # Remove IPv6 address set if there is a VPN installed if [[ $ip6_addr != none ]]; then if ip -6 address show dev tun0 2> /dev/null | grep -q "${ip6_addr}/"; then diff --git a/scripts/restore b/scripts/restore index 1a3be3a..de487bf 100644 --- a/scripts/restore +++ b/scripts/restore @@ -129,7 +129,7 @@ ynh_install_app_dependencies "$pkg_dependencies" "$packages" ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$service_name.service" -systemctl enable $service_name.service +systemctl enable $service_name.service --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index 166bdc2..59a7dfd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -36,7 +36,7 @@ upgrade_type=$(ynh_check_app_version_changed) ynh_script_progression --message="Ensuring downward compatibility..." if [ -z $phpversion ]; then - phpversion=7.0 + phpversion=$YNH_PHP_VERSION ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion fi @@ -144,7 +144,6 @@ ynh_script_progression --message="Upgrading php-fpm configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC UPGRADE