Advertisement
Guest User

Untitled

a guest
Jun 9th, 2019
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.10 KB | None | 0 0
  1. #!/bin/bash
  2. workdir=/tmp/qemu-kvm
  3. bin=/usr/local/opt/qemu-kvm/bin
  4. lib=/usr/local/opt/qemu-kvm/lib
  5. rootfs="/dev/root"
  6.  
  7. mkdir -p $bin && mkdir $lib
  8.  
  9. # The ar utility is needed to decompress .deb files.
  10. curl -LJ https://github.com/psammarco/KVM-on-ChromeOS/blob/master/ar?raw=true -o $bin/ar
  11. curl -LJ https://github.com/psammarco/KVM-on-ChromeOS/blob/master/libbfd-2.28-system.so?raw=true -o $lib/libbfd-2.28-system.so
  12.  
  13. chmod u+x $bin/ar
  14.  
  15. ### ChromeOS's Specific!!!
  16. # The following assumes rootfs_verification for / has already been removed
  17. if grep $rootfs /proc/mounts | grep ro; then
  18.   mount -o remount,rw / &> mount.out
  19.  
  20. elif
  21.  grep -iw 'read-write' mount.out; then
  22.  
  23.    echo '\nrootfs_verification for the root partition must to be removed in order to remount,rw  /
  24. To remove rootfs_verification run the following command and than reboot the system:
  25. "sudo /usr/share/vboot/bin/make_dev_ssd.sh  --remove_rootfs_verification --partitions 4"'
  26.  
  27. else exit 1
  28.  
  29. fi
  30.  
  31. echo -e 'LD_LIBRARY_PATH="/usr/local/opt/qemu-kvm/lib"\nPATH="/usr/local/opt/qemu-kvm/bin:$PATH"' > /etc/env.d/30kvm && source /etc/env.d/30kvm
  32. ### End ChromeOS's Specific
  33.  
  34. ### qemu-kvm_2.8's binary download and installation tasks.
  35. #
  36. mkdir -p $workdir/qemu-kvm_2.8 && cd $workdir/qemu-kvm_2.8
  37. curl -O  http://ftp.us.debian.org/debian/pool/main/q/qemu/qemu-kvm_2.8+dfsg-6+deb9u5_amd64.deb
  38.  
  39. ar x qemu-kvm_2.8+dfsg-6+deb9u5_amd64.deb | tar -xzvf control.tar.gz && tar -xvf data.tar.xz
  40.  
  41. # Validates the md5 hash of the binary, copies it to $bin and set exec permissions;
  42. if md5sum -c md5sums; then
  43.       cp usr/bin/kvm $bin/ && chmod u+x $bin/kvm
  44. else
  45.     exit 1
  46. fi
  47. #
  48. ### done
  49.  
  50. mkdir $workdir/qemu-system-x86 && cd ../qemu-system-x86
  51.  
  52. curl -O http://ftp.us.debian.org/debian/pool/main/q/qemu/qemu-system-x86_2.8+dfsg-6+deb9u5_amd64.deb
  53.  
  54. ar x qemu-system-x86_2.8+dfsg-6+deb9u5_amd64.deb | tar -xzvf control.tar.gz && tar -xvf data.tar.xz
  55.  
  56. if md5sum -c md5sums; then
  57.       cp usr/bin/qemu-system* $bin/ && chmod u+x $bin/qemu-system*
  58.  
  59. else
  60.     exit 1
  61. fi
  62.  
  63. echo "To uninstall it, simply run rm -r /usr/local/opt/qemu-kvm as root"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement