SHARE
TWEET

rollback_oldstable_nach_stable_und_testing.sh

a guest Dec 8th, 2019 88 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. 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/OLDSTABLE"`
  20. if [ -z "$bootstate" ]
  21.     then
  22.         $ECHO ""
  23.         $ECHO $bootstate
  24.         $ECHO ""
  25.         $ECHO "System ist nicht mit OLDSTABLE hochgefahren !"
  26.         $ECHO "ENDE !"
  27.         sleep 2
  28.         exit
  29.     else
  30.         # --------- ROLLBACK - OLDSTABLE -> STABLE ----------
  31.         $SUDO $BTRFS subvolume delete /.snapshots/STABLE
  32.         $SUDO $BTRFS subvolume snapshot / /.snapshots/STABLE
  33.         $SUDO $SED -i 's/OLDSTABLE/STABLE/g' /.snapshots/STABLE/etc/fstab
  34.         $SUDO $CP /boot/vmlinuz-linux-oldstable /boot/vmlinuz-linux-stable
  35.         $SUDO $CP /boot/initramfs-linux-oldstable.img /boot/initramfs-linux-stable.img
  36.         # $SUDO $CP /boot/vmlinuz-linux-lts-oldstable /boot/vmlinuz-linux-lts-stable
  37.         # $SUDO $CP /boot/initramfs-linux-lts-oldstable.img /boot/initramfs-linux-lts-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.         # $SUDO $CP /boot/vmlinuz-linux-lts-oldstable /boot/vmlinuz-linux-lts
  46.         # $SUDO $CP /boot/initramfs-linux-lts-oldstable.img /boot/initramfs-linux-lts.img
  47.        
  48.         # ---------------------------
  49.         #    Balance Filesystem
  50.         # --------------------------
  51.         $SUDO $BTRFS balance start -dusage=5 /btrfs
  52. 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