mint.sh gelöscht

This commit is contained in:
olli 2023-11-23 12:40:49 +01:00
parent 8ed0bcd0d9
commit 35c08ae9a9

190
mint.sh
View File

@ -1,190 +0,0 @@
#!/bin/bash -e
mydomain="ds9.dedyn.io"
echo "!!! ACHTUNG !!!
Dieses Skript richtet Linux Mint nach bestimmten Vorgaben (größtenteils über Ansible Playbooks) ein und installiert neue Software
Dies setzt auch die Eingabe des sudo/root-Passwortes voraus.
Der Code kann hier eingesehen werden:
https://gitea.${mydomain}/olli/linux-mint
Nutzung auf einene Gefahr!!! Nur mit Enter/Return fortfahren wenn dieses Skript wirklich von der oben erwähnten Quelle stammt und Vertrauen besteht.
"
whoami | grep -q ^root$ || read x
# Check for using DoHoT
if [ -s /etc/dnscrypt-proxy/blocked-names.txt ]
then
if [ -s /etc/dontusedohot ]
then
if [ -s /etc/systemd/resolved.conf.d/DoHoT.conf ]
then
sudo rm -f /etc/systemd/resolved.conf.d/DoHoT.conf
sudo systemctl restart systemd-resolved.service
fi
fi
fi
# 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 | sudo sed "s/^${defaultuser}-//")
hostnamectl set-hostname ${host}
fi
# domainname
if ! egrep -q "\.mint.${mydomain}$" /etc/hostname
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 | cut -d. -f1)
hostnamectl set-hostname ${host}.mint.${mydomain}
fi
# fix for creating notify.sh dir from docker start if file not present
[ -d /usr/local/bin/notify.sh ] && rmdir /usr/local/bin/notify.sh
# remove old updater if exists
[ -f /etc/cron.d/mint-config-update ] && rm /etc/cron.d/mint-config-update
# Cleanup broken installs and packages
sudo DEBIAN_FRONTEND=noninteractive dpkg --configure -a
sudo DEBIAN_FRONTEND=noninteractive apt-get -y autoremove --purge
sudo DEBIAN_FRONTEND=noninteractive apt-get -y autoclean
# Removes icaclient and videodownloadhelper aptitude search '~o'
#sudo DEBIAN_FRONTEND=noninteractive apt-get -y purge '~o'
sudo DEBIAN_FRONTEND=noninteractive apt-get -y purge '~o ~M !?reverse-depends(~i) !~E'
# systemupdate
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade
# install ansible
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install python3-pip git
sudo pip install ansible
# install mscore fonts
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install ttf-mscorefonts-installer
# get upstream release vars (needed for docker ubuntu repos)
. /etc/upstream-release/lsb-release
# prepare release update for next reboot
sudo sed -i 's/ vera / victoria /g' /etc/apt/sources.list.d/official-package-repositories.list
sudo sed -i 's/ vanessa / victoria /g' /etc/apt/sources.list.d/official-package-repositories.list
# run ansible playbooks
for playbook in debian.ansible.basics \
gtc-rename \
gtc-crypt \
gtc-x11vnc \
linux-mint \
firefox \
chromium \
debian.ansible.docker \
debian.ansible.traefik.server \
debian.ansible.whoogle \
debian.ansible.firewall \
debian.ansible.tornet.network \
debian.ansible.vnet.network \
debian.ansible.autoupdate \
debian.ansible.dedyn.client
do
sudo rm -rf ${playbook}
git clone https://gitea.${mydomain}/olli/${playbook}.git
sudo ansible-playbook -e ansible_distribution=${DISTRIB_ID} -e ansible_distribution_release=${DISTRIB_CODENAME} --connection=local --inventory $(hostname), --limit $(hostname) ${playbook}/*.yml
sudo rm -rf ${playbook}
done
sudo bash /usr/local/sbin/autoupdate.sh
# Add User to docker group
sudo usermod -aG docker ${defaultuser}
# Personal settings with .xsessionrc
sudo cat <<EOF >${defaultuserhome}/.xsessionrc
#!/bin/bash
# Clean GPU Cache of Element
# https://github.com/vector-im/element-web/issues/25776
rm -rf ~/.var/app/im.riot.Riot/config/Element/GPUCache
# Backup only if autologin deactivated
if ! grep -qr ^autologin-user= /etc/lightdm
then
if [ -f ~/Nextcloud/scripts/backup-this-device.sh ]
then
gnome-terminal --hide-menubar --title=BACKUP --geometry=120x35 -- bash ~/Nextcloud/scripts/backup-this-device.sh
elif [ -f ~/scripts/backup-this-device.sh ]
then
gnome-terminal --hide-menubar --title=BACKUP --geometry=120x35 -- bash ~/scripts/backup-this-device.sh
elif [ -f ~/.scripts/backup-this-device.sh ]
then
gnome-terminal --hide-menubar --title=BACKUP --geometry=120x35 -- bash ~/.scripts/backup-this-device.sh
fi
fi
# Autoupdate flatpak and cinnamon
dconf write /com/linuxmint/updates/auto-update-cinnamon-spices true
dconf write /com/linuxmint/updates/auto-update-flatpaks true
# disable saving recent files
dconf write /org/cinnamon/desktop/privacy/remember-recent-files false
# Touchpad Scrolling
dconf write /org/cinnamon/desktop/peripherals/touchpad/edge-scrolling-enabled true
dconf write /org/cinnamon/desktop/peripherals/touchpad/two-finger-scrolling-enabled false
# Terminus font in Terminal
#dconf write "/org/gnome/terminal$(dconf dump /org/gnome/terminal/ | egrep '/profiles:...*' | sed 's/\[//g ; s/\]//g; s/\/$//')/font" "'Terminus (TTF) Medium 12'"
# Winkey+l=Locksreen
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom8/command '"cinnamon-screensaver-command --lock"'
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom8/binding "['<Mod4>l']"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom8/name '"Lockscreen"'
dconf write /org/cinnamon/desktop/keybindings/custom-list "['__dummy__'$(dconf dump / 2>&1 | egrep '^\[org/cinnamon/desktop/keybindings/custom-keybindings/' | cut -d/ -f 6 | cut -d] -f1 | perl -pe "s/(.+)\n/, '\$1'/g")]"
# dark theme
#dconf write /org/cinnamon/desktop/interface/gtk-theme "'Mint-Y-Dark'"
#dconf write /org/cinnamon/desktop/interface/icon-theme "'Mint-Y-Dark'"
# Nemo Filemanager Settings
dconf write /org/nemo/preferences/default-folder-viewer "'list-view'"
dconf write /org/nemo/preferences/show-location-entry true
# Traditional Cinnamon task bar (https://forums.linuxmint.com/viewtopic.php?t=321872)
dconf write /org/cinnamon/panels-enabled "['1:0:bottom']"
dconf write /org/cinnamon/panels-height "['1:27']"
dconf write /org/cinnamon/panel-zone-icon-sizes '[{"left":0,"center":0,"right":0,"panelId":1}]'
dconf write /org/cinnamon/enabled-applets "['panel1:left:0:menu@cinnamon.org','panel1:left:1:show-desktop@cinnamon.org','panel1:left:2:panel-launchers@cinnamon.org','panel1:left:3:window-list@cinnamon.org','panel1:right:0:systray@cinnamon.org','panel1:right:1:xapp-status@cinnamon.org','panel1:right:2:keyboard@cinnamon.org','panel1:right:3:notifications@cinnamon.org','panel1:right:4:printers@cinnamon.org','panel1:right:5:removable-drives@cinnamon.org','panel1:right:6:user@cinnamon.org','panel1:right:7:network@cinnamon.org','panel1:right:8:sound@cinnamon.org','panel1:right:9:power@cinnamon.org','panel1:right:10:calendar@cinnamon.org']"
dconf write /org/cinnamon/theme/name "'Linux Mint'"
#cinnamon --replace > /dev/null 2>&1 & disown
[ -x ~/.xsessionrc.followup ] && ~/.xsessionrc.followup
EOF
sudo chmod 700 "${defaultuserhome}"/.xsessionrc
sudo chown ${defaultuser}. "${defaultuserhome}"/.xsessionrc
date
echo done