mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Hostname automatic update
This commit is contained in:
parent
fd1c48b710
commit
ec2e0af7db
@ -50,7 +50,8 @@ fi
|
||||
HOSTAPD_CONF="/etc/hostapd/hostapd.conf"
|
||||
|
||||
old_ssid=$(grep ^ssid $HOSTAPD_CONF | cut -d "=" -f 2)
|
||||
new_ssid="isobox-$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2)"
|
||||
rpi_serial=$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2)
|
||||
new_ssid="isobox-$rpi_serial"
|
||||
|
||||
if [[ "$old_ssid" != "$new_ssid" ]]; then
|
||||
sed -i "s/$old_ssid/$new_ssid/" $HOSTAPD_CONF
|
||||
@ -65,6 +66,15 @@ if [[ ! -z "$new_country_code" ]] && [[ "$old_country_code" != "$new_country_cod
|
||||
echo "Updated country code: $new_country_code"
|
||||
fi
|
||||
|
||||
old_hostname=$(hostname)
|
||||
new_hostname=$(isobox-$rpi_serial)
|
||||
|
||||
if [[ "$old_hostname" != "$new_hostname" ]]; then
|
||||
echo $new_hostname >/etc/hostname
|
||||
sed -i "s/$old_hostname/$new_hostname/" /etc/hosts
|
||||
hostname $new_hostname
|
||||
fi
|
||||
|
||||
if [ -f "$DAEMONPATH" ] && [ ! -z "$interface" ]; then
|
||||
echo "Changing RaspAP Daemon --interface to $interface"
|
||||
sed -i "s/\(--interface \)[[:alnum:]]*/\1$interface/" "$DAEMONPATH"
|
||||
|
Loading…
Reference in New Issue
Block a user