Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here is what I do using any source package to reinstall.
- Please be very careful, run a few lines at a time, and verify backups are correct... it's not a highly safe script.
- I only tested it on my own machine, where it runs without any issues.
- Using snapper (openSUSE) and btrfs:
- # backup:
- date=$(date +%s)
- mkdir /backup
- tar czf /backup/boot-xen-${date}.tgz /boot/*xen*
- snapper create
- snap=$(ls -1 /.snapshots/ | sort -n | tail -n1)
- make uninstall
- # some files not uninstalled by the above
- tar czf /backup/other-${date}.tgz /usr/lib64/libxen* /lib64/libxen* /usr/lib64/efi/xen* /lib64/xen /usr/lib/xen
- rm /usr/lib64/libxen* /lib64/libxen* /usr/lib64/efi/xen*
- rm -rf /lib64/xen /usr/lib/xen
- # restore backup:
- ( cd /; tar xzf /backup/boot-xen-${date}.tgz )
- cp --reflink=always -rn /.snapshots/${snap}/snapshot/lib/modules/*xen* /lib/modules/
- cp --reflink=always -rn /.snapshots/${snap}/snapshot/etc/xen /etc/
- mkdir /var/lib/xen/
- cp --reflink=always -rn /.snapshots/${snap}/snapshot/var/lib/xen/* /var/lib/xen/
- make install && echo success || echo failure
- Without snapper or btrfs (UNTESTED):
- date=$(date +%s)
- mkdir /backup
- tar czf /backup/boot-xen-${date}.tgz /boot/*xen*
- tar czf /backup/modules-xen-${date}.tgz /lib/modules/*xen*
- tar czf /backup/etc-xen-${date}.tgz /etc/xen
- #NOTE: without using snapper, this step might take VERY long, depending on whether you have big disk files here; maybe replace with "mv" instead of tar
- tar czf /backup/var-lib-xen-${date}.tgz /var/lib/xen
- make uninstall
- tar czf /backup/other-${date}.tgz /usr/lib64/libxen* /lib64/libxen* /usr/lib64/efi/xen* /lib64/xen /usr/lib/xen
- rm /usr/lib64/libxen* /lib64/libxen* /usr/lib64/efi/xen*
- rm -rf /lib64/xen /usr/lib/xen
- cd /
- tar xzf /backup/boot-xen-${date}.tgz
- tar xzf /backup/modules-xen-${date}.tgz
- tar xzf /backup/etc-xen-${date}.tgz
- #NOTE: maybe slow; see note above
- tar xzf /backup/var-lib-xen-${date}.tgz
- make install && echo success || echo failure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement