linux-mint/mint.sh
2023-07-03 17:44:28 +02:00

123 lines
4.5 KiB
Bash

#!/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
# domainname
if ! egrep -q "\.${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 -r /home/docker/whoogle.$(hostname)
fi
host=$(cat /etc/hostname | cut -d. -f1)
#echo "${host}.${mydomain}" | sudo tee /etc/hostname
hostnamectl set-hostname ${host}.${mydomain}
fi
set -x
# Cleanup broken installs
sudo DEBIAN_FRONTEND=noninteractive dpkg --configure -a
sudo DEBIAN_FRONTEND=noninteractive apt-get -y autoremove
# 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
# 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 $(whoami)
# Backup-Script only if autologin deactivated
grep -qr ^autologin-user= /etc/lightdm || echo '#!/bin/bash
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
' >~/.xsessionrc
[ -f ~/.xsessionrc ] && chmod 700 ~/.xsessionrc
# 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")]"
# Nemo Filemanager Settings
dconf write /org/nemo/preferences/default-folder-viewer "'list-view'"
dconf write /org/nemo/preferences/show-location-entry true
# dark theme
#dconf write /org/cinnamon/desktop/interface/gtk-theme "'Mint-Y-Dark'"
#dconf write /org/cinnamon/desktop/interface/icon-theme "'Mint-Y-Dark'"