Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ischroot=$(ls -di /)
- if [ "$ischroot" != "2 /" ]; then
- echo "You probably are inside the upper filesystem."
- echo "To make changes permanent, you must run overlayroot-chroot first!!!"
- else
- echo "You probably are inside the real root. TAKE EXTRA CARE!!!"
- fi
- case "$1" in
- -e)
- cat /etc/overlayroot.conf | grep 'overlayroot=""' > /dev/null
- case "$?" in
- 0)
- sed -i 's/overlayroot=""/overlayroot="tmpfs:swap=0,recurse=0"/' /etc/overlayroot.conf
- echo "Plase, see below if overlayroot was sucessfully enabled"
- cat /etc/overlayroot.conf
- ;;
- 1)
- echo "Something went wrong!!! overlayroot is probably already enalbled."
- cat /etc/overlayroot.conf
- ;;
- *)
- echo "Something went REALY wrong!!!"
- ;;
- esac
- ;;
- -d)
- cat /etc/overlayroot.conf | grep 'overlayroot="tmpfs"' > /dev/null
- case "$?" in
- 0)
- sed -i 's/overlayroot="tmpfs:swap=0,recurse=0"/overlayroot=""/' /etc/overlayroot.conf
- echo "Plase, see below if overlayroot was sucessfully disabled"
- cat /etc/overlayroot.conf
- ;;
- 1)
- echo "Something went wrong!!! overlayroot is probably already disabled."
- cat /etc/overlayroot.conf
- ;;
- *)
- echo "Something went REALY wrong!!!"
- ;;
- esac
- ;;
- *)
- echo "You must pass an argument, either -e to enable or -d to disable overlayroot."
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment