linux-mint/mint.sh

180 lines
6.2 KiB
Bash
Raw Normal View History

2022-07-22 10:08:29 +02:00
#!/bin/bash -e
2022-07-06 12:29:48 +02:00
2023-07-18 14:02:12 +02:00
mydomain="ds9.dedyn.io"
2023-07-03 16:00:21 +02:00
2022-07-22 10:05:57 +02:00
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:
2023-07-03 16:00:21 +02:00
https://gitea.${mydomain}/olli/linux-mint
2022-07-22 10:05:57 +02:00
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
2022-07-22 10:05:57 +02:00
2023-08-09 16:42:11 +02:00
# Check for using DoHoT
2023-08-09 16:43:53 +02:00
if [ -s /etc/dnscrypt-proxy/blocked-names.txt ]
2023-08-09 16:42:11 +02:00
then
if [ -s /etc/dontusedohot ]
then
2023-08-09 16:43:53 +02:00
if [ -s /etc/systemd/resolved.conf.d/DoHoT.conf ]
2023-08-09 16:42:11 +02:00
then
sudo rm -f /etc/systemd/resolved.conf.d/DoHoT.conf
sudo systemctl restart systemd-resolved.service
fi
fi
fi
2023-07-19 14:23:21 +02:00
# 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
2023-07-03 16:00:21 +02:00
# domainname
2023-07-18 14:02:12 +02:00
if ! egrep -q "\.mint.${mydomain}$" /etc/hostname
2023-07-03 16:00:21 +02:00
then
2023-07-03 17:36:41 +02:00
# remove old whoogle path if available
if [ -d /home/docker/whoogle.$(hostname) ]
then
docker-compose -f /home/docker/whoogle.$(hostname)/docker-compose.yml down
2023-07-19 14:23:21 +02:00
rm -rf /home/docker/whoogle.$(hostname)
2023-07-03 17:36:41 +02:00
fi
2023-07-03 16:00:21 +02:00
host=$(cat /etc/hostname | cut -d. -f1)
2023-07-18 14:02:12 +02:00
hostnamectl set-hostname ${host}.mint.${mydomain}
2023-07-03 16:00:21 +02:00
fi
2023-07-07 09:37:39 +02:00
# 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
2023-07-18 13:53:37 +02:00
# remove old updater if exists
[ -f /etc/cron.d/mint-config-update ] && rm /etc/cron.d/mint-config-update
2022-07-22 10:08:29 +02:00
set -x
2023-07-18 17:07:36 +02:00
# Cleanup broken installs and packages
2023-04-28 12:39:18 +02:00
sudo DEBIAN_FRONTEND=noninteractive dpkg --configure -a
2023-07-18 17:22:19 +02:00
sudo DEBIAN_FRONTEND=noninteractive apt-get -y autoremove --purge
2023-07-18 17:07:36 +02:00
sudo DEBIAN_FRONTEND=noninteractive apt-get -y autoclean
2023-07-24 18:07:38 +02:00
# Removes icaclient and videodownloadhelper aptitude search '~o'
#sudo DEBIAN_FRONTEND=noninteractive apt-get -y purge '~o'
2023-07-25 11:36:26 +02:00
sudo DEBIAN_FRONTEND=noninteractive apt-get -y purge '~o ~M !?reverse-depends(~i) !~E'
2023-04-19 12:29:47 +02:00
# systemupdate
2023-04-28 12:39:18 +02:00
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade
2022-07-06 15:16:44 +02:00
# install ansible
2023-04-28 12:39:18 +02:00
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install python3-pip git
sudo pip install ansible
2022-07-06 12:29:48 +02:00
2022-07-09 18:06:46 +02:00
# install mscore fonts
2022-07-09 18:05:31 +02:00
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
2023-04-28 12:39:18 +02:00
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
2023-07-18 15:17:52 +02:00
# prepare release update for next reboot
2023-07-18 15:59:10 +02:00
sed -i 's/ vera / victoria /g' /etc/apt/sources.list.d/official-package-repositories.list
2023-07-27 17:05:25 +02:00
sed -i 's/ vanessa / victoria /g' /etc/apt/sources.list.d/official-package-repositories.list
2023-07-18 15:17:52 +02:00
2022-07-08 14:23:07 +02:00
# run ansible playbooks
2022-07-22 10:23:58 +02:00
for playbook in debian.ansible.basics \
gtc-rename \
gtc-crypt \
2022-11-17 14:03:01 +01:00
gtc-x11vnc \
2022-07-25 14:18:13 +02:00
linux-mint \
2022-07-25 14:35:18 +02:00
firefox \
chromium \
2022-07-25 14:14:40 +02:00
debian.ansible.docker \
2022-12-21 15:21:27 +01:00
debian.ansible.traefik.server \
debian.ansible.whoogle \
2022-07-25 14:14:40 +02:00
debian.ansible.firewall \
debian.ansible.tornet.network \
2023-05-02 16:33:53 +02:00
debian.ansible.vnet.network \
2023-07-03 17:33:15 +02:00
debian.ansible.autoupdate \
2023-05-02 16:33:53 +02:00
debian.ansible.dedyn.client
2022-07-08 14:23:07 +02:00
do
2022-07-22 16:52:02 +02:00
sudo rm -rf ${playbook}
2023-07-03 16:00:21 +02:00
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
2022-07-12 15:10:16 +02:00
sudo rm -rf ${playbook}
2022-07-08 14:23:07 +02:00
done
2022-07-08 10:56:16 +02:00
2023-08-09 16:42:11 +02:00
sudo bash -x /usr/local/sbin/autoupdate.sh
2023-07-28 16:48:29 +02:00
2022-12-27 22:22:11 +01:00
# Add User to docker group
2023-07-18 14:52:06 +02:00
sudo usermod -aG docker ${defaultuser}
2022-12-27 22:22:11 +01:00
2023-07-18 14:40:26 +02:00
# Personal settings with .xsessionrc
sudo cat <<EOF >${defaultuserhome}/.xsessionrc
#!/bin/bash
2023-07-18 14:36:20 +02:00
2023-07-18 14:40:26 +02:00
# Backup only if autologin deactivated
2023-07-18 14:36:20 +02:00
if ! grep -qr ^autologin-user= /etc/lightdm
then
2023-07-18 14:40:26 +02:00
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
2022-07-22 12:37:44 +02:00
2022-07-12 10:56:38 +02:00
# Autoupdate flatpak and cinnamon
dconf write /com/linuxmint/updates/auto-update-cinnamon-spices true
dconf write /com/linuxmint/updates/auto-update-flatpaks true
2022-07-08 11:27:06 +02:00
# disable saving recent files
dconf write /org/cinnamon/desktop/privacy/remember-recent-files false
2022-08-02 20:48:48 +02:00
# 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
2022-07-10 12:04:41 +02:00
# Terminus font in Terminal
2022-08-02 20:48:48 +02:00
#dconf write "/org/gnome/terminal$(dconf dump /org/gnome/terminal/ | egrep '/profiles:...*' | sed 's/\[//g ; s/\]//g; s/\/$//')/font" "'Terminus (TTF) Medium 12'"
2022-07-10 12:04:41 +02:00
2022-07-18 21:31:58 +02:00
# 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")]"
2023-07-18 14:36:20 +02:00
# dark theme
#dconf write /org/cinnamon/desktop/interface/gtk-theme "'Mint-Y-Dark'"
#dconf write /org/cinnamon/desktop/interface/icon-theme "'Mint-Y-Dark'"
2022-08-01 14:06:58 +02:00
# Nemo Filemanager Settings
dconf write /org/nemo/preferences/default-folder-viewer "'list-view'"
dconf write /org/nemo/preferences/show-location-entry true
2023-07-27 15:53:31 +02:00
[ -x ~/.xsessionrc.followup ] && ~/.xsessionrc.followup
2023-07-18 14:36:20 +02:00
EOF
2022-08-01 14:06:58 +02:00
2023-07-18 14:40:59 +02:00
sudo chmod 700 "${defaultuserhome}"/.xsessionrc
sudo chown ${defaultuser}. "${defaultuserhome}"/.xsessionrc
2023-08-09 16:51:43 +02:00
date
echo done