From d05450175dd5cc1e7b0f72a6ea8ee635befba7c5 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 6 Jan 2024 01:51:45 +0300 Subject: [PATCH] ff... Signed-off-by: Alex A. Naanou --- ssh/make.sh | 178 ++++++++++++++++++++++++++-------------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/ssh/make.sh b/ssh/make.sh index 698aac1..fd4cf6c 100644 --- a/ssh/make.sh +++ b/ssh/make.sh @@ -1,89 +1,89 @@ -#!/usr/bin/bash -#---------------------------------------------------------------------- - -cd $(dirname $0) -PATH=$PATH:$(dirname "$(pwd)") - - -#---------------------------------------------------------------------- - -source ../.pct-helpers - - -#---------------------------------------------------------------------- - -[ -e ../config.global ] \ - && source ../config.global - -[ -e ./config ] \ - && source ./config - - -#---------------------------------------------------------------------- - -DFL_ID=${DFL_ID:=102} -DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=ssh} - -DFL_RAM=${DFL_RAM:=1024} -DFL_SWAP=${DFL_SWAP:=${DFL_RAM:=1024}} -DFL_DRIVE=${DFL_DRIVE:=16} - -WAN_IP=- -WAN_GATE=- -ADMIN_IP=- -ADMIN_GATE=- -LAN_IP=- -LAN_GATE=- - -REBOOT=${REBOOT:=1} - -readVars - -xread "ssh user name: " USER - - -#---------------------------------------------------------------------- - -OPTS_STAGE_1="\ - --hostname $CTHOSTNAME \ - --memory $RAM \ - --swap $SWAP \ - --net0 name=lan,bridge=vmbr0,firewall=1,ip=dhcp,type=veth \ - --net1 name=admin,bridge=vmbr1,firewall=1,ip=dhcp,type=veth \ - --storage local-lvm \ - --rootfs local-lvm:$DRIVE \ - --unprivileged 1 \ - ${PCT_EXTRA} \ -" - -OPTS_STAGE_2="\ - --startup order=90,up=10 \ - --onboot 1 \ -" - - -#---------------------------------------------------------------------- - -echo "# Creating CT..." -pctCreateDebian $ID "${OPTS_STAGE_1}" "$PASS" - -echo "# Installing dependencies..." -@ lxc-attach $ID apt install vim htop iftop iotop tmux mc - -echo "# Setup: sshd..." -@ lxc-attach $ID -- systemctl enable ssh.socket --now - -echo "# Setup: user..." -@ lxc-attach $ID adduser $USER - -echo "# Post config..." -pctSet $ID "${OPTS_STAGE_2}" $REBOOT - -echo "# Done." - - - -#---------------------------------------------------------------------- -# vim:set ts=4 sw=4 : - - +#!/usr/bin/bash +#---------------------------------------------------------------------- + +cd $(dirname $0) +PATH=$PATH:$(dirname "$(pwd)") + + +#---------------------------------------------------------------------- + +source ../.pct-helpers + + +#---------------------------------------------------------------------- + +[ -e ../config.global ] \ + && source ../config.global + +[ -e ./config ] \ + && source ./config + + +#---------------------------------------------------------------------- + +DFL_ID=${DFL_ID:=102} +DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=ssh} + +DFL_RAM=${DFL_RAM:=1024} +DFL_SWAP=${DFL_SWAP:=${DFL_RAM:=1024}} +DFL_DRIVE=${DFL_DRIVE:=16} + +WAN_IP=- +WAN_GATE=- +ADMIN_IP=- +ADMIN_GATE=- +LAN_IP=- +LAN_GATE=- + +REBOOT=${REBOOT:=1} + +readVars + +xread "ssh user name: " USER + + +#---------------------------------------------------------------------- + +OPTS_STAGE_1="\ + --hostname $CTHOSTNAME \ + --memory $RAM \ + --swap $SWAP \ + --net0 name=lan,bridge=vmbr0,firewall=1,ip=dhcp,type=veth \ + --net1 name=admin,bridge=vmbr1,firewall=1,ip=dhcp,type=veth \ + --storage local-lvm \ + --rootfs local-lvm:$DRIVE \ + --unprivileged 1 \ + ${PCT_EXTRA} \ +" + +OPTS_STAGE_2="\ + --startup order=90,up=10 \ + --onboot 1 \ +" + + +#---------------------------------------------------------------------- + +echo "# Creating CT..." +pctCreateDebian $ID "${OPTS_STAGE_1}" "$PASS" + +echo "# Installing dependencies..." +@ lxc-attach $ID apt install vim htop iftop iotop tmux mc + +echo "# Setup: sshd..." +@ lxc-attach $ID -- systemctl enable ssh.socket --now + +echo "# Setup: user..." +@ lxc-attach $ID adduser $USER + +echo "# Post config..." +pctSet $ID "${OPTS_STAGE_2}" $REBOOT + +echo "# Done." + + + +#---------------------------------------------------------------------- +# vim:set ts=4 sw=4 : + +