mirror of
https://github.com/YunoHost-Apps/pihole_ynh.git
synced 2024-09-03 20:05:58 +02:00
English translation and typo
This commit is contained in:
parent
0478648b33
commit
e9a1e9b326
5 changed files with 117 additions and 92 deletions
|
@ -29,7 +29,7 @@ domain=$(ynh_app_setting_get $app domain)
|
|||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
#=================================================
|
||||
# BACKUP OF THE MAIN DIRECTORIES OF THE APP
|
||||
# BACKUP THE MAIN APP DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
CHECK_SIZE "$final_path"
|
||||
|
@ -45,13 +45,13 @@ CHECK_SIZE "/opt/pihole"
|
|||
ynh_backup "/opt/pihole"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE NGINX CONFIGURATION
|
||||
# BACKUP NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE PHP-FPM CONFIGURATION
|
||||
# BACKUP PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
||||
|
@ -59,13 +59,13 @@ ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
|||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP OF THE CRON FILE
|
||||
# BACKUP CRON FILE
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/cron.d/pihole"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF SPECIFIC FILES
|
||||
# BACKUP SPECIFIC FILES
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/usr/local/bin/pihole"
|
||||
|
|
|
@ -15,7 +15,8 @@ source _variables
|
|||
# MANAGE FAILURE OF THE SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
|
@ -62,16 +63,17 @@ ynh_app_setting_set $app overwrite_phpfpm "1"
|
|||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
|
||||
port=$(ynh_find_port 4711) # Cherche un port libre.
|
||||
# Find a free port
|
||||
port=$(ynh_find_port 4711)
|
||||
if [ $port -gt 4720 ]
|
||||
then
|
||||
ynh_die "The ports 4711 to 4720 are already in use. Pi-hole can't works on another port. Please try to free one of this ports."
|
||||
fi
|
||||
# Ouvre le port dans le firewall
|
||||
# Open this port
|
||||
ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port
|
||||
ynh_app_setting_set $app port $port
|
||||
|
||||
# Désactive le port 53 en upnp
|
||||
# Disable the port 53 for upnp
|
||||
ynh_exec_fully_quiet yunohost firewall disallow Both 53 --no-reload
|
||||
ynh_exec_fully_quiet yunohost firewall allow Both 53 --no-upnp
|
||||
|
||||
|
@ -86,34 +88,37 @@ ynh_install_app_dependencies $app_depencencies
|
|||
#=================================================
|
||||
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
# Créer une copie du repo de pihole (nécessaire pour Gravity)
|
||||
# Make a copy of local pihole repository (for Gravity)
|
||||
pihole_local_repo="/etc/.pihole"
|
||||
ynh_setup_source "$pihole_local_repo"
|
||||
# Installe le dashboard admin
|
||||
# Install admin dashboard
|
||||
ynh_setup_source "$final_path" admin_dashboard
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_create $app # Créer un utilisateur système dédié à l'app
|
||||
# Create a dedicated system user
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure.
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# CREATE THE DIRECTORIES AND POPULATE THEM
|
||||
# CREATE DIRECTORIES AND POPULATE THEM
|
||||
#=================================================
|
||||
|
||||
pihole_storage="/etc/pihole"
|
||||
|
@ -123,7 +128,7 @@ chown $app: -R "$pihole_storage"
|
|||
pihole_dir="/opt/pihole"
|
||||
mkdir -p "$pihole_dir"
|
||||
|
||||
# Copie les scripts de Pi-hole
|
||||
# Make a copy of Pi-Hole scripts
|
||||
cp -a "$pihole_local_repo/gravity.sh" "$pihole_dir/"
|
||||
cp -a $pihole_local_repo/advanced/Scripts/*.sh "$pihole_dir/"
|
||||
|
||||
|
@ -131,7 +136,7 @@ cp -a $pihole_local_repo/advanced/Scripts/*.sh "$pihole_dir/"
|
|||
cp -a "$pihole_local_repo/advanced/Scripts/COL_TABLE" "$pihole_dir/"
|
||||
|
||||
#=================================================
|
||||
# COPY THE PI-HOLE MAIN SCRIPT
|
||||
# COPY PI-HOLE MAIN SCRIPT
|
||||
#=================================================
|
||||
|
||||
cp -a "$pihole_local_repo/pihole" /usr/local/bin/
|
||||
|
@ -150,7 +155,7 @@ chown $dnsmasq_user:root /var/log/pihole.log
|
|||
# CREATE SUDOER FILE
|
||||
#=================================================
|
||||
|
||||
# Cette configuration sudoers autorise pihole à exécuter /usr/local/bin/pihole en root sans mot de passe. Pas plus.
|
||||
# This sudoers config allow pihole to execute /usr/local/bin/pihole as root without password. Nothing more.
|
||||
cp "$pihole_local_repo/advanced/pihole.sudo" /etc/sudoers.d/pihole
|
||||
echo "$app ALL=NOPASSWD: /usr/local/bin/pihole" >> /etc/sudoers.d/pihole
|
||||
# echo "Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin" >> /etc/sudoers.d/pihole
|
||||
|
@ -171,26 +176,27 @@ sed -i "/# su #/d;" "$pihole_storage/logrotate"
|
|||
FTL_temp_path=$(mktemp -d)
|
||||
ynh_setup_source "$FTL_temp_path" FTL
|
||||
|
||||
# Plutôt que télécharger le binaire C, on le compile nous-même.
|
||||
# Instead of downloading a binary file, we're going to compile it
|
||||
( cd "$FTL_temp_path"
|
||||
ynh_exec_warn_less make
|
||||
ynh_exec_warn_less make install )
|
||||
ynh_secure_remove "$FTL_temp_path"
|
||||
|
||||
cp "../conf/pihole-FTL.conf" "$pihole_storage"
|
||||
ynh_store_file_checksum "$pihole_storage/pihole-FTL.conf" # Enregistre la somme de contrôle du fichier de config
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$pihole_storage/pihole-FTL.conf"
|
||||
|
||||
cp -a $pihole_local_repo/advanced/pihole-FTL.service /etc/init.d/pihole-FTL
|
||||
chmod +x /etc/init.d/pihole-FTL
|
||||
ynh_exec_warn_less systemctl enable pihole-FTL
|
||||
|
||||
#=================================================
|
||||
# BUILD THE VARIABLES FILE
|
||||
# BUILD VARIABLES FILE
|
||||
#=================================================
|
||||
|
||||
setupVars="$pihole_storage/setupVars.conf"
|
||||
|
||||
# Trouve l'interface réseau par défaut
|
||||
# Get the default network interface
|
||||
main_iface=$(ip route | grep default | awk '{print $5;}')
|
||||
echo "PIHOLE_INTERFACE=$main_iface" > $setupVars
|
||||
echo "IPV4_ADDRESS=127.0.0.1" >> $setupVars
|
||||
|
@ -205,17 +211,18 @@ fi
|
|||
echo "QUERY_LOGGING=$query_logging" >> $setupVars
|
||||
echo "INSTALL_WEB=true" >> $setupVars
|
||||
|
||||
ynh_store_file_checksum "$setupVars" # Enregistre la somme de contrôle du fichier de config
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$setupVars"
|
||||
|
||||
#=================================================
|
||||
# SET UP THE DNSMASQ CONFIG
|
||||
# SET UP DNSMASQ CONFIG
|
||||
#=================================================
|
||||
|
||||
ynh_systemd_action --action=stop --service_name=dnsmasq
|
||||
|
||||
pihole_dnsmasq_config="/etc/dnsmasq.d/01-pihole.conf"
|
||||
cp "$pihole_local_repo/advanced/01-pihole.conf" $pihole_dnsmasq_config
|
||||
# On utilise les dns de /etc/resolv.dnsmasq.conf
|
||||
# Use dns from /etc/resolv.dnsmasq.conf
|
||||
ynh_replace_string "@DNS1@" "" $pihole_dnsmasq_config
|
||||
ynh_replace_string "@DNS2@" "" $pihole_dnsmasq_config
|
||||
ynh_replace_string "^no-resolv" "#no-resolv" $pihole_dnsmasq_config
|
||||
|
@ -230,25 +237,26 @@ fi
|
|||
# Fix a too recent option for our dnsmasq version.
|
||||
ynh_replace_string "log-queries=extra" "log-queries" $pihole_dnsmasq_config
|
||||
|
||||
ynh_store_file_checksum "$pihole_dnsmasq_config" # Enregistre la somme de contrôle du fichier de config
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$pihole_dnsmasq_config"
|
||||
|
||||
# Pour éviter un conflit entre les config de dnsmasq, il faut commenter cache-size dans la config par défaut.
|
||||
# To prevent any conflict with the original dnsmasq config, comment cache-size in the original config.
|
||||
ynh_replace_string "^cache-size=" "#pihole# cache-size=" /etc/dnsmasq.conf
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE DNS FOR THE LOCAL DOMAINS
|
||||
#=================================================
|
||||
|
||||
# Trouve l'ipv4 associée à l'interface trouvée
|
||||
# Find the IP associated to the network interface
|
||||
localipv4=$(ip address | grep "${main_iface}\$" | awk '{print $2;}' | cut -d/ -f1)
|
||||
|
||||
# Liste les domaines de yunohost
|
||||
# List all YunoHost domains
|
||||
while read perdomain
|
||||
do
|
||||
# Commente les résolutions du domaine sur 127.0.0.1, qui risquerait de bloquer la résolution sur le réseau local
|
||||
# Comment domain resolution in /etc/hosts on 127.0.0.1, because they can interfere with the local network resolution.
|
||||
ynh_replace_string "^127.0.0.1.*$perdomain" "#Commented by pihole# &" /etc/hosts
|
||||
|
||||
# Et ajoute une résolution sur l'ip local à la place, si elle n'existe pas déjà
|
||||
# And add a resolution on the local IP instead
|
||||
grep -q "^$localipv4.*$perdomain" /etc/hosts || \
|
||||
echo "$localipv4 $perdomain #Added by pihole#" >> /etc/hosts
|
||||
done <<< "$(yunohost domain list | grep "\." | sed 's/.*: \|.*- //')"
|
||||
|
@ -297,7 +305,7 @@ ynh_exec_fully_quiet yunohost firewall allow UDP 67 --no-upnp
|
|||
ynh_systemd_action --action=restart --service_name=dnsmasq
|
||||
|
||||
#=================================================
|
||||
# INSTALL THE CRON JOB
|
||||
# INSTALL CRON JOB
|
||||
#=================================================
|
||||
|
||||
cp $pihole_local_repo/advanced/pihole.cron /etc/cron.d/pihole
|
||||
|
@ -318,7 +326,7 @@ ynh_exec_warn_less /opt/pihole/gravity.sh
|
|||
ynh_systemd_action --action=restart --service_name=pihole-FTL
|
||||
|
||||
#=================================================
|
||||
# SET UP THE CONF_REGEN HOOK
|
||||
# SET UP CONF_REGEN HOOK
|
||||
#=================================================
|
||||
|
||||
cp ../conf/dnsmasq_regenconf_hook /usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app
|
||||
|
@ -326,7 +334,7 @@ cp ../conf/dnsmasq_regenconf_hook /usr/share/yunohost/hooks/conf_regen/50-dnsmas
|
|||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# ENABLE SERVICE IN ADMIN PANEL
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add pihole-FTL --log "/var/log/pihole-FTL.log"
|
||||
|
@ -357,6 +365,6 @@ else
|
|||
dhcp_alert=""
|
||||
fi
|
||||
|
||||
message="${dhcp_alert}If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/pihole_ynh"
|
||||
message="${dhcp_alert}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"
|
||||
|
|
|
@ -21,17 +21,18 @@ port=$(ynh_app_setting_get $app port)
|
|||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# DISABLE SERVICE IN ADMIN PANEL
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
if yunohost service status | grep -q pihole-FTL # Test l'existence du service dans Yunohost
|
||||
# Check if the service is declared in YunoHost
|
||||
if yunohost service status | grep -q pihole-FTL
|
||||
then
|
||||
ynh_print_info "Remove pihole-FTL service" >&2
|
||||
yunohost service remove pihole-FTL
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP THE SERVICE PIHOLE-FTL
|
||||
# STOP PIHOLE-FTL SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_systemd_action --action=stop --service_name=pihole-FTL
|
||||
|
@ -42,31 +43,38 @@ rm -f "/etc/init.d/pihole-FTL" "/usr/bin/pihole-FTL" "/var/run/pihole-FTL.pid" "
|
|||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE DIRECTORIES OF THE APP
|
||||
#=================================================
|
||||
|
||||
ynh_secure_remove "/etc/pihole" # Suppression du dossier de stockage l'application
|
||||
ynh_secure_remove "/opt/pihole" # Suppression du dossier l'application
|
||||
ynh_secure_remove "/var/www/pihole" # Suppression de l'interface de l'application
|
||||
ynh_secure_remove "/etc/.pihole" # Suppression du clone local du dépôt
|
||||
# Remove storage directory
|
||||
ynh_secure_remove "/etc/pihole"
|
||||
# Remove app directory
|
||||
ynh_secure_remove "/opt/pihole"
|
||||
# Remove admin panel directory
|
||||
ynh_secure_remove "/var/www/pihole"
|
||||
# Remove local clone of the repository
|
||||
ynh_secure_remove "/etc/.pihole"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE NGINX CONFIGURATION
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_remove_nginx_config # Suppression de la configuration nginx
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE PHP-FPM CONFIGURATION
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_remove_fpm_config # Suppression de la configuration du pool php-fpm
|
||||
# Remove the dedicated php-fpm config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
# CLOSE PORTS
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
|
@ -84,7 +92,7 @@ fi
|
|||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE THE CRON FILE
|
||||
# REMOVE CRON FILE
|
||||
#=================================================
|
||||
|
||||
ynh_secure_remove "/etc/cron.d/pihole"
|
||||
|
@ -93,19 +101,19 @@ ynh_secure_remove "/etc/cron.d/pihole"
|
|||
# REMOVE OTHER FILES
|
||||
#=================================================
|
||||
|
||||
# Suppression des log
|
||||
# Remove logs
|
||||
ynh_secure_remove "/var/log/pihole.log"
|
||||
ynh_secure_remove "/var/log/pihole-FTL.log"
|
||||
|
||||
# Remove the main script
|
||||
# Remove main script
|
||||
ynh_secure_remove "/usr/local/bin/pihole"
|
||||
ynh_secure_remove "/etc/bash_completion.d/pihole"
|
||||
|
||||
# Remove the sudoer file
|
||||
# Remove sudoer file
|
||||
ynh_secure_remove "/etc/sudoers.d/pihole"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE DNSMASQ CONFIG
|
||||
# REMOVE DNSMASQ CONFIG
|
||||
#=================================================
|
||||
|
||||
ynh_systemd_action --action=stop --service_name=dnsmasq
|
||||
|
@ -120,10 +128,10 @@ ynh_replace_string "#pihole# " "" /etc/dnsmasq.conf
|
|||
# CLEAN /etc/hosts
|
||||
#=================================================
|
||||
|
||||
# Restaure les résolutions qui avaient été commentées par pihole
|
||||
# Uncomment lines in /etc/hosts
|
||||
sed -i "s/#Commented by pihole# //g" /etc/hosts
|
||||
|
||||
# Et supprime les lignes ajoutées par pihole
|
||||
# And remove extra lines, added by PiHole
|
||||
sed -i "/#Added by pihole#/d" /etc/hosts
|
||||
|
||||
#=================================================
|
||||
|
@ -133,7 +141,7 @@ sed -i "/#Added by pihole#/d" /etc/hosts
|
|||
ynh_systemd_action --action=restart --service_name=dnsmasq
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE CONF_REGEN HOOK
|
||||
# REMOVE CONF_REGEN HOOK
|
||||
#=================================================
|
||||
|
||||
ynh_secure_remove /usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app
|
||||
|
|
|
@ -48,13 +48,13 @@ ynh_maintenance_mode_ON
|
|||
#=================================================
|
||||
# STANDARD RESTORE STEPS
|
||||
#=================================================
|
||||
# RESTORE OF THE NGINX CONFIGURATION
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE OF THE MAIN DIRECTORIES OF THE APP
|
||||
# RESTORE THE MAIN DIRECTORIES OF THE APP
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "$final_path"
|
||||
|
@ -66,20 +66,21 @@ ynh_restore_file "/etc/pihole"
|
|||
ynh_restore_file "/opt/pihole"
|
||||
|
||||
#=================================================
|
||||
# RECREATE OF THE DEDICATED USER
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_create $app # Recreate the dedicated user, if not exist
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Les fichiers appartiennent à root
|
||||
# Restore permissions on app files
|
||||
chown $app: -R "/etc/pihole"
|
||||
|
||||
#=================================================
|
||||
# RESTORE OF THE PHP-FPM CONFIGURATION
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
|
||||
|
@ -93,13 +94,13 @@ ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
|
|||
ynh_install_app_dependencies $app_depencencies
|
||||
|
||||
#=================================================
|
||||
# ENABLE SERVICE IN ADMIN PANEL
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add pihole-FTL --log "/var/log/pihole-FTL.log"
|
||||
|
||||
#=================================================
|
||||
# RESTORE OF THE CRON FILE
|
||||
# RESTORE THE CRON FILE
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/cron.d/pihole"
|
||||
|
@ -114,7 +115,7 @@ dnsmasq_user=$(grep DNSMASQ_USER= /etc/init.d/dnsmasq | cut -d'"' -f2)
|
|||
chown $dnsmasq_user:root /var/log/pihole.log
|
||||
|
||||
#=================================================
|
||||
# RESTORE OF SPECIFIC FILES
|
||||
# RESTORE SPECIFIC FILES
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/usr/local/bin/pihole"
|
||||
|
@ -128,7 +129,7 @@ ynh_restore_file "/usr/bin/pihole-FTL"
|
|||
ynh_restore_file "/usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE OF DNSMASQ CONFIG
|
||||
# RESTORE DNSMASQ CONFIG
|
||||
#=================================================
|
||||
|
||||
ynh_systemd_action --action=stop --service_name=dnsmasq
|
||||
|
@ -141,25 +142,25 @@ test -e "${YNH_APP_BACKUP_DIR}/etc/dnsmasq.d/03-pihole-wildcard.conf" && \
|
|||
test -e "${YNH_APP_BACKUP_DIR}/etc/dnsmasq.d/04-pihole-static-dhcp.conf" && \
|
||||
ynh_restore_file "/etc/dnsmasq.d/04-pihole-static-dhcp.conf"
|
||||
|
||||
# Pour éviter un conflit entre les config de dnsmasq, il faut commenter cache-size dans la config par défaut.
|
||||
# To prevent any conflict with the original dnsmasq config, comment cache-size in the original config.
|
||||
ynh_replace_string "^cache-size=" "#pihole# cache-size=" /etc/dnsmasq.conf
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE DNS FOR THE LOCAL DOMAINS
|
||||
#=================================================
|
||||
|
||||
# Trouve l'interface réseau par défaut
|
||||
# Get the default network interface
|
||||
main_iface=$(ip route | grep default | awk '{print $5;}')
|
||||
# Trouve l'ipv4 associée à l'interface trouvée
|
||||
# Find the IP associated to the network interface
|
||||
localipv4=$(ip address | grep "${main_iface}\$" | awk '{print $2;}' | cut -d/ -f1)
|
||||
|
||||
# Liste les domaines de yunohost
|
||||
# List all YunoHost domains
|
||||
while read perdomain
|
||||
do
|
||||
# Commente les résolutions du domaine sur 127.0.0.1, qui risquerait de bloquer la résolution sur le réseau local
|
||||
# Comment domain resolution in /etc/hosts on 127.0.0.1, because they can interfere with the local network resolution.
|
||||
sed -i "s/^127.0.0.1.*$perdomain/#Commented by pihole# &/g" /etc/hosts
|
||||
|
||||
# Et ajoute une résolution sur l'ip local à la place, si elle n'existe pas déjà
|
||||
# And add a resolution on the local IP instead
|
||||
grep -q "^$localipv4.*$perdomain" /etc/hosts || \
|
||||
echo "$localipv4 $perdomain #Added by pihole#" >> /etc/hosts
|
||||
done <<< "$(yunohost domain list | grep "\." | sed 's/.*: \|.*- //')"
|
||||
|
@ -171,7 +172,7 @@ done <<< "$(yunohost domain list | grep "\." | sed 's/.*: \|.*- //')"
|
|||
ynh_systemd_action --action=restart --service_name=dnsmasq
|
||||
|
||||
#=================================================
|
||||
# UPDATE THE VARIABLES FILE
|
||||
# UPDATE VARIABLES FILE
|
||||
#=================================================
|
||||
|
||||
setupVars="/etc/pihole/setupVars.conf"
|
||||
|
@ -180,7 +181,8 @@ echo "PIHOLE_INTERFACE=$main_iface" > $setupVars
|
|||
ynh_replace_string "^PIHOLE_INTERFACE=.*" "PIHOLE_INTERFACE=$main_iface" $setupVars
|
||||
ynh_replace_string "^IPV4_ADDRESS=.*" "IPV4_ADDRESS=127.0.0.1" $setupVars
|
||||
|
||||
ynh_store_file_checksum "$setupVars" # Enregistre la somme de contrôle du fichier de config
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "$setupVars"
|
||||
|
||||
#=================================================
|
||||
# START PIHOLE-FTL
|
||||
|
@ -218,6 +220,6 @@ else
|
|||
dhcp_alert=""
|
||||
fi
|
||||
|
||||
message="${dhcp_alert}If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/pihole_ynh"
|
||||
message="${dhcp_alert}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"
|
||||
|
|
|
@ -79,7 +79,8 @@ ynh_abort_if_errors
|
|||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path.
|
||||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
|
@ -102,9 +103,9 @@ ynh_install_app_dependencies $app_depencencies
|
|||
pihole_local_repo="/etc/.pihole"
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
# Update la copie du repo de pihole (nécessaire pour Gravity)
|
||||
# Update the local copy pihole repository (for Gravity)
|
||||
ynh_setup_source "$pihole_local_repo"
|
||||
# Update le dashboard admin
|
||||
# Update admin dashboard
|
||||
ynh_setup_source "$final_path" admin_dashboard
|
||||
fi
|
||||
|
||||
|
@ -115,6 +116,7 @@ fi
|
|||
# Overwrite the nginx configuration only if it's allowed
|
||||
if [ $overwrite_nginx -eq 1 ]
|
||||
then
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
|
@ -122,7 +124,8 @@ fi
|
|||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_create $app # Create the dedicated user, if not exist
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
|
@ -131,7 +134,8 @@ ynh_system_user_create $app # Create the dedicated user, if not exist
|
|||
# Overwrite the php-fpm configuration only if it's allowed
|
||||
if [ $overwrite_phpfpm -eq 1 ]
|
||||
then
|
||||
ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure.
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -140,7 +144,6 @@ fi
|
|||
# UPDATE PI-HOLE SCRIPTS
|
||||
#=================================================
|
||||
|
||||
# Update les scripts de Pi-hole
|
||||
pihole_dir="/opt/pihole"
|
||||
cp -a "$pihole_local_repo/gravity.sh" "$pihole_dir/"
|
||||
cp -a $pihole_local_repo/advanced/Scripts/*.sh "$pihole_dir/"
|
||||
|
@ -149,7 +152,7 @@ cp -a $pihole_local_repo/advanced/Scripts/*.sh "$pihole_dir/"
|
|||
cp -a "$pihole_local_repo/advanced/Scripts/COL_TABLE" "$pihole_dir/"
|
||||
|
||||
#=================================================
|
||||
# Copy the Pi-hole main script
|
||||
# COPY PI-HOLE MAIN SCRIPT
|
||||
#=================================================
|
||||
|
||||
cp -a "$pihole_local_repo/pihole" /usr/local/bin/
|
||||
|
@ -159,7 +162,7 @@ cp -a "$pihole_local_repo/advanced/bash-completion/pihole" /etc/bash_completion.
|
|||
# CREATE SUDOER FILE
|
||||
#=================================================
|
||||
|
||||
# Cette configuration sudoers autorise pihole à exécuter /usr/local/bin/pihole en root sans mot de passe. Pas plus.
|
||||
# This sudoers config allow pihole to execute /usr/local/bin/pihole as root without password. Nothing more.
|
||||
cp "$pihole_local_repo/advanced/pihole.sudo" /etc/sudoers.d/pihole
|
||||
echo "$app ALL=NOPASSWD: /usr/local/bin/pihole" >> /etc/sudoers.d/pihole
|
||||
chmod 0440 /etc/sudoers.d/pihole
|
||||
|
@ -174,7 +177,7 @@ dnsmasq_user=$(grep DNSMASQ_USER= /etc/init.d/dnsmasq | cut -d'"' -f2)
|
|||
sed -i "/# su #/d;" "$pihole_storage/logrotate"
|
||||
|
||||
#=================================================
|
||||
# UPDATE OF PIHOLE-FTL
|
||||
# UPDATE PIHOLE-FTL
|
||||
#=================================================
|
||||
|
||||
ynh_systemd_action --action=stop --service_name=pihole-FTL
|
||||
|
@ -185,19 +188,21 @@ then
|
|||
FTL_temp_path=$(mktemp -d)
|
||||
ynh_setup_source "$FTL_temp_path" FTL
|
||||
|
||||
# Plutôt que télécharger le binaire C, on le compile nous-même.
|
||||
# Instead of downloading a binary file, we're going to compile it
|
||||
( cd "$FTL_temp_path"
|
||||
ynh_exec_warn_less make
|
||||
ynh_exec_warn_less make install )
|
||||
ynh_secure_remove "$FTL_temp_path"
|
||||
fi
|
||||
|
||||
# Overwrite the pihole-FTL config file only if it's allowed
|
||||
# Overwrite pihole-FTL config file only if it's allowed
|
||||
if [ $overwrite_ftl -eq 1 ]
|
||||
then
|
||||
ynh_backup_if_checksum_is_different "$pihole_storage/pihole-FTL.conf" # Créé un backup du fichier de config si il a été modifié.
|
||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
ynh_backup_if_checksum_is_different "$pihole_storage/pihole-FTL.conf"
|
||||
cp "../conf/pihole-FTL.conf" "$pihole_storage"
|
||||
ynh_store_file_checksum "$pihole_storage/pihole-FTL.conf" # Enregistre la somme de contrôle du fichier de config
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "$pihole_storage/pihole-FTL.conf"
|
||||
fi
|
||||
|
||||
cp -a $pihole_local_repo/advanced/pihole-FTL.service /etc/init.d/pihole-FTL
|
||||
|
@ -205,7 +210,7 @@ chmod +x /etc/init.d/pihole-FTL
|
|||
ynh_exec_warn_less systemctl enable pihole-FTL
|
||||
|
||||
#=================================================
|
||||
# BUILD THE VARIABLES FILE
|
||||
# BUILD VARIABLES FILE
|
||||
#=================================================
|
||||
|
||||
setupVars="$pihole_storage/setupVars.conf"
|
||||
|
@ -213,9 +218,10 @@ setupVars="$pihole_storage/setupVars.conf"
|
|||
# Overwrite the setupVars config file only if it's allowed
|
||||
if [ $overwrite_setupvars -eq 1 ]
|
||||
then
|
||||
ynh_backup_if_checksum_is_different "$setupVars" # Créé un backup du fichier de config si il a été modifié.
|
||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
ynh_backup_if_checksum_is_different "$setupVars"
|
||||
|
||||
# Trouve l'interface réseau par défaut
|
||||
# Get the default network interface
|
||||
main_iface=$(ip route | grep default | awk '{print $5;}')
|
||||
echo "PIHOLE_INTERFACE=$main_iface" > $setupVars
|
||||
echo "IPV4_ADDRESS=127.0.0.1" >> $setupVars
|
||||
|
@ -230,11 +236,12 @@ then
|
|||
echo "QUERY_LOGGING=$query_logging" >> $setupVars
|
||||
echo "INSTALL_WEB=true" >> $setupVars
|
||||
|
||||
ynh_store_file_checksum "$setupVars" # Enregistre la somme de contrôle du fichier de config
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "$setupVars"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPDATE THE CRON JOB
|
||||
# UPDATE CRON JOB
|
||||
#=================================================
|
||||
|
||||
cp $pihole_local_repo/advanced/pihole.cron /etc/cron.d/pihole
|
||||
|
@ -248,7 +255,7 @@ ynh_replace_string ".*updatechecker.*" "#&" /etc/cron.d/pihole
|
|||
ynh_systemd_action --action=restart --service_name=pihole-FTL
|
||||
|
||||
#=================================================
|
||||
# UPDATE THE CONF_REGEN HOOK
|
||||
# UPDATE CONF_REGEN HOOK
|
||||
#=================================================
|
||||
|
||||
cp ../conf/dnsmasq_regenconf_hook /usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app
|
||||
|
|
Loading…
Add table
Reference in a new issue