FDIV-Bug

overlayroot-switch

Oct 3rd, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.55 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ischroot=$(ls -di /)
  4.  
  5. if [ "$ischroot" != "2 /" ]; then
  6.     echo "You probably are inside the upper filesystem."
  7.     echo "To make changes permanent, you must run overlayroot-chroot first!!!"
  8. else
  9.     echo "You probably are inside the real root. TAKE EXTRA CARE!!!"
  10. fi
  11.  
  12. case "$1" in
  13. -e)
  14.     cat /etc/overlayroot.conf | grep 'overlayroot=""' > /dev/null
  15.         case "$?" in
  16.         0)
  17.         sed -i 's/overlayroot=""/overlayroot="tmpfs:swap=0,recurse=0"/' /etc/overlayroot.conf
  18.                 echo "Plase, see below if overlayroot was sucessfully enabled"
  19.         cat /etc/overlayroot.conf
  20.                 ;;
  21.         1)
  22.                 echo "Something went wrong!!! overlayroot is probably already enalbled."
  23.         cat /etc/overlayroot.conf
  24.                 ;;
  25.         *)
  26.                 echo "Something went REALY wrong!!!"
  27.                 ;;
  28.         esac
  29.         ;;
  30. -d)
  31.     cat /etc/overlayroot.conf | grep 'overlayroot="tmpfs"' > /dev/null
  32.         case "$?" in
  33.         0)
  34.         sed -i 's/overlayroot="tmpfs:swap=0,recurse=0"/overlayroot=""/' /etc/overlayroot.conf
  35.                 echo "Plase, see below if overlayroot was sucessfully disabled"
  36.         cat /etc/overlayroot.conf
  37.                 ;;
  38.         1)
  39.                 echo "Something went wrong!!! overlayroot is probably already disabled."
  40.         cat /etc/overlayroot.conf
  41.                 ;;
  42.         *)
  43.                 echo "Something went REALY wrong!!!"
  44.                 ;;
  45.         esac
  46.         ;;
  47. *)
  48.         echo "You must pass an argument, either -e to enable or -d to disable overlayroot."
  49.         ;;
  50. esac
Advertisement
Add Comment
Please, Sign In to add comment