1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pihole_ynh.git synced 2024-09-03 20:05:58 +02:00

Move code to common.sh

This commit is contained in:
Salamandar 2024-03-20 20:50:24 +01:00
parent e533b883cd
commit 4dbf25b73c
3 changed files with 15 additions and 34 deletions

View file

@ -13,6 +13,21 @@ PI_HOLE_INSTALL_DIR="/opt/pihole"
PI_HOLE_CONFIG_DIR="/etc/pihole"
PI_HOLE_BIN_DIR="/usr/local/bin"
# Get the default network interface
main_iface=$(ip route | grep --max-count=1 default | awk '{print $5;}')
# Get the dnsmasq user to set log files permissions
dnsmasq_user=$(grep DNSMASQ_USER= /etc/init.d/dnsmasq | cut -d'"' -f2)
# Find the IP associated to the network interface
localipv4=$(ip address | grep "${main_iface}\$" | awk '{print $2;}' | cut -d/ -f1)
if [ "$query_logging" -eq 1 ]; then
query_logging_str=true
else
query_logging_str=false
fi
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -14,21 +14,6 @@ source /usr/share/yunohost/helpers
ynh_app_setting_set --app="$app" --key="overwrite_setupvars" --value=1
ynh_app_setting_set --app="$app" --key="overwrite_ftl" --value=1
# Get the default network interface
main_iface=$(ip route | grep --max-count=1 default | awk '{print $5;}')
# Get the dnsmasq user to set log files permissions
dnsmasq_user=$(grep DNSMASQ_USER= /etc/init.d/dnsmasq | cut -d'"' -f2)
# Find the IP associated to the network interface
localipv4=$(ip address | grep "${main_iface}\$" | awk '{print $2;}' | cut -d/ -f1)
if [ "$query_logging" -eq 1 ]; then
query_logging_str=true
else
query_logging_str=false
fi
#=================================================
# CHECK AVAILABLE PORT
#=================================================

View file

@ -7,25 +7,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
# Get the default network interface
main_iface=$(ip route | grep --max-count=1 default | awk '{print $5;}')
# Get the dnsmasq user to set log files permissions
dnsmasq_user=$(grep DNSMASQ_USER= /etc/init.d/dnsmasq | cut -d'"' -f2)
# Find the IP associated to the network interface
localipv4=$(ip address | grep "${main_iface}\$" | awk '{print $2;}' | cut -d/ -f1)
if [ "$query_logging" -eq 1 ]; then
query_logging_str=true
else
query_logging_str=false
fi
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================