genswap.sh: add check for swap in fstab
Former-commit-id: e5118bf5caf09ddc170589acd2a28a2e17956b3b
This commit is contained in:
parent
70725bfc6d
commit
9b82f6d234
13
genswap.sh
13
genswap.sh
@ -65,10 +65,19 @@ function autoSwap(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n${LCYAN}Creating backup of /etc/fstab ...\n${NC}"
|
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 -e "${LCYAN}Adding ${SWAPPATH}${SWAPNAME} to /etc/fstab ..\n${NC}"
|
||||||
echo "${SWAPPATH}${SWAPNAME} none swap sw 0 0" | sudo tee -a /etc/fstab
|
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(){
|
function swappiness(){
|
||||||
@ -110,7 +119,7 @@ function help(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function version(){
|
function version(){
|
||||||
echo -e "Version ${VERSION}, built: ${BUILDDATE}\n"
|
echo -e "Version ${VERSION}, Build Date: ${BUILDDATE}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user