mirror of
https://github.com/unraid/webgui.git
synced 2025-12-21 09:19:44 -06:00
Minor changes to /etc/hosts file handling.
This commit is contained in:
@@ -225,10 +225,10 @@ if [[ -r /boot/config/ident.cfg ]]; then
|
||||
. <(/usr/bin/fromdos </boot/config/ident.cfg)
|
||||
NAME=${NAME//[^a-zA-Z\-\.0-9]/\-}
|
||||
fi
|
||||
hostname "$NAME"
|
||||
hostname -s >/etc/hostname
|
||||
/bin/hostname "$NAME"
|
||||
/bin/hostname -s >/etc/hostname
|
||||
/bin/echo "# Generated" >/etc/hosts
|
||||
/bin/echo "127.0.0.1 $NAME localhost" >>/etc/hosts
|
||||
/bin/echo "127.0.0.1 $NAME localhost" >>/etc/hosts
|
||||
|
||||
# LimeTech - restore the configured timezone
|
||||
if [[ $timeZone == custom ]]; then
|
||||
|
||||
@@ -51,19 +51,19 @@ disable(){
|
||||
sed -ri "s/^#?(use-$1)=.*/\1=no/" $CONF
|
||||
}
|
||||
|
||||
# when starting avahidaemon, add name.local to the hosts file
|
||||
# add name.local to the hosts file
|
||||
add_local_to_hosts(){
|
||||
local OLD="^127\.0\.0\.1.*"
|
||||
local NEW="127.0.0.1 $NAME $NAME.local localhost"
|
||||
sed -i "s/$OLD/$NEW/gm;t" $HOSTS
|
||||
local NEW="127.0.0.1 $NAME $NAME.local localhost"
|
||||
sed -i "s/$OLD/$NEW/" $HOSTS
|
||||
return 0
|
||||
}
|
||||
|
||||
# when stopping avahidaemon, remove name.local from the hosts file
|
||||
# remove name.local from the hosts file
|
||||
remove_local_from_hosts(){
|
||||
local OLD="^127\.0\.0\.1.*"
|
||||
local NEW="127.0.0.1 $NAME localhost"
|
||||
sed -i "s/$OLD/$NEW/gm;t" $HOSTS
|
||||
local NEW="127.0.0.1 $NAME localhost"
|
||||
sed -i "s/$OLD/$NEW/" $HOSTS
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -113,7 +113,10 @@ avahid_restart(){
|
||||
}
|
||||
|
||||
avahid_reload(){
|
||||
$AVAHI --reload 2>/dev/null
|
||||
if avahid_running; then
|
||||
add_local_to_hosts
|
||||
$AVAHI --reload 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
avahid_update(){
|
||||
|
||||
Reference in New Issue
Block a user