2021-04-08 20:32:56 +02:00
|
|
|
#!/bin/bash
|
2022-05-21 17:12:33 +02:00
|
|
|
set -euo pipefail
|
2021-04-08 20:32:56 +02:00
|
|
|
|
2021-04-08 21:14:14 +02:00
|
|
|
# Authors:
|
|
|
|
# (C) 2021 Idea an concept by Christian Zengel <christian@sysops.de>
|
2021-04-16 17:00:31 +02:00
|
|
|
# (C) 2021 Script design and prototype by Markus Helmke <m.helmke@nettwarker.de>
|
2021-04-09 18:10:07 +02:00
|
|
|
# (C) 2021 Script rework and documentation by Thorsten Spille <thorsten@spille-edv.de>
|
2021-04-08 21:14:14 +02:00
|
|
|
|
2021-04-24 00:00:27 +02:00
|
|
|
# load configuration
|
|
|
|
echo "Loading configuration..."
|
2022-05-21 23:40:31 +02:00
|
|
|
source /root/functions.sh
|
2021-04-12 23:48:49 +02:00
|
|
|
source /root/zamba.conf
|
2021-04-24 00:00:27 +02:00
|
|
|
source /root/constants.conf
|
2022-01-14 22:44:06 +01:00
|
|
|
source /root/constants-service.conf
|
2021-04-12 23:48:49 +02:00
|
|
|
|
2021-04-24 00:00:27 +02:00
|
|
|
echo "Updating locales"
|
|
|
|
# update locales
|
2021-04-20 21:48:21 +02:00
|
|
|
sed -i "s|# $LXC_LOCALE|$LXC_LOCALE|" /etc/locale.gen
|
|
|
|
cat << EOF > /etc/default/locale
|
|
|
|
LANG="$LXC_LOCALE"
|
|
|
|
LANGUAGE=$LXC_LOCALE
|
|
|
|
EOF
|
2022-01-14 22:44:06 +01:00
|
|
|
locale-gen $LXC_LOCALE
|
|
|
|
|
|
|
|
# Generate sources
|
|
|
|
if [ "$LXC_TEMPLATE_VERSION" == "debian-11-standard" ] ; then
|
|
|
|
|
|
|
|
cat << EOF > /etc/apt/sources.list
|
2023-01-09 22:52:45 +01:00
|
|
|
deb http://debian.inf.tu-dresden.de/debian bullseye main contrib
|
2022-01-14 22:44:06 +01:00
|
|
|
|
2023-01-09 22:52:45 +01:00
|
|
|
deb http://debian.inf.tu-dresden.de/debian bullseye-updates main contrib
|
2022-01-14 22:44:06 +01:00
|
|
|
|
|
|
|
# security updates
|
2023-01-09 22:52:45 +01:00
|
|
|
deb http://debian.inf.tu-dresden.de/debian-security bullseye-security main contrib
|
2022-01-14 22:44:06 +01:00
|
|
|
EOF
|
|
|
|
|
|
|
|
elif [ "$LXC_TEMPLATE_VERSION" == "debian-10-standard" ] ; then
|
|
|
|
|
|
|
|
cat << EOF > /etc/apt/sources.list
|
2023-01-09 22:52:45 +01:00
|
|
|
deb http://debian.inf.tu-dresden.de/debian buster main contrib
|
2022-01-14 22:44:06 +01:00
|
|
|
|
2023-01-09 22:52:45 +01:00
|
|
|
deb http://debian.inf.tu-dresden.de/debian buster-updates main contrib
|
2022-01-14 22:44:06 +01:00
|
|
|
|
|
|
|
# security updates
|
2023-01-09 22:52:45 +01:00
|
|
|
deb http://debian.inf.tu-dresden.de/debian-security buster/updates main contrib
|
2022-01-14 22:44:06 +01:00
|
|
|
EOF
|
|
|
|
else echo "LXC Debian Version false. Please check configuration files!" ; exit
|
|
|
|
fi
|
2021-04-20 21:48:21 +02:00
|
|
|
|
2021-04-24 00:00:27 +02:00
|
|
|
# update package lists
|
|
|
|
echo "Updating package database..."
|
2022-01-14 22:44:06 +01:00
|
|
|
apt --allow-releaseinfo-change update
|
2021-04-24 00:00:27 +02:00
|
|
|
|
|
|
|
# install latest packages
|
|
|
|
echo "Installing latest updates"
|
2021-04-14 00:58:25 +02:00
|
|
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq dist-upgrade
|
2021-04-24 00:00:27 +02:00
|
|
|
|
|
|
|
# install toolset
|
|
|
|
echo "Installing preconfigured toolset..."
|
|
|
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" $LXC_TOOLSET_BASE $LXC_TOOLSET
|
|
|
|
|
|
|
|
echo "Enabling vim syntax highlighting..."
|
2021-04-16 17:00:31 +02:00
|
|
|
sed -i "s|\"syntax on|syntax on|g" /etc/vim/vimrc
|
2021-04-24 00:00:27 +02:00
|
|
|
if [ $LXC_VIM_BG_DARK -gt 0 ]; then
|
|
|
|
sed -i "s|\"set background=dark|set background=dark|g" /etc/vim/vimrc
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Basic container setup finished, continuing with service installation..."
|