Move Service constants to extra file

This commit is contained in:
thorstenspille 2021-04-23 19:39:58 +02:00
parent acd8024058
commit 7eec15df1c

View File

@ -19,9 +19,6 @@
# Load configuration file # Load configuration file
source $PWD/zamba.conf source $PWD/zamba.conf
LXC_MP="0"
LXC_UNPRIVILEGED="1"
LXC_NESTING="0"
select opt in zmb-standalone zmb-ad zmb-member mailpiler matrix debian-unpriv debian-priv quit; do select opt in zmb-standalone zmb-ad zmb-member mailpiler matrix debian-unpriv debian-priv quit; do
case $opt in case $opt in
@ -31,30 +28,22 @@ select opt in zmb-standalone zmb-ad zmb-member mailpiler matrix debian-unpriv de
;; ;;
debian-priv) debian-priv)
echo "Debian-only LXC container privileged mode selected" echo "Debian-only LXC container privileged mode selected"
LXC_UNPRIVILEGED="0"
break break
;; ;;
zmb-standalone) zmb-standalone)
echo "Configuring LXC container '$opt'!" echo "Configuring LXC container '$opt'!"
LXC_MP="1"
LXC_UNPRIVILEGED="0"
break break
;; ;;
zmb-member) zmb-member)
echo "Configuring LXC container '$opt'!" echo "Configuring LXC container '$opt'!"
LXC_MP="1"
LXC_UNPRIVILEGED="0"
break break
;; ;;
zmb-ad) zmb-ad)
echo "Selected Zamba AD DC" echo "Selected Zamba AD DC"
LXC_NESTING="1"
LXC_UNPRIVILEGED="0"
break break
;; ;;
mailpiler) mailpiler)
echo "Configuring LXC container for '$opt'!" echo "Configuring LXC container for '$opt'!"
LXC_NESTING="1"
break break
;; ;;
matrix) matrix)
@ -72,6 +61,8 @@ select opt in zmb-standalone zmb-ad zmb-member mailpiler matrix debian-unpriv de
esac esac
done done
source $PWD/src/$opt/constants-service.conf
# CHeck is the newest template available, else download it. # CHeck is the newest template available, else download it.
DEB_LOC=$(pveam list $LXC_TEMPLATE_STORAGE | grep debian-10-standard | cut -d'_' -f2) DEB_LOC=$(pveam list $LXC_TEMPLATE_STORAGE | grep debian-10-standard | cut -d'_' -f2)
DEB_REP=$(pveam available --section system | grep debian-10-standard | cut -d'_' -f2) DEB_REP=$(pveam available --section system | grep debian-10-standard | cut -d'_' -f2)
@ -119,20 +110,20 @@ PS3="Select the Server-Function: "
pct start $LXC_NBR; pct start $LXC_NBR;
sleep 5; sleep 5;
# Set the root password and key # Set the root password and key
echo "Setting root password"
echo -e "$LXC_PWD\n$LXC_PWD" | lxc-attach -n$LXC_NBR passwd; echo -e "$LXC_PWD\n$LXC_PWD" | lxc-attach -n$LXC_NBR passwd;
echo "Creating /root/.ssh" lxc-attach -n$LXC_NBR mkdir -p /root/.ssh;
lxc-attach -n$LXC_NBR mkdir /root/.ssh; pct push $LXC_AUTHORIZED_KEY /root/.ssh/authorized_keys
echo "Copying authorized_keys" pct push $LXC_NBR $PWD/src/sources.list /etc/apt/sources.list
pct push $LXC_NBR $LXC_AUTHORIZED_KEY /root/.ssh/authorized_keys pct push $LXC_NBR $PWD/zamba.conf /root/zamba.conf
echo "Copying sources.list" pct push $LXC_NBR $PWD/src/constants.conf /root/constants.conf
pct push $LXC_NBR ./sources.list /etc/apt/sources.list pct push $LXC_NBR $PWD/src/lxc-base.sh /root/lxc-base.sh
echo "Copying zamba.conf" pct push $LXC_NBR $PWD/src/$opt/install-service.sh /root/install-service.sh
pct push $LXC_NBR ./zamba.conf /root/zamba.conf pct push $LXC_NBR $PWD/src/$opt/constants-service.conf /root/constants-service.conf
echo "Copying install script"
pct push $LXC_NBR ./$opt.sh /root/$opt.sh echo "Installing basic container setup..."
pct push $LXC_NBR $PWD/src/lxc-base.sh /root/lxc-base.sh
echo "Install '$opt'!" echo "Install '$opt'!"
lxc-attach -n$LXC_NBR bash /root/$opt.sh lxc-attach -n$LXC_NBR bash /root/install-service.sh
if [[ $opt == "zmb-ad" ]]; then if [[ $opt == "zmb-ad" ]]; then
pct stop $LXC_NBR pct stop $LXC_NBR