Advertisement
peetaur

xen uninstall reinstall

Oct 12th, 2012
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. Here is what I do using any source package to reinstall.
  2.  
  3. Please be very careful, run a few lines at a time, and verify backups are correct... it's not a highly safe script.
  4.  
  5. I only tested it on my own machine, where it runs without any issues.
  6.  
  7. Using snapper (openSUSE) and btrfs:
  8.  
  9. # backup:
  10. date=$(date +%s)
  11. mkdir /backup
  12. tar czf /backup/boot-xen-${date}.tgz /boot/*xen*
  13. snapper create
  14. snap=$(ls -1 /.snapshots/ | sort -n | tail -n1)
  15.  
  16. make uninstall
  17.  
  18. # some files not uninstalled by the above
  19. tar czf /backup/other-${date}.tgz /usr/lib64/libxen* /lib64/libxen* /usr/lib64/efi/xen* /lib64/xen /usr/lib/xen
  20.  
  21. rm /usr/lib64/libxen* /lib64/libxen* /usr/lib64/efi/xen*
  22. rm -rf /lib64/xen /usr/lib/xen
  23.  
  24. # restore backup:
  25. ( cd /; tar xzf /backup/boot-xen-${date}.tgz )
  26. cp --reflink=always -rn /.snapshots/${snap}/snapshot/lib/modules/*xen* /lib/modules/
  27. cp --reflink=always -rn /.snapshots/${snap}/snapshot/etc/xen /etc/
  28. mkdir /var/lib/xen/
  29. cp --reflink=always -rn /.snapshots/${snap}/snapshot/var/lib/xen/* /var/lib/xen/
  30.  
  31. make install && echo success || echo failure
  32.  
  33. Without snapper or btrfs (UNTESTED):
  34. date=$(date +%s)
  35. mkdir /backup
  36. tar czf /backup/boot-xen-${date}.tgz /boot/*xen*
  37. tar czf /backup/modules-xen-${date}.tgz /lib/modules/*xen*
  38. tar czf /backup/etc-xen-${date}.tgz /etc/xen
  39. #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
  40. tar czf /backup/var-lib-xen-${date}.tgz /var/lib/xen
  41.  
  42. make uninstall
  43. tar czf /backup/other-${date}.tgz /usr/lib64/libxen* /lib64/libxen* /usr/lib64/efi/xen* /lib64/xen /usr/lib/xen
  44. rm /usr/lib64/libxen* /lib64/libxen* /usr/lib64/efi/xen*
  45. rm -rf /lib64/xen /usr/lib/xen
  46.  
  47. cd /
  48. tar xzf /backup/boot-xen-${date}.tgz
  49. tar xzf /backup/modules-xen-${date}.tgz
  50. tar xzf /backup/etc-xen-${date}.tgz
  51. #NOTE: maybe slow; see note above
  52. tar xzf /backup/var-lib-xen-${date}.tgz
  53.  
  54. make install && echo success || echo failure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement