1#!/bin/bash 2 3function 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 17} 18 19function remove_cuttlefish_usergroups() { 20 local GROUPS_TO_REMOVE=("kvm" "libvirt" "cvdnetwork") 21 echo " - remove user from groups: ${GROUPS_TO_REMOVE[@]}" 22 for g in ${GROUPS_TO_REMOVE[@]}; 23 do 24 sudo gpasswd -d $USER $g 25 done 26} 27 28function 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 46} 47 48function 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 56purge_cuttlefish_host_setup 57