mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-12-25 12:52:04 +00:00
Compare commits
No commits in common. "5f88f39dece3dfd56cc433f2146294ba4e2c497b" and "61ac0642156ec661f84ec42135af1ddeceeb379c" have entirely different histories.
5f88f39dec
...
61ac064215
50
.pct-helpers
50
.pct-helpers
@ -147,12 +147,6 @@ normpath(){
|
|||||||
# see:
|
# see:
|
||||||
# https://pve.proxmox.com/wiki/Linux_Container
|
# https://pve.proxmox.com/wiki/Linux_Container
|
||||||
getLatestTemplate(){
|
getLatestTemplate(){
|
||||||
if [ $DRY_RUN ] ; then
|
|
||||||
[ -z $2 ] \
|
|
||||||
|| eval "$2=${CT_TEMPLATE:-\\\$CT_TEMPLATE}"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
#IFS=$'\n'
|
#IFS=$'\n'
|
||||||
#@ pveam update
|
#@ pveam update
|
||||||
|
|
||||||
@ -171,17 +165,14 @@ getLatestTemplate(){
|
|||||||
#
|
#
|
||||||
# xread [-n] MSG VAR
|
# xread [-n] MSG VAR
|
||||||
#
|
#
|
||||||
# This saves all user input variables to the $XREAD_VARS array.
|
|
||||||
xread(){
|
xread(){
|
||||||
local non_empty=
|
local non_empty=
|
||||||
if [[ $1 == '-n' ]] ; then
|
if [[ $1 == '-n' ]] ; then
|
||||||
shift
|
shift
|
||||||
local non_empty=1
|
local non_empty=1
|
||||||
fi
|
fi
|
||||||
if [ -z ${!2} ] ; then
|
[ -z ${!2} ] \
|
||||||
eval 'read -ep "'$1'" -i "$DFL_'$2'" '${2}''
|
&& eval 'read -ep "'$1'" -i "$DFL_'$2'" '${2}''
|
||||||
XREAD_VARS+=(${2})
|
|
||||||
fi
|
|
||||||
if [ -z $non_empty ] ; then
|
if [ -z $non_empty ] ; then
|
||||||
eval ''$2'=${'$2':=$DFL_'$2'}'
|
eval ''$2'=${'$2':=$DFL_'$2'}'
|
||||||
fi
|
fi
|
||||||
@ -243,51 +234,16 @@ tklWaitForSetup(){
|
|||||||
|
|
||||||
#
|
#
|
||||||
# readConfig
|
# readConfig
|
||||||
#
|
#
|
||||||
# Envioronment variables:
|
|
||||||
# CLEAN_RUN - if set ignore ./config.last-run
|
|
||||||
# CONFIG - config file to load last
|
|
||||||
#
|
|
||||||
readConfig(){
|
readConfig(){
|
||||||
if [ -z $NO_DEFAULTS ] ; then
|
if [ -z $NO_DEFAULTS ] ; then
|
||||||
[ -e ../config.global ] \
|
[ -e ../config.global ] \
|
||||||
&& source ../config.global
|
&& source ../config.global
|
||||||
[ -e ./config ] \
|
[ -e ./config ] \
|
||||||
&& source ./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
|
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
|
# readVars
|
||||||
#
|
#
|
||||||
|
|||||||
73
Makefile
73
Makefile
@ -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
|
config.global: config.global.example
|
||||||
vim "+0r config.global.example" $@
|
vim "+0r config.global.example" $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Shorthands...
|
|
||||||
|
|
||||||
.PHONY: config
|
|
||||||
config: config.global
|
config: config.global
|
||||||
|
|
||||||
|
|
||||||
.PHONY: gate
|
.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
|
.PHONY: all
|
||||||
all: config $(CTs)
|
all: config gate ns ssh wireguard syncthing nextcloud gitea
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
|
|||||||
@ -95,8 +95,6 @@ echo "# Setup: iptables update script..."
|
|||||||
echo "# Post config..."
|
echo "# Post config..."
|
||||||
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
||||||
|
|
||||||
saveLastRunConfig
|
|
||||||
|
|
||||||
echo "# Done."
|
echo "# Done."
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,6 @@ echo "# Updating system..."
|
|||||||
echo "# Post config..."
|
echo "# Post config..."
|
||||||
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
||||||
|
|
||||||
saveLastRunConfig
|
|
||||||
|
|
||||||
echo "# Done."
|
echo "# Done."
|
||||||
|
|
||||||
|
|||||||
@ -84,8 +84,6 @@ echo "# Setup: dnsmasq..."
|
|||||||
echo "# Post config..."
|
echo "# Post config..."
|
||||||
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
||||||
|
|
||||||
saveLastRunConfig
|
|
||||||
|
|
||||||
echo "# Done."
|
echo "# Done."
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -82,8 +82,6 @@ done
|
|||||||
echo "# Post config..."
|
echo "# Post config..."
|
||||||
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
||||||
|
|
||||||
saveLastRunConfig
|
|
||||||
|
|
||||||
echo "# Done."
|
echo "# Done."
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -80,8 +80,6 @@ sleep ${TIMEOUT:=5}
|
|||||||
echo "# Post config..."
|
echo "# Post config..."
|
||||||
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
||||||
|
|
||||||
saveLastRunConfig
|
|
||||||
|
|
||||||
echo "# Done."
|
echo "# Done."
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -106,8 +106,6 @@ echo "# client config:"
|
|||||||
echo "# Post config..."
|
echo "# Post config..."
|
||||||
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
||||||
|
|
||||||
saveLastRunConfig
|
|
||||||
|
|
||||||
echo "# Done."
|
echo "# Done."
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user