mirror of
https://github.com/YunoHost-Apps/pihole_ynh.git
synced 2024-09-03 20:05:58 +02:00
Add progression bar
This commit is contained in:
parent
3b7e0608c4
commit
887e6fcc79
8 changed files with 190 additions and 1 deletions
|
@ -629,6 +629,84 @@ ynh_clean_check_starting () {
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Print a message as INFO and show progression during an app script
|
||||||
|
#
|
||||||
|
# usage: ynh_script_progression --message=message [--weight=weight] [--time]
|
||||||
|
# | arg: -m, --message= - The text to print
|
||||||
|
# | arg: -w, --weight= - The weight for this progression. This value is 1 by default. Use a bigger value for a longer part of the script.
|
||||||
|
# | arg: -t, --time= - Print the execution time since the last call to this helper. Especially usefull to define weights.
|
||||||
|
# | arg: -l, --last= - Use for the last call of the helper, to fill te progression bar.
|
||||||
|
increment_progression=0
|
||||||
|
previous_weight=0
|
||||||
|
# Define base_time when the file is sourced
|
||||||
|
base_time=$(date +%s)
|
||||||
|
ynh_script_progression () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
declare -Ar args_array=( [m]=message= [w]=weight= [t]=time [l]=last )
|
||||||
|
local message
|
||||||
|
local weight
|
||||||
|
local time
|
||||||
|
local last
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
weight=${weight:-1}
|
||||||
|
time=${time:-0}
|
||||||
|
last=${last:-0}
|
||||||
|
|
||||||
|
# Get execution time since the last $base_time
|
||||||
|
local exec_time=$(( $(date +%s) - $base_time ))
|
||||||
|
base_time=$(date +%s)
|
||||||
|
|
||||||
|
# Get the number of occurrences of 'ynh_script_progression' in the script. Except those are commented.
|
||||||
|
local helper_calls="$(grep --count "^[^#]*ynh_script_progression" $0)"
|
||||||
|
# Get the number of call with a weight value
|
||||||
|
local weight_calls=$(grep --perl-regexp --count "^[^#]*ynh_script_progression.*(--weight|-w )" $0)
|
||||||
|
|
||||||
|
# Get the weight of each occurrences of 'ynh_script_progression' in the script using --weight
|
||||||
|
local weight_valuesA="$(grep --perl-regexp "^[^#]*ynh_script_progression.*--weight" $0 | sed 's/.*--weight[= ]\([[:digit:]].*\)/\1/g')"
|
||||||
|
# Get the weight of each occurrences of 'ynh_script_progression' in the script using -w
|
||||||
|
local weight_valuesB="$(grep --perl-regexp "^[^#]*ynh_script_progression.*-w " $0 | sed 's/.*-w[= ]\([[:digit:]].*\)/\1/g')"
|
||||||
|
# Each value will be on a different line.
|
||||||
|
# Remove each 'end of line' and replace it by a '+' to sum the values.
|
||||||
|
local weight_values=$(( $(echo "$weight_valuesA" | tr '\n' '+') + $(echo "$weight_valuesB" | tr '\n' '+') 0 ))
|
||||||
|
|
||||||
|
# max_progression is a total number of calls to this helper.
|
||||||
|
# Less the number of calls with a weight value.
|
||||||
|
# Plus the total of weight values
|
||||||
|
local max_progression=$(( $helper_calls - $weight_calls + $weight_values ))
|
||||||
|
|
||||||
|
# Increment each execution of ynh_script_progression in this script by the weight of the previous call.
|
||||||
|
increment_progression=$(( $increment_progression + $previous_weight ))
|
||||||
|
# Store the weight of the current call in $previous_weight for next call
|
||||||
|
previous_weight=$weight
|
||||||
|
|
||||||
|
# Set the scale of the progression bar
|
||||||
|
local scale=20
|
||||||
|
# progress_string(1,2) should have the size of the scale.
|
||||||
|
local progress_string1="####################"
|
||||||
|
local progress_string0="...................."
|
||||||
|
|
||||||
|
# Reduce $increment_progression to the size of the scale
|
||||||
|
if [ $last -eq 0 ]
|
||||||
|
then
|
||||||
|
local effective_progression=$(( $increment_progression * $scale / $max_progression ))
|
||||||
|
# If last is specified, fill immediately the progression_bar
|
||||||
|
else
|
||||||
|
local effective_progression=$scale
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build $progression_bar from progress_string(1,2) according to $effective_progression
|
||||||
|
local progression_bar="${progress_string1:0:$effective_progression}${progress_string0:0:$(( $scale - $effective_progression ))}"
|
||||||
|
|
||||||
|
local print_exec_time=""
|
||||||
|
if [ $time -eq 1 ]
|
||||||
|
then
|
||||||
|
print_exec_time=" [$(date +%Hh%Mm,%Ss --date="0 + $exec_time sec")]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_print_info "[$progression_bar] > ${message}${print_exec_time}"
|
||||||
|
}
|
||||||
|
|
||||||
# Send an email to inform the administrator
|
# Send an email to inform the administrator
|
||||||
#
|
#
|
||||||
# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
|
# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
|
||||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Retrieve arguments from the manifest"
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
query_logging=$(ynh_app_setting_get $app query_logging)
|
query_logging=$(ynh_app_setting_get $app query_logging)
|
||||||
|
@ -33,6 +34,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESET THE CONFIG FILE
|
# RESET THE CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reset the config file $config_file" --weight=9
|
||||||
|
|
||||||
# Verify the checksum and backup the file if it's different
|
# Verify the checksum and backup the file if it's different
|
||||||
ynh_backup_if_checksum_is_different "$config_file"
|
ynh_backup_if_checksum_is_different "$config_file"
|
||||||
|
@ -60,9 +62,17 @@ then
|
||||||
# Get the default file and overwrite the current config
|
# Get the default file and overwrite the current config
|
||||||
cp /etc/yunohost/apps/$app/conf/pihole-FTL.conf "$config_file"
|
cp /etc/yunohost/apps/$app/conf/pihole-FTL.conf "$config_file"
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restart PiHole" --weight=2
|
||||||
|
|
||||||
# Restart pihole-FTL
|
# Restart pihole-FTL
|
||||||
ynh_systemd_action --action=restart --service_name=pihole-FTL
|
ynh_systemd_action --action=restart --service_name=pihole-FTL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum "$config_file"
|
ynh_store_file_checksum "$config_file"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Execution completed" --last
|
||||||
|
|
|
@ -19,6 +19,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Load settings" --weight=2
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ domain=$(ynh_app_setting_get $app domain)
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MAIN APP DIRECTORIES
|
# BACKUP THE MAIN APP DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backup the app main directories" --weight=5
|
||||||
|
|
||||||
CHECK_SIZE "$final_path"
|
CHECK_SIZE "$final_path"
|
||||||
ynh_backup "$final_path"
|
ynh_backup "$final_path"
|
||||||
|
@ -47,12 +49,14 @@ ynh_backup "/opt/pihole"
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP NGINX CONFIGURATION
|
# BACKUP NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backup nginx configuration"
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP PHP-FPM CONFIGURATION
|
# BACKUP PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backup php-fpm configuration"
|
||||||
|
|
||||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
|
@ -61,12 +65,14 @@ ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP CRON FILE
|
# BACKUP CRON FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backup cron file"
|
||||||
|
|
||||||
ynh_backup "/etc/cron.d/pihole"
|
ynh_backup "/etc/cron.d/pihole"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SPECIFIC FILES
|
# BACKUP SPECIFIC FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backup specific files"
|
||||||
|
|
||||||
ynh_backup "/usr/local/bin/pihole"
|
ynh_backup "/usr/local/bin/pihole"
|
||||||
ynh_backup "/etc/bash_completion.d/pihole"
|
ynh_backup "/etc/bash_completion.d/pihole"
|
||||||
|
@ -88,3 +94,9 @@ if test -e "/etc/dnsmasq.d/04-pihole-static-dhcp.conf"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_backup "/usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app"
|
ynh_backup "/usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Backup completed" --last
|
||||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Retrieve arguments from the manifest"
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
old_path=$YNH_APP_OLD_PATH
|
old_path=$YNH_APP_OLD_PATH
|
||||||
|
@ -24,12 +25,14 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Load settings" --weight=2
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE SYNTAX OF THE PATHS
|
# CHECK THE SYNTAX OF THE PATHS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Check the syntax of the paths"
|
||||||
|
|
||||||
test -n "$old_path" || old_path="/"
|
test -n "$old_path" || old_path="/"
|
||||||
test -n "$new_path" || new_path="/"
|
test -n "$new_path" || new_path="/"
|
||||||
|
@ -39,6 +42,7 @@ old_path=$(ynh_normalize_url_path $old_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE MAINTENANCE MODE
|
# ACTIVATE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Activate maintenance mode"
|
||||||
|
|
||||||
path_url=$old_path
|
path_url=$old_path
|
||||||
domain=$old_domain
|
domain=$old_domain
|
||||||
|
@ -72,6 +76,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Modify url in nginx configuration" --weight=4
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
@ -108,13 +113,21 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reload nginx"
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --action=reload --service_name=nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Disable maintenance mode" --weight=5
|
||||||
|
|
||||||
path_url=$old_path
|
path_url=$old_path
|
||||||
domain=$old_domain
|
domain=$old_domain
|
||||||
ynh_maintenance_mode_OFF
|
ynh_maintenance_mode_OFF
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Change of url completed" --last
|
||||||
|
|
|
@ -21,6 +21,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Retrieve arguments from the manifest"
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
|
@ -33,6 +34,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Check if the app can be installed"
|
||||||
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
@ -46,6 +48,7 @@ ynh_webpath_register $app $domain $path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Store settings from manifest" --weight=3
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
|
@ -62,6 +65,7 @@ ynh_app_setting_set $app overwrite_phpfpm "1"
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Find and open a free port" --weight=12
|
||||||
|
|
||||||
# Find a free port
|
# Find a free port
|
||||||
port=$(ynh_find_port 4711)
|
port=$(ynh_find_port 4711)
|
||||||
|
@ -80,12 +84,14 @@ ynh_exec_fully_quiet yunohost firewall allow Both 53 --no-upnp
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Install dependencies" --weight=12
|
||||||
|
|
||||||
ynh_install_app_dependencies $app_depencencies
|
ynh_install_app_dependencies $app_depencencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Download, check and unpack source" --weight=4
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set $app final_path $final_path
|
||||||
# Make a copy of local pihole repository (for Gravity)
|
# Make a copy of local pihole repository (for Gravity)
|
||||||
|
@ -97,6 +103,7 @@ ynh_setup_source "$final_path" admin_dashboard
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configure nginx" --weight=2
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -104,6 +111,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Create a dedicated user" --weight=2
|
||||||
|
|
||||||
# Create a dedicated system user
|
# Create a dedicated system user
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
@ -111,6 +119,7 @@ ynh_system_user_create $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configure php-fpm" --weight=2
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
@ -120,6 +129,7 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DIRECTORIES AND POPULATE THEM
|
# CREATE DIRECTORIES AND POPULATE THEM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Create and populate directories"
|
||||||
|
|
||||||
pihole_storage="/etc/pihole"
|
pihole_storage="/etc/pihole"
|
||||||
mkdir -p "$pihole_storage"
|
mkdir -p "$pihole_storage"
|
||||||
|
@ -138,6 +148,7 @@ cp -a "$pihole_local_repo/advanced/Scripts/COL_TABLE" "$pihole_dir/"
|
||||||
#=================================================
|
#=================================================
|
||||||
# COPY PI-HOLE MAIN SCRIPT
|
# COPY PI-HOLE MAIN SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Copy Pi-Hole main script"
|
||||||
|
|
||||||
cp -a "$pihole_local_repo/pihole" /usr/local/bin/
|
cp -a "$pihole_local_repo/pihole" /usr/local/bin/
|
||||||
cp -a "$pihole_local_repo/advanced/bash-completion/pihole" /etc/bash_completion.d/pihole
|
cp -a "$pihole_local_repo/advanced/bash-completion/pihole" /etc/bash_completion.d/pihole
|
||||||
|
@ -171,6 +182,7 @@ sed -i "/# su #/d;" "$pihole_storage/logrotate"
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALLATION OF PIHOLE-FTL
|
# INSTALLATION OF PIHOLE-FTL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Install PiHole-FTL" --weight=30
|
||||||
|
|
||||||
# Get the source of Pi-Hole-FTL
|
# Get the source of Pi-Hole-FTL
|
||||||
FTL_temp_path=$(mktemp -d)
|
FTL_temp_path=$(mktemp -d)
|
||||||
|
@ -217,6 +229,7 @@ ynh_store_file_checksum "$setupVars"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET UP DNSMASQ CONFIG
|
# SET UP DNSMASQ CONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Set up Dnsmasq config" --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --action=stop --service_name=dnsmasq
|
ynh_systemd_action --action=stop --service_name=dnsmasq
|
||||||
|
|
||||||
|
@ -246,6 +259,7 @@ ynh_replace_string "^cache-size=" "#pihole# cache-size=" /etc/dnsmasq.conf
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE DNS FOR THE LOCAL DOMAINS
|
# CONFIGURE DNS FOR THE LOCAL DOMAINS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configure dns for the local domains" --weight=7
|
||||||
|
|
||||||
# Find the IP associated to the network interface
|
# Find the IP associated to the network interface
|
||||||
localipv4=$(ip address | grep "${main_iface}\$" | awk '{print $2;}' | cut -d/ -f1)
|
localipv4=$(ip address | grep "${main_iface}\$" | awk '{print $2;}' | cut -d/ -f1)
|
||||||
|
@ -267,6 +281,7 @@ done <<< "$(yunohost domain list | grep "\." | sed 's/.*: \|.*- //')"
|
||||||
|
|
||||||
if [ $enable_dhcp -eq 1 ]
|
if [ $enable_dhcp -eq 1 ]
|
||||||
then
|
then
|
||||||
|
ynh_script_progression --message="Enable dhcp server"
|
||||||
max_dhcp_range=250
|
max_dhcp_range=250
|
||||||
dhcp_range=100
|
dhcp_range=100
|
||||||
# Define the dhcp range from the current ip
|
# Define the dhcp range from the current ip
|
||||||
|
@ -301,6 +316,7 @@ ynh_exec_fully_quiet yunohost firewall allow UDP 67 --no-upnp
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTART DNSMASQ
|
# RESTART DNSMASQ
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restart Dnsmasq" --time --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=dnsmasq
|
ynh_systemd_action --action=restart --service_name=dnsmasq
|
||||||
|
|
||||||
|
@ -315,6 +331,7 @@ ynh_replace_string ".*updatechecker.*" "#&" /etc/cron.d/pihole
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILD THE LISTS WITH GRAVITY
|
# BUILD THE LISTS WITH GRAVITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Build the lists with Gravity" --weight=7
|
||||||
|
|
||||||
cp "$pihole_local_repo/adlists.default" "$pihole_storage/adlists.default"
|
cp "$pihole_local_repo/adlists.default" "$pihole_storage/adlists.default"
|
||||||
ynh_exec_warn_less /opt/pihole/gravity.sh
|
ynh_exec_warn_less /opt/pihole/gravity.sh
|
||||||
|
@ -322,6 +339,7 @@ ynh_exec_warn_less /opt/pihole/gravity.sh
|
||||||
#=================================================
|
#=================================================
|
||||||
# START PIHOLE-FTL
|
# START PIHOLE-FTL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restart PiHole-FTL" --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=pihole-FTL
|
ynh_systemd_action --action=restart --service_name=pihole-FTL
|
||||||
|
|
||||||
|
@ -342,12 +360,14 @@ yunohost service add pihole-FTL --log "/var/log/pihole-FTL.log"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTRAIN THE ACCESS TO THE ADMIN ONLY
|
# RESTRAIN THE ACCESS TO THE ADMIN ONLY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restrain the access to the admin only" --weight=2
|
||||||
|
|
||||||
yunohost app addaccess --users=$admin $app
|
yunohost app addaccess --users=$admin $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reload nginx" --weight=4
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --action=reload --service_name=nginx
|
||||||
|
|
||||||
|
@ -372,5 +392,8 @@ message="${dhcp_alert}You can configure this app easily by using the experimenta
|
||||||
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
|
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
|
||||||
|
|
||||||
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/pihole_ynh"
|
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/pihole_ynh"
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="$message" --recipients="$admin" --type="install"
|
ynh_script_progression --message="Installation completed" --last
|
||||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Load settings" --weight=2
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP PIHOLE-FTL SERVICE
|
# STOP PIHOLE-FTL SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stop and remove the service"
|
||||||
|
|
||||||
ynh_systemd_action --action=stop --service_name=pihole-FTL
|
ynh_systemd_action --action=stop --service_name=pihole-FTL
|
||||||
ynh_exec_warn_less systemctl disable pihole-FTL
|
ynh_exec_warn_less systemctl disable pihole-FTL
|
||||||
|
@ -42,6 +44,7 @@ rm -f "/etc/init.d/pihole-FTL" "/usr/bin/pihole-FTL" "/var/run/pihole-FTL.pid" "
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Remove dependencies" --weight=7
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
@ -49,6 +52,7 @@ ynh_remove_app_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE DIRECTORIES OF THE APP
|
# REMOVE THE DIRECTORIES OF THE APP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Remove app main directories"
|
||||||
|
|
||||||
# Remove storage directory
|
# Remove storage directory
|
||||||
ynh_secure_remove "/etc/pihole"
|
ynh_secure_remove "/etc/pihole"
|
||||||
|
@ -62,6 +66,7 @@ ynh_secure_remove "/etc/.pihole"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Remove nginx configuration"
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -69,6 +74,7 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Remove php-fpm configuration" --weight=2
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated php-fpm config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
@ -76,6 +82,7 @@ ynh_remove_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CLOSE PORTS
|
# CLOSE PORTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Close ports" --weight=13
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
then
|
then
|
||||||
|
@ -115,6 +122,7 @@ ynh_secure_remove "/etc/sudoers.d/pihole"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DNSMASQ CONFIG
|
# REMOVE DNSMASQ CONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Remove Dnsmasq config" --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --action=stop --service_name=dnsmasq
|
ynh_systemd_action --action=stop --service_name=dnsmasq
|
||||||
rm -f "/etc/dnsmasq.d/01-pihole.conf"
|
rm -f "/etc/dnsmasq.d/01-pihole.conf"
|
||||||
|
@ -127,6 +135,7 @@ ynh_replace_string "#pihole# " "" /etc/dnsmasq.conf
|
||||||
#=================================================
|
#=================================================
|
||||||
# CLEAN /etc/hosts
|
# CLEAN /etc/hosts
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Clean /etc/hosts"
|
||||||
|
|
||||||
# Uncomment lines in /etc/hosts
|
# Uncomment lines in /etc/hosts
|
||||||
sed -i "s/#Commented by pihole# //g" /etc/hosts
|
sed -i "s/#Commented by pihole# //g" /etc/hosts
|
||||||
|
@ -137,6 +146,7 @@ sed -i "/#Added by pihole#/d" /etc/hosts
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTART DNSMASQ
|
# RESTART DNSMASQ
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restart Dnsmasq"
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=dnsmasq
|
ynh_systemd_action --action=restart --service_name=dnsmasq
|
||||||
|
|
||||||
|
@ -151,5 +161,12 @@ ynh_secure_remove /usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Remove the dedicated user" --weight=2
|
||||||
|
|
||||||
ynh_system_user_delete $app
|
ynh_system_user_delete $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Deletion completed" --last
|
||||||
|
|
|
@ -21,6 +21,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Load settings" --weight=2
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -42,6 +43,7 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE MAINTENANCE MODE
|
# ACTIVATE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Activate maintenance mode" --weight=2
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
|
@ -56,6 +58,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MAIN DIRECTORIES OF THE APP
|
# RESTORE THE MAIN DIRECTORIES OF THE APP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restore the app main directories"
|
||||||
|
|
||||||
ynh_restore_file "$final_path"
|
ynh_restore_file "$final_path"
|
||||||
|
|
||||||
|
@ -68,6 +71,7 @@ ynh_restore_file "/opt/pihole"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Recreate the dedicated user" --weight=2
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
@ -90,6 +94,7 @@ ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reinstall dependencies" --weight=12
|
||||||
|
|
||||||
ynh_install_app_dependencies $app_depencencies
|
ynh_install_app_dependencies $app_depencencies
|
||||||
|
|
||||||
|
@ -117,6 +122,7 @@ chown $dnsmasq_user:root /var/log/pihole.log
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SPECIFIC FILES
|
# RESTORE SPECIFIC FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restore specific files"
|
||||||
|
|
||||||
ynh_restore_file "/usr/local/bin/pihole"
|
ynh_restore_file "/usr/local/bin/pihole"
|
||||||
ynh_restore_file "/etc/bash_completion.d/pihole"
|
ynh_restore_file "/etc/bash_completion.d/pihole"
|
||||||
|
@ -131,6 +137,7 @@ ynh_restore_file "/usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE DNSMASQ CONFIG
|
# RESTORE DNSMASQ CONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restore Dnsmasq config"
|
||||||
|
|
||||||
ynh_systemd_action --action=stop --service_name=dnsmasq
|
ynh_systemd_action --action=stop --service_name=dnsmasq
|
||||||
|
|
||||||
|
@ -148,6 +155,7 @@ ynh_replace_string "^cache-size=" "#pihole# cache-size=" /etc/dnsmasq.conf
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE DNS FOR THE LOCAL DOMAINS
|
# CONFIGURE DNS FOR THE LOCAL DOMAINS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configure dns for the local domains" --weight=2
|
||||||
|
|
||||||
# Get the default network interface
|
# Get the default network interface
|
||||||
main_iface=$(ip route | grep --max-count=1 default | awk '{print $5;}')
|
main_iface=$(ip route | grep --max-count=1 default | awk '{print $5;}')
|
||||||
|
@ -168,6 +176,7 @@ done <<< "$(yunohost domain list | grep "\." | sed 's/.*: \|.*- //')"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTART DNSMASQ
|
# RESTART DNSMASQ
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restart Dnsmasq"
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=dnsmasq
|
ynh_systemd_action --action=restart --service_name=dnsmasq
|
||||||
|
|
||||||
|
@ -187,6 +196,7 @@ ynh_store_file_checksum "$setupVars"
|
||||||
#=================================================
|
#=================================================
|
||||||
# START PIHOLE-FTL
|
# START PIHOLE-FTL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restart PiHole-FTL" --weight=2
|
||||||
|
|
||||||
ynh_exec_warn_less systemctl enable pihole-FTL
|
ynh_exec_warn_less systemctl enable pihole-FTL
|
||||||
ynh_systemd_action --action=restart --service_name=pihole-FTL
|
ynh_systemd_action --action=restart --service_name=pihole-FTL
|
||||||
|
@ -196,6 +206,7 @@ ynh_systemd_action --action=restart --service_name=pihole-FTL
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reload nginx and php-fpm"
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=php5-fpm
|
ynh_systemd_action --action=reload --service_name=php5-fpm
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --action=reload --service_name=nginx
|
||||||
|
@ -203,6 +214,7 @@ ynh_systemd_action --action=reload --service_name=nginx
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Disable maintenance mode" --weight=4
|
||||||
|
|
||||||
ynh_maintenance_mode_OFF
|
ynh_maintenance_mode_OFF
|
||||||
|
|
||||||
|
@ -229,3 +241,9 @@ You can also find some specific actions for this app by using the experimental a
|
||||||
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/pihole_ynh"
|
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/pihole_ynh"
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="$message" --recipients="$admin" --type="restore"
|
ynh_send_readme_to_admin --app_message="$message" --recipients="$admin" --type="restore"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restoration completed" --last
|
||||||
|
|
|
@ -14,6 +14,7 @@ source _variables
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Load settings" --weight=3
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@ upgrade_type=$(ynh_check_app_version_changed)
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Ensure downward compatibility"
|
||||||
|
|
||||||
# If overwrite_setupvars doesn't exist, create it
|
# If overwrite_setupvars doesn't exist, create it
|
||||||
if [ -z "$overwrite_setupvars" ]; then
|
if [ -z "$overwrite_setupvars" ]; then
|
||||||
|
@ -66,6 +68,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backup the app before upgrading" --weight=7
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -86,6 +89,7 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE MAINTENANCE MODE
|
# ACTIVATE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Activate maintenance mode"
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
|
@ -94,6 +98,7 @@ ynh_maintenance_mode_ON
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrade dependencies" --weight=6
|
||||||
|
|
||||||
ynh_install_app_dependencies $app_depencencies
|
ynh_install_app_dependencies $app_depencencies
|
||||||
|
|
||||||
|
@ -104,6 +109,7 @@ ynh_install_app_dependencies $app_depencencies
|
||||||
pihole_local_repo="/etc/.pihole"
|
pihole_local_repo="/etc/.pihole"
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
|
ynh_script_progression --message="Download, check and unpack source" --weight=4
|
||||||
# Update the local copy pihole repository (for Gravity)
|
# Update the local copy pihole repository (for Gravity)
|
||||||
ynh_setup_source "$pihole_local_repo"
|
ynh_setup_source "$pihole_local_repo"
|
||||||
# Update admin dashboard
|
# Update admin dashboard
|
||||||
|
@ -117,6 +123,7 @@ fi
|
||||||
# Overwrite the nginx configuration only if it's allowed
|
# Overwrite the nginx configuration only if it's allowed
|
||||||
if [ $overwrite_nginx -eq 1 ]
|
if [ $overwrite_nginx -eq 1 ]
|
||||||
then
|
then
|
||||||
|
ynh_script_progression --message="Reconfigure nginx" --weight=2
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
fi
|
fi
|
||||||
|
@ -124,6 +131,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Create a dedicated user"
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
@ -135,6 +143,7 @@ ynh_system_user_create $app
|
||||||
# Overwrite the php-fpm configuration only if it's allowed
|
# Overwrite the php-fpm configuration only if it's allowed
|
||||||
if [ $overwrite_phpfpm -eq 1 ]
|
if [ $overwrite_phpfpm -eq 1 ]
|
||||||
then
|
then
|
||||||
|
ynh_script_progression --message="Reconfigure php-fpm" --weight=3
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
fi
|
fi
|
||||||
|
@ -155,6 +164,7 @@ cp -a "$pihole_local_repo/advanced/Scripts/COL_TABLE" "$pihole_dir/"
|
||||||
#=================================================
|
#=================================================
|
||||||
# COPY PI-HOLE MAIN SCRIPT
|
# COPY PI-HOLE MAIN SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Copy Pi-Hole main script"
|
||||||
|
|
||||||
cp -a "$pihole_local_repo/pihole" /usr/local/bin/
|
cp -a "$pihole_local_repo/pihole" /usr/local/bin/
|
||||||
cp -a "$pihole_local_repo/advanced/bash-completion/pihole" /etc/bash_completion.d/pihole
|
cp -a "$pihole_local_repo/advanced/bash-completion/pihole" /etc/bash_completion.d/pihole
|
||||||
|
@ -180,6 +190,7 @@ sed -i "/# su #/d;" "$pihole_storage/logrotate"
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE PIHOLE-FTL
|
# UPDATE PIHOLE-FTL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrade PiHole-FTL" --weight=35
|
||||||
|
|
||||||
ynh_systemd_action --action=stop --service_name=pihole-FTL
|
ynh_systemd_action --action=stop --service_name=pihole-FTL
|
||||||
|
|
||||||
|
@ -252,6 +263,7 @@ ynh_replace_string ".*updatechecker.*" "#&" /etc/cron.d/pihole
|
||||||
#=================================================
|
#=================================================
|
||||||
# START PIHOLE-FTL
|
# START PIHOLE-FTL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restart PiHole-FTL" --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=pihole-FTL
|
ynh_systemd_action --action=restart --service_name=pihole-FTL
|
||||||
|
|
||||||
|
@ -264,12 +276,14 @@ cp ../conf/dnsmasq_regenconf_hook /usr/share/yunohost/hooks/conf_regen/50-dnsmas
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reload nginx"
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --action=reload --service_name=nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Disable maintenance mode" --weight=5
|
||||||
|
|
||||||
ynh_maintenance_mode_OFF
|
ynh_maintenance_mode_OFF
|
||||||
|
|
||||||
|
@ -294,5 +308,9 @@ message="${dhcp_alert}You can configure this app easily by using the experimenta
|
||||||
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
|
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
|
||||||
|
|
||||||
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/pihole_ynh"
|
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/pihole_ynh"
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="$message" --recipients="$admin" --type="upgrade"
|
ynh_send_readme_to_admin --app_message="$message" --recipients="$admin" --type="upgrade"
|
||||||
|
ynh_script_progression --message="Upgrade completed" --last
|
||||||
|
|
Loading…
Add table
Reference in a new issue