diff --git a/install.sh b/install.sh index faffcc2..8d0f374 100644 --- a/install.sh +++ b/install.sh @@ -8,7 +8,7 @@ printInfo() { } getVars() { -read -p "Do you want the rPi to be a wifi hotspot? [y/n]: " hotspot +read -rp "Do you want the rPi to be a wifi hotspot? [y/n]: " hotspot hotspot="${hotspot,,}" @@ -22,16 +22,24 @@ else echo "Please choose y/n" fi -read -p "What is the NIC for the USB hotspot" usbNIC +read -rp "What is the NIC for the USB hotspot" usbNIC usbNIC="${usbNIC,,}" +read -rp "New Hostname?: " newHostname + if [[ "${hotspot}" == "y" ]] then - read -p "What would you like your SSID to be?: " ssid - read -p " What woudl you like your passphrase to be?: " passphrase + read -rp "What would you like your SSID to be?: " ssid + read -rp " What would you like your passphrase to be?: " passphrase fi } +changeHostname() { +curHostname=$(hostname) +sed -i "s/${curHostname}/${newHostname}/g" /etc/hosts +sed -i "s/${curHostname}/${newHostname}/g" /etc/hostname +} + installPreReqs() { apt update apt upgrade -y @@ -52,7 +60,7 @@ firewallConfig() { sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf firewall-cmd --zone=home --add-interface=br0 -firewall-cmd --zone=public --add-interface=${usbNIC} +firewall-cmd --zone=public --add-interface="${usbNIC}" firewall-cmd --zone=public --add-masquerade firewall-cmd --zone=home --add-service=dns firewall-cmd --zone=home --add-service=dhcp @@ -151,6 +159,7 @@ systemctl enable dnsmasq getVars installPreReqs firewallConfig +changeHostname if [[ "${hotspot}" == "y" ]] then