You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
4.8 KiB

#!/bin/bash
######### YOUR SETTINGS HERE #########
PXESERVER_IP=<PXESERVER>
######### DON'T CHANGE ANYTHING BELOW THIS LINE #########
#set variables
tftpdir="tftp://${PXESERVER_IP}"
LOG=/home/computerspende/auto-install.log
MAC=$(ip link | sed -n "/BROADCAST.*state UP/{n;p}" | tail -1 | tr -s " " | cut -d" " -f3)
category=$(hostnamectl | grep Chassis | cut -c 21-)
version=$(grep VERSION_ID /etc/os-release | grep -oP '(?<=").*(?=")')
distribid=$(awk -F" " '{print $1}' /etc/issue.net)
displaymanager=$(cat /etc/X11/default-display-manager)
if [[ $displaymanager = *lightdm* ]]; then
desktopdir=/home/computerspende/Schreibtisch
elif [[ $displaymanager = *gdm3* ]]; then
desktopdir=/home/computerspende/Schreibtisch
else
desktopdir=/home/computerspende/Desktop
fi
# Save start time
echo "--- START ${MAC} $(date) ---" >> ${LOG}
# save system details
echo "$category $version $displaymanager $MAC" >> ${LOG}
# prepare for installation
# add dependencies for anydesk
wget -qO - https://keys.anydesk.com/repos/DEB-GPG-KEY | apt-key add -
echo "deb http://deb.anydesk.com/ all main" > /etc/apt/sources.list.d/anydesk-stable.list
# System update and installing
sudo apt-get update -qq | tee -a ${LOG}
sudo apt-get dist-upgrade -y | tee -a ${LOG}
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo apt-get install -y \
ubuntu-restricted-extras \
apt-transport-https \
jq dialog \
html2ps \
vim \
dialog jq \
curl \
vlc \
gdebi \
gparted \
language-pack-de-base \
libreoffice \
libreoffice-l10n-de \
libreoffice-help-de \
libreoffice-help-en-gb \
libreoffice-l10n-en-gb \
firefox \
firefox-locale-de \
firefox-locale-en \
thunderbird \
thunderbird-locale-de \
thunderbird-locale-en \
thunderbird-locale-en-gb \
gimp \
wkhtmltopdf \
anydesk \
libqt5qml5 | tee -a ${LOG}
#INSTALL LIBDVD-PKG
echo "libdvd-pkg libdvd-pkg/build boolean true" | debconf-set-selections
echo "libdvd-pkg libdvd-pkg/post-invoke_hook-install boolean true" | debconf-set-selections
echo "libdvd-pkg libdvd-pkg/post-invoke_hook-remove boolean false" | debconf-set-selections
echo "libdvd-pkg libdvd-pkg/first-install note" | debconf-set-selections
echo "libdvd-pkg libdvd-pkg/upgrade note" | debconf-set-selections
echo "libdvd-pkg libdvd-pkg/accepted-libdvd-pkg-eula select true" | debconf-set-selections
sudo DEBIAN_FRONTEND=noninteractive apt-get install -qq -y libdvd-pkg libdvdcss2 < /dev/null > /dev/null
sudo dpkg-reconfigure -f noninteractive libdvd-pkg | tee -a ${LOG}
# dont work need help
# sudo wget "$tftpdir"/"angestoepselt.png" -P /usr/share/applications/
# sudo wget "$tftpdir"/"angestoepselt.desktop" -P /usr/share/applications/
# sudo ln -s /usr/share/applications/angestoepselt.desktop $desktopdir/
# sudo chmod a+x $desktopdir/angestoepselt.desktop
# sudo chown computerspende $desktopdir/*
#Laptop CHECK and install battery management
if [[ $category == "laptop" ]];
then
sudo apt-get install -y tlp acpi | tee -a ${LOG};
tlp start | tee -a ${LOG};
fi
# download manuals from repo
curl "$tftpdir"/pdf/"First_steps_with_Ubuntu_18.04.pdf" > $desktopdir/"Erste Schritte mit Ubuntu.pdf"
curl "$tftpdir"/pdf/"Erste_Schritte_mit_LibreOffice.pdf" > $desktopdir/"Erste Schritte mit Libreoffice.pdf"
curl "$tftpdir"/pdf/"Linux_Grundlagen.pdf" > $desktopdir/"Linux Grundlagen.pdf"
curl "$tftpdir"/pdf/BSI_Sicherheit_unter_Ubuntu.pdf > $desktopdir/"BSI Sicherheit unter Ubuntu.pdf"
# change repo
sudo rm /etc/apt/sources.list
sudo curl "$tftpdir"/"legacy/images/${distribid}_${version}_$(arch)/sources.list" > $HOME/sources.list
sudo mv "$HOME/sources.list" /etc/apt/ | tee -a ${LOG}
# Modify Gnome - set profile icon, default webbrowser, remove "Welcome to Ubuntu"
if [[ $displaymanager = *gdm3* ]]; then
curl "$tftpdir"/angestoepselt.png -O /home/computerspende/.face | tee -a ${LOG}
xdg-settings set default-web-browser firefox.desktop | tee -a ${LOG}
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop', 'firefox.desktop', 'thunderbird.desktop', 'libreoffice-startcenter.desktop', 'org.gnome.Software.desktop', 'gnome-control-center.desktop']" | tee -a ${LOG}
echo "yes" >> /home/computerspende/.config/gnome-initial-setup-done
fi
#DEACTIVATE ERROR MESSAGES ON THE SCREEN
sudo sed -i 's/1/0/g' /etc/default/apport | tee -a ${LOG}
# clean up & APT FIX
sudo dpkg --configure -a | tee -a ${LOG}
sudo apt-get -f -y install | tee -a ${LOG}
sudo apt-get clean | tee -a ${LOG}
sudo apt-get -y autoremove | tee -a ${LOG}
# housekeeping
sudo rm /home/computerspende/late_command.sh | tee -a ${LOG}
sudo rm /etc/xdg/autostart/late_command.desktop | tee -a ${LOG}
sudo sed -i '/computerspende/d' /etc/sudoers | tee -a ${LOG}
# Sync
sync
### post hardware to snipeIT
curl -sSL "$tftpdir"/post_hardware.sh | bash
# Save the end time
echo "----- END ${MAC} $(date) -----" >> ${LOG}
exit 0