1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hotspot_ynh.git synced 2024-09-03 19:25:53 +02:00

Fix install miserably failing + other weird stuff

This commit is contained in:
Alexandre Aubin 2020-11-29 03:42:47 +01:00
parent dc7139bed4
commit 0d2f5f5c40
4 changed files with 30 additions and 43 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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