added check for vm or lxc for qemu-guest-agent

This commit is contained in:
2023-10-18 12:43:16 -05:00
parent 7986af17df
commit f913f4711e
2 changed files with 31 additions and 3 deletions

View File

@@ -50,6 +50,20 @@ apt-get remove os-prober -y > /dev/null 2>&1
apt-get update
apt-get upgrade -y
# check if vm or lxc
if [[ ! -d /dev/disk/by-id ]]
then
apt-get install -y qemu-guest-agent
else
isInFile=$(ls /dev/disk/by-id | grep -c "QEMU")
if [ $isInFile -eq 0 ]
then
apt-get remove -y qemu-guest-agent
else
apt-get install -y qemu-guest-agent
fi
fi
# download and install packages
apt-get install -y ncdu pwgen lsb-release cron qemu-guest-agent sudo nano curl wget zip unzip git rsync man-db cifs-utils nfs-common parted libtalloc2 libwbclient0 net-tools gnupg apt-transport-https tmux gdisk bash-completion
@@ -223,7 +237,7 @@ if [ $isInFile -eq 0 ]
rm /opt/cronicle/conf/config.json
wget -qO /opt/cronicle/conf/config.json http://192.168.1.50/files/debian/cronicle-config.json
/opt/cronicle/bin/control.sh start
echo "Cronicle worker is installed."
echo "Cronicle worker installed."
else
echo "Cronicle worker is already installed."
echo "Cronicle worker already installed."
fi

View File

@@ -18,8 +18,22 @@ apt-get remove os-prober -y
apt-get update
apt-get upgrade -y
# check if vm or lxc
if [[ ! -d /dev/disk/by-id ]]
then
apt-get install -y qemu-guest-agent
else
isInFile=$(ls /dev/disk/by-id | grep -c "QEMU")
if [ $isInFile -eq 0 ]
then
apt-get remove -y qemu-guest-agent
else
apt-get install -y qemu-guest-agent
fi
fi
# download and install packages
apt-get install -y ncdu pwgen qemu-guest-agent sudo nano curl wget zip unzip git rsync man-db cifs-utils nfs-common parted libtalloc2 libwbclient0 net-tools gnupg apt-transport-https tmux gdisk bash-completion
apt-get install -y ncdu pwgen sudo nano curl wget zip unzip git rsync man-db cifs-utils nfs-common parted libtalloc2 libwbclient0 net-tools gnupg apt-transport-https tmux gdisk bash-completion
# add akanealw user if not existing
isInFile=$(cat /etc/passwd | grep -c "akanealw")