From 0439744be727fde4f73eddc7f781c4da8ce56869 Mon Sep 17 00:00:00 2001 From: haimd Date: Fri, 20 Aug 2021 15:23:16 +0700 Subject: [PATCH] Add setup ip file --- monitor/setup/setip.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 monitor/setup/setip.sh diff --git a/monitor/setup/setip.sh b/monitor/setup/setip.sh new file mode 100644 index 0000000..aa0148d --- /dev/null +++ b/monitor/setup/setip.sh @@ -0,0 +1,35 @@ +#!/bin/bash +echo 'auto lo +iface lo inet interface + +auto eth0' > /etc/network/interfaces +echo "Enter the type IPaddress" +read type +echo "iface eth0 inet $type" >> /etc/network/interfaces +if [ "$type" = static ] +then +echo "Enter the IP: " +read ipaddr +echo " address $ipaddr" >> /etc/network/interfaces +echo "Enter the netmask: " +read netmask +echo " netmask $netmask" >> /etc/network/interfaces +echo "Enter the gateway: " +read gateway +echo " gateway $gateway" >> /etc/network/interfaces +echo "Enter the dns-nameservers: " +read dns +echo " dns-nameservers $dns" >> /etc/network/interfaces +else echo "Setup IP success!!!" +fi +while true; do + read -p "Do you wish to reboot device?(y/n)" yn + case $yn in + [Yy]* ) reboot; break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done + +exit 0 +