genswap.sh: check fstab using != 'swap', add exit status

Former-commit-id: dd75bbdf3abf9482db07c7839b86a6674e488a20
This commit is contained in:
mollusk 2018-09-19 03:01:32 -07:00
parent 9b82f6d234
commit 64c55a9100

View File

@ -72,8 +72,9 @@ function autoSwap(){
CHECKFSTAB=$(cat /etc/fstab | grep "swap" | gawk '/swap/{print $2}') CHECKFSTAB=$(cat /etc/fstab | grep "swap" | gawk '/swap/{print $2}')
if [ ! $CHECKFSTAB ];then if [ $CHECKFSTAB != "swap" ];then
echo -e "${LRED}Swap line does not exist in /etc/fstab, please manually check this.${NC}\n" echo -e "${LRED}Swap line does not exist in /etc/fstab, please manually check this.${NC}\n"
exit 1
else else
echo -e "${LGREEN}Swap successfully added to /etc/fstab! Please reboot your machine...${NC}\n" echo -e "${LGREEN}Swap successfully added to /etc/fstab! Please reboot your machine...${NC}\n"