tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-01-03 20:13:51 +03:00
parent 01d57aa88a
commit 5282959b9b
4 changed files with 29 additions and 8 deletions

View File

@ -160,6 +160,8 @@ xread(){
} }
#
# readVars
# #
# Variables this handles: # Variables this handles:
# EMAIL # EMAIL
@ -233,7 +235,9 @@ readVars(){
} }
# buildAssets [TEMPLATES [ASSETS]] #
# buildAssets [TEMPLATES [ASSETS]]
#
buildAssets(){ buildAssets(){
local TEMPLATE_DIR=$1 local TEMPLATE_DIR=$1
TEMPLATE_DIR=${TEMPLATE_DIR:=templates} TEMPLATE_DIR=${TEMPLATE_DIR:=templates}
@ -264,7 +268,9 @@ buildAssets(){
} }
# pctCreate ID TEMPLATE ARGS [PASS] #
# pctCreate ID TEMPLATE ARGS [PASS]
#
pctCreate(){ pctCreate(){
local TMP_PASS=$(cat /dev/urandom | base64 | head -c ${TMP_PASS_LEN:=32}) local TMP_PASS=$(cat /dev/urandom | base64 | head -c ${TMP_PASS_LEN:=32})
# NOTE: we are not setting the password here to avoid printing it to the terminal... # NOTE: we are not setting the password here to avoid printing it to the terminal...
@ -281,13 +287,16 @@ pctCreate(){
fi fi
} }
# pctCreate ID ARGS [PASS] #
# pctCreate ID ARGS [PASS]
#
pctCreateAlpine(){ pctCreateAlpine(){
if [ $DRY_RUN ] ; then if [ $DRY_RUN ] ; then
local TEMPLATE=(/var/lib/vz/template/cache/alpine-3.18\*.tar.xz) local TEMPLATE=(/var/lib/vz/template/cache/alpine-3.18\*.tar.xz)
else else
local TEMPLATE=($(ls /var/lib/vz/template/cache/alpine-3.18*.tar.xz)) local TEMPLATE=($(ls /var/lib/vz/template/cache/alpine-3.18*.tar.xz))
fi fi
pctCreate $1 "${TEMPLATE[-1]}" "$2" "$3" pctCreate $1 "${TEMPLATE[-1]}" "$2" "$3"
@ lxc-attach $1 apk update @ lxc-attach $1 apk update
@ -295,7 +304,9 @@ pctCreateAlpine(){
} }
# pctSet ID [ARGS [REBOOT]] #
# pctSet ID [ARGS [REBOOT]]
#
pctSet(){ pctSet(){
[ "$2" ] \ [ "$2" ] \
&& @ pct set $1 \ && @ pct set $1 \

View File

@ -9,11 +9,11 @@ config: config.global
gate: gate-traefik gate: gate-traefik
cd $< && ./make.sh $</make.sh
ns: ns ns: ns
cd $< && ./make.sh $</make.sh
all: config gate ns all: config gate ns

View File

@ -1,11 +1,15 @@
#!/usr/bin/bash #!/usr/bin/bash
#---------------------------------------------------------------------- #----------------------------------------------------------------------
source ../.pct-helpers cd $(dirname $0)
PATH=$PATH:$(dirname "$(pwd)") PATH=$PATH:$(dirname "$(pwd)")
#----------------------------------------------------------------------
source ../.pct-helpers
#---------------------------------------------------------------------- #----------------------------------------------------------------------
[ -e ../config.global ] \ [ -e ../config.global ] \

View File

@ -1,6 +1,12 @@
#!/usr/bin/bash #!/usr/bin/bash
#---------------------------------------------------------------------- #----------------------------------------------------------------------
cd $(dirname $0)
PATH=$PATH:$(dirname "$(pwd)")
#----------------------------------------------------------------------
source ../.pct-helpers source ../.pct-helpers