udpated install.sh

This commit is contained in:
Nick Leffler 2021-04-07 14:51:39 -04:00
parent 348d0e4446
commit 3e91241863

View File

@ -8,7 +8,7 @@ printInfo() {
} }
getVars() { 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,,}" hotspot="${hotspot,,}"
@ -22,16 +22,24 @@ else
echo "Please choose y/n" echo "Please choose y/n"
fi 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,,}" usbNIC="${usbNIC,,}"
read -rp "New Hostname?: " newHostname
if [[ "${hotspot}" == "y" ]] if [[ "${hotspot}" == "y" ]]
then then
read -p "What would you like your SSID to be?: " ssid read -rp "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 passphrase to be?: " passphrase
fi fi
} }
changeHostname() {
curHostname=$(hostname)
sed -i "s/${curHostname}/${newHostname}/g" /etc/hosts
sed -i "s/${curHostname}/${newHostname}/g" /etc/hostname
}
installPreReqs() { installPreReqs() {
apt update apt update
apt upgrade -y 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 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=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=public --add-masquerade
firewall-cmd --zone=home --add-service=dns firewall-cmd --zone=home --add-service=dns
firewall-cmd --zone=home --add-service=dhcp firewall-cmd --zone=home --add-service=dhcp
@ -151,6 +159,7 @@ systemctl enable dnsmasq
getVars getVars
installPreReqs installPreReqs
firewallConfig firewallConfig
changeHostname
if [[ "${hotspot}" == "y" ]] if [[ "${hotspot}" == "y" ]]
then then