mint.sh aktualisiert

This commit is contained in:
olli 2023-07-19 14:23:21 +02:00
parent 3b0e3eca59
commit c683f9fa33

24
mint.sh
View File

@ -15,6 +15,23 @@ Nutzung auf einene Gefahr!!! Nur mit Enter/Return fortfahren wenn dieses Skript
whoami | grep -q ^root$ || read x
# identify default user
defaultuser=$(getent passwd 1000 | cut -d: -f1)
defaultuserhome=$(getent passwd 1000 | cut -d: -f6)
# hostname
if hostname | grep -q "^${defaultuser}-"
then
# remove old whoogle path if available
if [ -d /home/docker/whoogle.$(hostname) ]
then
docker-compose -f /home/docker/whoogle.$(hostname)/docker-compose.yml down
rm -rf /home/docker/whoogle.$(hostname)
fi
host=$(cat /etc/hostname | sed "s/^${defaultuser}-//")
hostnamectl set-hostname ${host}
fi
# domainname
if ! egrep -q "\.mint.${mydomain}$" /etc/hostname
then
@ -22,10 +39,9 @@ then
if [ -d /home/docker/whoogle.$(hostname) ]
then
docker-compose -f /home/docker/whoogle.$(hostname)/docker-compose.yml down
rm -r /home/docker/whoogle.$(hostname)
rm -rf /home/docker/whoogle.$(hostname)
fi
host=$(cat /etc/hostname | cut -d. -f1)
#echo "${host}.${mydomain}" | sudo tee /etc/hostname
hostnamectl set-hostname ${host}.mint.${mydomain}
fi
@ -86,10 +102,6 @@ done
sudo bash /usr/local/sbin/autoupdate.sh
# get default user
defaultuser=$(getent passwd 1000 | cut -d: -f1)
defaultuserhome=$(getent passwd 1000 | cut -d: -f6)
# Add User to docker group
sudo usermod -aG docker ${defaultuser}