diff --git a/genswap.sh b/genswap.sh index 3d91445..713608b 100755 --- a/genswap.sh +++ b/genswap.sh @@ -65,10 +65,19 @@ function autoSwap(){ fi echo -e "\n${LCYAN}Creating backup of /etc/fstab ...\n${NC}" - sudo cp /etc/fstab /etc/fstab.bak + sudo cp -v /etc/fstab /etc/fstab.bak echo -e "${LCYAN}Adding ${SWAPPATH}${SWAPNAME} to /etc/fstab ..\n${NC}" echo "${SWAPPATH}${SWAPNAME} none swap sw 0 0" | sudo tee -a /etc/fstab + + CHECKFSTAB=$(cat /etc/fstab | grep "swap" | gawk '/swap/{print $2}') + + if [ ! $CHECKFSTAB ];then + echo -e "${LRED}Swap line does not exist in /etc/fstab, please manually check this.${NC}\n" + + else + echo -e "${LGREEN}Swap successfully added to /etc/fstab! Please reboot your machine...${NC}\n" + fi } function swappiness(){ @@ -110,7 +119,7 @@ function help(){ } function version(){ - echo -e "Version ${VERSION}, built: ${BUILDDATE}\n" + echo -e "Version ${VERSION}, Build Date: ${BUILDDATE}\n" } case "${1}" in