SHARE
TWEET

rollback_stable_nach_testing.sh

a guest Dec 8th, 2019 94 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. SED=/usr/bin/sed
  14. SUDO=/usr/bin/sudo
  15.  
  16. # ---------------------------
  17. #      Rollback System
  18. # ---------------------------
  19. bootstate=`$MOUNT | $GREP "on / type btrfs" | $GREP "subvol=/@snapshots/STABLE"`
  20. if [ -z "$bootstate" ]
  21.     then
  22.         $ECHO ""
  23.         $ECHO $bootstate
  24.         $ECHO ""
  25.         $ECHO "System ist nicht mit STABLE hochgefahren !"
  26.         $ECHO "ENDE !"
  27.         sleep 3
  28.         exit
  29.     else
  30.     # --------- ROLLBACK - STABLE -> TESTING ----------
  31.  
  32.         $SUDO $BTRFS subvolume delete /.snapshots/TESTING
  33.         $SUDO $BTRFS subvolume snapshot / /.snapshots/TESTING
  34.         $SUDO $SED -i 's/STABLE/TESTING/g' /.snapshots/TESTING/etc/fstab
  35.         $SUDO $CP /boot/vmlinuz-linux-stable /boot/vmlinuz-linux
  36.         $SUDO $CP /boot/initramfs-linux-stable.img /boot/initramfs-linux.img
  37.         # $SUDO $CP /boot/vmlinuz-linux-lts-stable /boot/vmlinuz-linux-lts
  38.         # $SUDO $CP /boot/initramfs-linux-lts-stable.img /boot/initramfs-linux-lts.img
  39.        
  40.         # ---------------------------
  41.         #    Balance Filesystem
  42.         # --------------------------
  43.        
  44.         $SUDO $BTRFS balance start -dusage=5 /btrfs
  45. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top