164 lines
5.9 KiB
Bash
164 lines
5.9 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
|
|
|
|
# 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
|
|
# 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
|
|
|
|
|
|
set -x
|
|
|
|
# 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
|
|
sed -i 's/ vera / victoria /g' /etc/apt/sources.list.d/official-package-repositories.list
|
|
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
|
|
|
|
# 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
|
|
|
|
[ -x ~/.xsessionrc.followup ] && ~/.xsessionrc.followup
|
|
|
|
EOF
|
|
|
|
sudo chmod 700 "${defaultuserhome}"/.xsessionrc
|
|
sudo chown ${defaultuser}. "${defaultuserhome}"/.xsessionrc
|