Guest User

rollback_stable_nach_testing.sh

a guest
Nov 26th, 2019
99
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # Rollback STABLE -> TESTING
  3. # ---------------------------
  4. # Rollback - Btrfs
  5. # ---------------------------
  6.  
  7. BTRFS=/usr/bin/btrfs
  8. CP=/usr/bin/cp
  9. ECHO=/usr/bin/echo
  10. GREP=/usr/bin/grep
  11. MOUNT=/usr/bin/mount
  12. MV=/usr/bin/mv
  13. PACAUR=/usr/bin/pacaur
  14. PACMAN=/usr/bin/pacman
  15. REFLECTOR=/usr/bin/reflector
  16. SED=/usr/bin/sed
  17. SUDO=/usr/bin/sudo
  18.  
  19. # ---------------------------
  20. #      Rollback System
  21. # ---------------------------
  22. bootstate=`$MOUNT | $GREP "on / type btrfs" | $GREP "subvol=/@snapshots/STABLE"`
  23. if [ -z $"{bootstate}" ]
  24.     then
  25.         $ECHO ""
  26.         $ECHO $bootstate
  27.         $ECHO ""
  28.         $ECHO "System ist nicht mit STABLE hochgefahren !"
  29.         $ECHO "ENDE !"
  30.         exit
  31.     else
  32.         # --------- ROLLBACK - STABLE -> TESTING ----------
  33.  
  34.         $SUDO $BTRFS subvolume delete /.snapshots/TESTING
  35.         $SUDO $BTRFS subvolume snapshot / /.snapshots/TESTING
  36.         $SUDO $SED -i 's/STABLE/TESTING/g' /.snapshots/TESTING/etc/fstab
  37.         $SUDO $CP /boot/vmlinuz-linux-stable /boot/vmlinuz-linux
  38.         $SUDO $CP /boot/initramfs-linux-stable.img /boot/initramfs-linux.img
  39.        
  40.         # ---------------------------
  41.         #    Balance Filesystem
  42.         # --------------------------
  43.        
  44.         $SUDO $BTRFS balance start -dusage=5 /btrfs
  45. fi
RAW Paste Data