genswap.sh: swap enabled after marked, reboot prompt to verify fstab
Former-commit-id: 4afaec57fbe8c47000fb69cd10be3c87b74ea19a
This commit is contained in:
parent
64c55a9100
commit
371a93d751
20
genswap.sh
20
genswap.sh
@ -50,13 +50,16 @@ function autoSwap(){
|
|||||||
echo -e -n "\n${YELLOW}Do you want to mark ${SWAPPATH}${SWAPNAME} as swap?(Y/n): ${NC}"
|
echo -e -n "\n${YELLOW}Do you want to mark ${SWAPPATH}${SWAPNAME} as swap?(Y/n): ${NC}"
|
||||||
read markswap
|
read markswap
|
||||||
|
|
||||||
if [ "${markswap}" = "n" ];then
|
if [ "${markswap}" = "n" ] || [ "${markswap}" = "N" ];then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n${LCYAN}Marking ${SWAPPATH}${SWAPNAME} as swap...\n\n${NC}"
|
echo -e "\n${LCYAN}Marking ${SWAPPATH}${SWAPNAME} as swap...\n\n${NC}"
|
||||||
sudo mkswap ${SWAPPATH}${SWAPNAME}
|
sudo mkswap ${SWAPPATH}${SWAPNAME}
|
||||||
|
|
||||||
|
echo -e "${LCYAN}Enabling Swap file for use...${NC}\n"
|
||||||
|
sudo swapon ${SWAPPATH}${SWAPNAME}
|
||||||
|
|
||||||
echo -e -n "\n${YELLOW}Do you want to add swapfile to fstab?(Y/n): ${NC}"
|
echo -e -n "\n${YELLOW}Do you want to add swapfile to fstab?(Y/n): ${NC}"
|
||||||
read addfstab
|
read addfstab
|
||||||
|
|
||||||
@ -77,7 +80,20 @@ function autoSwap(){
|
|||||||
exit 1
|
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! Reboot to verify success...${NC}\n"
|
||||||
|
|
||||||
|
echo -e "${YELLOW}Do you want to reboot your system now?(n/Y): ${NC}"
|
||||||
|
read rebootCheck
|
||||||
|
|
||||||
|
if [ "${rebootCheck}" = "y" ] || [ "${rebootCheck}" = "Y" ];then
|
||||||
|
echo -e "${LRED}Rebooting system in 3 seconds...${NC}\n"
|
||||||
|
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
sudo reboot
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user