Sam Chiu | 81bdc65 | 2018-06-29 18:45:08 +0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Kevin Cheng | f756bbd | 2018-10-11 13:50:00 -0700 | [diff] [blame] | 3 | function remove_cuttlefish_pkgs() { |
| 4 | local PACKAGES=("cuttlefish-common" |
| 5 | "ssvnc" |
| 6 | "qemu-kvm" |
| 7 | "qemu-system-common" |
| 8 | "qemu-system-x86" |
| 9 | "qemu-utils" |
| 10 | "libvirt-clients" |
| 11 | "libvirt-daemon-system") |
| 12 | for package in ${PACKAGES[@]}; |
| 13 | do |
| 14 | echo " - uninstalling $package" |
| 15 | sudo su -c "apt-get purge $package -y && apt-get autoremove -y" |
| 16 | done |
Sam Chiu | 81bdc65 | 2018-06-29 18:45:08 +0800 | [diff] [blame] | 17 | } |
| 18 | |
Kevin Cheng | f756bbd | 2018-10-11 13:50:00 -0700 | [diff] [blame] | 19 | function remove_cuttlefish_usergroups() { |
Sam Chiu | 81bdc65 | 2018-06-29 18:45:08 +0800 | [diff] [blame] | 20 | local GROUPS_TO_REMOVE=("kvm" "libvirt" "cvdnetwork") |
Kevin Cheng | f756bbd | 2018-10-11 13:50:00 -0700 | [diff] [blame] | 21 | echo " - remove user from groups: ${GROUPS_TO_REMOVE[@]}" |
Sam Chiu | 81bdc65 | 2018-06-29 18:45:08 +0800 | [diff] [blame] | 22 | for g in ${GROUPS_TO_REMOVE[@]}; |
| 23 | do |
| 24 | sudo gpasswd -d $USER $g |
| 25 | done |
Sam Chiu | 81bdc65 | 2018-06-29 18:45:08 +0800 | [diff] [blame] | 26 | } |
| 27 | |
Kevin Cheng | f756bbd | 2018-10-11 13:50:00 -0700 | [diff] [blame] | 28 | function remove_configs() { |
| 29 | local ACLOUD_CONFIG_DIR=~/.config/acloud |
| 30 | if [ -d $ACLOUD_CONFIG_DIR ]; then |
| 31 | echo " - remove acloud configs" |
| 32 | rm -rf $ACLOUD_CONFIG_DIR |
| 33 | fi |
| 34 | |
| 35 | local ACLOUD_SSH_KEY=~/.ssh/acloud_rsa |
| 36 | if [ -f $ACLOUD_SSH_KEY ]; then |
| 37 | echo " - remove acloud ssh keys" |
| 38 | rm ${ACLOUD_SSH_KEY}* |
| 39 | fi |
| 40 | |
| 41 | local ACLOUD_VNC_PROFILE=~/.vnc/profiles/acloud_vnc_profile.vnc |
| 42 | if [ -f $ACLOUD_VNC_PROFILE ]; then |
| 43 | echo " - remove acloud vnc profile" |
| 44 | rm $ACLOUD_VNC_PROFILE |
| 45 | fi |
Sam Chiu | 81bdc65 | 2018-06-29 18:45:08 +0800 | [diff] [blame] | 46 | } |
| 47 | |
Kevin Cheng | f756bbd | 2018-10-11 13:50:00 -0700 | [diff] [blame] | 48 | function purge_cuttlefish_host_setup(){ |
| 49 | echo "Purging host of acloud setup steps..." |
| 50 | remove_cuttlefish_pkgs |
| 51 | remove_cuttlefish_usergroups |
| 52 | remove_configs |
| 53 | echo "Done!" |
| 54 | } |
| 55 | |
| 56 | purge_cuttlefish_host_setup |