mirror of
https://github.com/bashclub/zamba-lxc-toolbox.git
synced 2024-11-07 19:31:58 +01:00
Reworked install.sh, implemented #6
This commit is contained in:
parent
c28a67a430
commit
2b917c02e8
107
install.sh
107
install.sh
@ -19,6 +19,59 @@
|
||||
# Load configuration file
|
||||
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.
|
||||
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)
|
||||
@ -53,58 +106,16 @@ else
|
||||
VLAN=""
|
||||
fi
|
||||
# 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;
|
||||
|
||||
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;
|
||||
sleep 5;
|
||||
# Set the root password and key
|
||||
|
@ -23,10 +23,6 @@ LXC_SHAREFS_SIZE="100"
|
||||
LXC_SHAREFS_STORAGE="local-zfs"
|
||||
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
|
||||
LXC_MEM="1024"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user