SHARE
TWEET

rollback_oldstable_nach_stable_und_testing.sh

a guest Nov 26th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # Rollback OLDSTABLE -> 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/OLDSTABLE"`
  23. if [ -z $"{bootstate}" ]
  24.     then
  25.         $ECHO ""
  26.         $ECHO $bootstate
  27.         $ECHO ""
  28.         $ECHO "System ist nicht mit OLDSTABLE hochgefahren !"
  29.         $ECHO "ENDE !"
  30.         exit
  31.     else
  32.         # --------- ROLLBACK - OLDSTABLE -> STABLE ----------
  33.         $SUDO $BTRFS subvolume delete /.snapshots/STABLE
  34.         $SUDO $BTRFS subvolume snapshot / /.snapshots/STABLE
  35.         $SUDO $SED -i 's/OLDSTABLE/STABLE/g' /.snapshots/STABLE/etc/fstab
  36.         $SUDO $CP /boot/vmlinuz-linux-oldstable /boot/vmlinuz-linux-stable
  37.         $SUDO $CP /boot/initramfs-linux-oldstable.img /boot/initramfs-linux-stable.img
  38.  
  39.         # -------- ROLLBACK - OLDSTABLE -> TESTING --------
  40.         $SUDO $BTRFS subvolume delete /.snapshots/TESTING
  41.         $SUDO $BTRFS subvolume snapshot / /.snapshots/TESTING
  42.         $SUDO $SED -i 's/OLDSTABLE/TESTING/g' /.snapshots/TESTING/etc/fstab
  43.         $SUDO $CP /boot/vmlinuz-linux-oldstable /boot/vmlinuz-linux
  44.         $SUDO $CP /boot/initramfs-linux-oldstable.img /boot/initramfs-linux.img
  45.        
  46.         # ---------------------------
  47.         #    Balance Filesystem
  48.         # --------------------------
  49.         $SUDO $BTRFS balance start -dusage=5 /btrfs
  50. 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