diff --git a/linupx-scripts.sh b/linupx-scripts.sh index d41dfc5..af8bc3b 100755 --- a/linupx-scripts.sh +++ b/linupx-scripts.sh @@ -699,8 +699,9 @@ RECONFIGURE_NETWORK(){ read -e HOSTNAME [ "${HOSTNAME}" == "" ] && HOSTNAME=$(hostname) echo - echo -en "${idsCL[LightYellow]}Domain (optional): ${idsCL[Default]}" + echo -en "${idsCL[LightYellow]}Domain (optional) [Current='${idsCL[White]}$(hostname -d)${idsCL[LightYellow]}']: ${idsCL[Default]}" read -e DOMAIN + [ "${DOMAIN}" == "" ] && DOMAIN=$(hostname -d) echo REPIP=`hostname -I` REPIP=${REPIP/ /} @@ -748,8 +749,8 @@ RECONFIGURE_NETWORK(){ *) echo -en "${idsCL[LightCyan]}Making configuration changes ... ${idsCL[Default]}" - sudo hostnamectl set-hostname ${HOSTNAME} >/dev/null 2>&1 - sudo sed -i '/127.0.1.1/d' /etc/hosts >/dev/null 2>&1 + hostnamectl set-hostname ${HOSTNAME} >/dev/null 2>&1 + sed -i '/127.0.1.1/d' /etc/hosts >/dev/null 2>&1 [ "${DOMAIN}" == "" ] && echo "127.0.1.1 ${HOSTNAME}" >> /etc/hosts || echo "127.0.1.1 ${HOSTNAME}.${DOMAIN} ${HOSTNAME}" >> /etc/hosts NEWSUB=`IPprefix_by_netmask ${SUBNET}` @@ -763,14 +764,17 @@ RECONFIGURE_NETWORK(){ sed -i "s/${REPGW}/${GATEWAY}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1 - [ "${DOMAIN}" != "" ] && echo " search: [${DOMAIN}]" >> /etc/netplan/eth0.yaml + sed -i '/search/d' /etc/netplan/eth0.yaml >/dev/null 2>&1 + if [ "${DOMAIN}" != "" ]; then + echo " search: [${DOMAIN}]" >> /etc/netplan/eth0.yaml + fi echo -e "${idsCL[Green]}Done${idsCL[Default]}" echo ;; esac - echo -e "\n${idsCL[Green]}Network has been updated${idsCL[Default]}]\n" + echo -e "\n${idsCL[Green]}Network has been updated${idsCL[Default]}\n" read -n 1 -s -p "Press any key to continue" echo ;;