Reworked install.sh, implemented #6

This commit is contained in:
Thorsten Spille 2021-04-17 10:13:49 +02:00
parent c28a67a430
commit 2b917c02e8
2 changed files with 59 additions and 52 deletions

View File

@ -19,6 +19,59 @@
# Load configuration file # Load configuration file
source ./zamba.conf source ./zamba.conf
LXC_MP="0"
LXC_UNPRIVILEGED="1"
LXC_NESTING="0"
select opt in just_lxc zmb-standalone zmb-member zmb-ad mailpiler matrix quit; do
case $opt in
deb-unpriv)
echo "Debian-only LXC container unprivileged mode selected"
break
;;
deb-priv)
echo "Debian-only LXC container privileged mode selected"
LXC_UNPRIVILEGED="0"
break
;;
zmb-standalone)
echo "Configuring LXC container '$opt'!"
LXC_MP="1"
LXC_UNPRIVILEGED="0"
break
;;
zmb-member)
echo "Configuring LXC container '$opt'!"
LXC_MP="1"
LXC_UNPRIVILEGED="0"
break
;;
zmb-ad)
echo "Selected Zamba AD DC"
LXC_NESTING="1"
LXC_UNPRIVILEGED="0"
break
;;
mailpiler)
echo "Configuring LXC container for '$opt'!"
LXC_NESTING="1"
break
;;
matrix)
echo "Install Matrix chat server and element web service"
break
;;
quit)
echo "Script aborted by user interaction."
exit 0
;;
*)
echo "Invalid option! Exiting..."
exit 1
;;
esac
done
# 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)
@ -53,58 +106,16 @@ else
VLAN="" VLAN=""
fi fi
# Reconfigure conatiner # Reconfigure conatiner
pct set $LXC_NBR -memory $LXC_MEM -swap $LXC_SWAP -hostname $LXC_HOSTNAME \-nameserver $LXC_DNS -searchdomain $LXC_DOMAIN -onboot 1 -timezone Europe/Berlin -net0 name=eth0,bridge=$LXC_BRIDGE,firewall=1,gw=$LXC_GW,ip=$LXC_IP,type=veth$VLAN; pct set $LXC_NBR -memory $LXC_MEM -swap $LXC_SWAP -hostname $LXC_HOSTNAME \-nameserver $LXC_DNS -searchdomain $LXC_DOMAIN -onboot 1 -timezone Europe/Berlin -features nesting=$LXC_NESTING -net0 name=eth0,bridge=$LXC_BRIDGE,firewall=1,gw=$LXC_GW,ip=$LXC_IP,type=veth$VLAN;
sleep 2
if [ $LXC_MP -gt 0 ]; then
pct set $LXC_NBR -mp0 $LXC_SHAREFS_STORAGE:$LXC_SHAREFS_SIZE,mp=/$LXC_SHAREFS_MOUNTPOINT
fi
sleep 2; sleep 2;
PS3="Select the Server-Function: " PS3="Select the Server-Function: "
select opt in just_lxc zmb-standalone zmb-member zmb-ad mailpiler matrix quit; do
case $opt in
just_lxc)
echo "Debian-only LXC container selected"
break
;;
zmb-standalone)
echo "Configuring LXC container '$opt'!"
pct set $LXC_NBR -mp0 $LXC_SHAREFS_STORAGE:$LXC_SHAREFS_SIZE,mp=/$LXC_SHAREFS_MOUNTPOINT
sleep 2;
break
;;
zmb-member)
echo "Configuring LXC container '$opt'!"
pct set $LXC_NBR -mp0 $LXC_SHAREFS_STORAGE:$LXC_SHAREFS_SIZE,mp=/$LXC_SHAREFS_MOUNTPOINT
sleep 2;
break
;;
zmb-ad)
echo "Selected Zamba AD DC"
# Enable nesting for ntp service
pct set $LXC_NBR -features nesting=1
sleep 2
break
;;
mailpiler)
echo "Configuring LXC container for '$opt'!"
pct set $LXC_NBR -features nesting=1
sleep 2;
break
;;
matrix)
echo "Install Matrix chat server and element web service"
break
;;
quit)
echo "Script aborted by user interaction."
exit 0
;;
*)
echo "Invalid option! Exiting..."
exit 1
;;
esac
done
pct start $LXC_NBR; pct start $LXC_NBR;
sleep 5; sleep 5;
# Set the root password and key # Set the root password and key

View File

@ -23,10 +23,6 @@ LXC_SHAREFS_SIZE="100"
LXC_SHAREFS_STORAGE="local-zfs" LXC_SHAREFS_STORAGE="local-zfs"
LXC_SHAREFS_MOUNTPOINT="tank" LXC_SHAREFS_MOUNTPOINT="tank"
# Define whether the container will be created in unprivileged (1) or privileged (0) mode
# For 'zmb_standalone', 'zmb_pdc', 'zmb_member' and 'mailpiler' the container needs to be created with 'unprivileged=0'
LXC_UNPRIVILEGED="0"
# Size of the RAM assigned to the container # Size of the RAM assigned to the container
LXC_MEM="1024" LXC_MEM="1024"