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