This commit is contained in:
olli 2023-11-24 20:25:41 +01:00
parent cba64086dc
commit d896db4140
2 changed files with 220 additions and 220 deletions

View File

@ -1,31 +1,31 @@
#!/bin/bash #!/bin/bash
if whoami | grep -q ^root$ if whoami | grep -q ^root$
then then
# lockfile for systemd-service # lockfile for systemd-service
trap "rm -f /run/mint-config-update.sh.lock" EXIT trap "rm -f /run/mint-config-update.sh.lock" EXIT
echo $$ >/run/mint-config-update.sh.lock echo $$ >/run/mint-config-update.sh.lock
#if find /var/log/mint-config-update.sh.log -mmin -60 | grep -q /var/log/mint-config-update.sh.log #if find /var/log/mint-config-update.sh.log -mmin -60 | grep -q /var/log/mint-config-update.sh.log
#then #then
# echo "$0 was running already in the last 60 minutes" # echo "$0 was running already in the last 60 minutes"
# rm -f /run/mint-config-update.sh.lock # rm -f /run/mint-config-update.sh.lock
# sleep 60 # sleep 60
# exit 0 # exit 0
#fi #fi
fi fi
# download and run # download and run
until wget https://gitea.ds9.dedyn.io/olli/linux-mint/raw/branch/main/mint.sh -O /tmp/mint.sh until wget https://gitea.ds9.dedyn.io/olli/linux-mint/raw/branch/main/mint.sh -O /tmp/mint.sh
do do
echo "mint.sh could not be downloaded trying again in 5 seconds" echo "mint.sh could not be downloaded trying again in 5 seconds"
sleep 5 sleep 5
done done
cd /tmp cd /tmp
dos2unix mint.sh dos2unix mint.sh
bash -n mint.sh && bash mint.sh bash -n mint.sh && bash mint.sh
rm mint.sh rm mint.sh
echo "Skript beendet" echo "Skript beendet"
whoami | grep -q ^root$ && exit 0 whoami | grep -q ^root$ && exit 0
read x read x

378
mint.sh
View File

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