blob: 544a25b3052c29de530bd329738288fbb8ab900c [file] [log] [blame]
Sam Chiu81bdc652018-06-29 18:45:08 +08001#!/bin/bash
2
Kevin Chengf756bbd2018-10-11 13:50:00 -07003function 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 Chiu81bdc652018-06-29 18:45:08 +080017}
18
Kevin Chengf756bbd2018-10-11 13:50:00 -070019function remove_cuttlefish_usergroups() {
Sam Chiu81bdc652018-06-29 18:45:08 +080020 local GROUPS_TO_REMOVE=("kvm" "libvirt" "cvdnetwork")
Kevin Chengf756bbd2018-10-11 13:50:00 -070021 echo " - remove user from groups: ${GROUPS_TO_REMOVE[@]}"
Sam Chiu81bdc652018-06-29 18:45:08 +080022 for g in ${GROUPS_TO_REMOVE[@]};
23 do
24 sudo gpasswd -d $USER $g
25 done
Sam Chiu81bdc652018-06-29 18:45:08 +080026}
27
Kevin Chengf756bbd2018-10-11 13:50:00 -070028function 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 Chiu81bdc652018-06-29 18:45:08 +080046}
47
Kevin Chengf756bbd2018-10-11 13:50:00 -070048function 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