Compare commits

..

No commits in common. "5f88f39dece3dfd56cc433f2146294ba4e2c497b" and "61ac0642156ec661f84ec42135af1ddeceeb379c" have entirely different histories.

8 changed files with 29 additions and 105 deletions

View File

@ -147,12 +147,6 @@ normpath(){
# see:
# https://pve.proxmox.com/wiki/Linux_Container
getLatestTemplate(){
if [ $DRY_RUN ] ; then
[ -z $2 ] \
|| eval "$2=${CT_TEMPLATE:-\\\$CT_TEMPLATE}"
return
fi
#IFS=$'\n'
#@ pveam update
@ -171,17 +165,14 @@ getLatestTemplate(){
#
# xread [-n] MSG VAR
#
# This saves all user input variables to the $XREAD_VARS array.
xread(){
local non_empty=
if [[ $1 == '-n' ]] ; then
shift
local non_empty=1
fi
if [ -z ${!2} ] ; then
eval 'read -ep "'$1'" -i "$DFL_'$2'" '${2}''
XREAD_VARS+=(${2})
fi
[ -z ${!2} ] \
&& eval 'read -ep "'$1'" -i "$DFL_'$2'" '${2}''
if [ -z $non_empty ] ; then
eval ''$2'=${'$2':=$DFL_'$2'}'
fi
@ -243,51 +234,16 @@ tklWaitForSetup(){
#
# readConfig
#
# Envioronment variables:
# CLEAN_RUN - if set ignore ./config.last-run
# CONFIG - config file to load last
#
#
readConfig(){
if [ -z $NO_DEFAULTS ] ; then
[ -e ../config.global ] \
&& source ../config.global
[ -e ./config ] \
&& source ./config
# XXX is this the right priority for this???
[ -e ./config.last-run ] \
&& [ -z $CLEAN_RUN ] \
&& source ./config.last-run
[ -e "$CONFIG" ] \
&& source $CONFIG
fi
}
#
# saveConfig [-d] CONFIG VAR ..
#
saveConfig(){
local prefix=
if [ $1 == '-d' ] ; then
prefix=DFL_
shift
fi
local cfg=$1
shift
{
for var in $@ ; do
echo "${prefix}${var}=${!var}"
done
} > $cfg
}
saveLastRunConfig(){
echo "# Saving config to: config.last-run"
saveConfig -d config.last-run ${XREAD_VARS[@]}
}
#
# readVars
#

View File

@ -1,66 +1,45 @@
#----------------------------------------------------------------------
#
#
# TODO:
# - cleanup/destroy
# - update
# - backup
# - pull config
#
#----------------------------------------------------------------------
# NOTE: The order here is important:
# - to avoid bootstrapping network connections gate must be the
# first CT to get built to route the rest of CT's to the WAN
# connection during the build process.
# - ns should be the second to be built to provide the rest of the
# CT's with DHCP network configuration.
# - the rest of the CT's are created in order of importance, strting
# from CT's needed for access and ending with services.
CTs := \
gate \
ns \
ssh \
wireguard \
syncthing \
nextcloud \
gitea
#----------------------------------------------------------------------
.PHONY: FORCE
FORCE:
%: %/make.sh FORCE
$<
config.global: config.global.example
vim "+0r config.global.example" $@
#----------------------------------------------------------------------
# Shorthands...
.PHONY: config
config: config.global
.PHONY: gate
gate: gate-traefik
gate: ./gate-traefik
$</make.sh
.PHONY: ns
ns:
$@/make.sh
.PHONY: ssh
ssh:
$@/make.sh
.PHONY: wireguard
wireguard:
$@/make.sh
.PHONY: syncthing
syncthing:
$@/make.sh
.PHONY: nextcloud
nextcloud:
$@/make.sh
.PHONY: gitea
gitea:
$@/make.sh
#----------------------------------------------------------------------
.PHONY: all
all: config $(CTs)
all: config gate ns ssh wireguard syncthing nextcloud gitea
#----------------------------------------------------------------------

View File

@ -95,8 +95,6 @@ echo "# Setup: iptables update script..."
echo "# Post config..."
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
saveLastRunConfig
echo "# Done."

View File

@ -115,7 +115,6 @@ echo "# Updating system..."
echo "# Post config..."
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
saveLastRunConfig
echo "# Done."

View File

@ -84,8 +84,6 @@ echo "# Setup: dnsmasq..."
echo "# Post config..."
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
saveLastRunConfig
echo "# Done."

View File

@ -82,8 +82,6 @@ done
echo "# Post config..."
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
saveLastRunConfig
echo "# Done."

View File

@ -80,8 +80,6 @@ sleep ${TIMEOUT:=5}
echo "# Post config..."
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
saveLastRunConfig
echo "# Done."

View File

@ -106,8 +106,6 @@ echo "# client config:"
echo "# Post config..."
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
saveLastRunConfig
echo "# Done."