mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-12-26 05:12:06 +00:00
Compare commits
5 Commits
ffb69c61ad
...
e0816feb07
| Author | SHA1 | Date | |
|---|---|---|---|
| e0816feb07 | |||
| 94e2a364df | |||
| 2cb3fb5418 | |||
| 866e8857f0 | |||
| a84b3846a7 |
45
.pct-helpers
45
.pct-helpers
@ -202,7 +202,9 @@ xread(){
|
|||||||
shift
|
shift
|
||||||
local non_empty=1
|
local non_empty=1
|
||||||
fi
|
fi
|
||||||
|
# XXX check DFL_..???
|
||||||
if [[ "${!2}" == "SKIP" ]] ; then
|
if [[ "${!2}" == "SKIP" ]] ; then
|
||||||
|
eval "$2="
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ -z ${!2} ] ; then
|
if [ -z ${!2} ] ; then
|
||||||
@ -220,7 +222,9 @@ xread(){
|
|||||||
# xreadYes MSG VAR
|
# xreadYes MSG VAR
|
||||||
#
|
#
|
||||||
xreadYes(){
|
xreadYes(){
|
||||||
|
# XXX check DFL_..???
|
||||||
if [[ "${!2}" == "SKIP" ]] ; then
|
if [[ "${!2}" == "SKIP" ]] ; then
|
||||||
|
eval "$2="
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ -z ${!2} ] ; then
|
if [ -z ${!2} ] ; then
|
||||||
@ -312,8 +316,12 @@ tklWaitForSetup(){
|
|||||||
# CLEAN_RUN - if set ignore ./config.last-run
|
# CLEAN_RUN - if set ignore ./config.last-run
|
||||||
# CONFIG - config file to load last
|
# CONFIG - config file to load last
|
||||||
#
|
#
|
||||||
|
# XXX need this not to make this behave with explicitly set vars...
|
||||||
readConfig(){
|
readConfig(){
|
||||||
if [ -z $NO_DEFAULTS ] ; then
|
if [ -z $NO_DEFAULTS ] ; then
|
||||||
|
local IFS=$'\n'
|
||||||
|
#__ENV=($( (set -o posix ; set | grep -v 'BASHOPTS=') ))
|
||||||
|
#__ENV=($( (declare -xp) ))
|
||||||
[ -e ../config.global ] \
|
[ -e ../config.global ] \
|
||||||
&& source ../config.global
|
&& source ../config.global
|
||||||
[ -e ./config ] \
|
[ -e ./config ] \
|
||||||
@ -324,6 +332,8 @@ readConfig(){
|
|||||||
&& source ./config.last-run
|
&& source ./config.last-run
|
||||||
[ -e "$CONFIG" ] \
|
[ -e "$CONFIG" ] \
|
||||||
&& source $CONFIG
|
&& source $CONFIG
|
||||||
|
#eval "${__ENV[@]}"
|
||||||
|
#__ENV=
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,6 +383,22 @@ saveLastRunConfig(){
|
|||||||
saveConfig -d -a "$cfg" ${XREAD_VARS[@]}
|
saveConfig -d -a "$cfg" ${XREAD_VARS[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# webAppConfig NAME
|
||||||
|
webAppConfig(){
|
||||||
|
local name=${1^^}
|
||||||
|
eval "${name}_SUBDOMAIN=\${${name}_SUBDOMAIN:=\${DFL_SUB${name}_DOMAIN}}
|
||||||
|
${name}_SUBDOMAIN=\${${name}_SUBDOMAIN:+\${${name}_SUBDOMAIN%.}.}
|
||||||
|
${name}_DOMAIN=\${${name}_DOMAIN:=\${DFL_${name}_DOMAIN}}
|
||||||
|
# prioretize \${name}_*
|
||||||
|
DFL_DOMAIN=\${DFL_DOMAIN:+\${${name}_SUBDOMAIN}\${DFL_DOMAIN}}
|
||||||
|
DFL_DOMAIN=\${DOMAIN:+\${${name}_SUBDOMAIN}\${DOMAIN}}
|
||||||
|
if [ \$${name}_DOMAIN ] ; then
|
||||||
|
DFL_DOMAIN=\${${name}_SUBDOMAIN}\${${name}_DOMAIN}
|
||||||
|
fi"
|
||||||
|
# force check of domain...
|
||||||
|
DOMAIN=
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# readVars
|
# readVars
|
||||||
#
|
#
|
||||||
@ -425,12 +451,25 @@ readVars(){
|
|||||||
# Gateways can be:
|
# Gateways can be:
|
||||||
# <empty>
|
# <empty>
|
||||||
# <IP>
|
# <IP>
|
||||||
|
# XXX these are the same...
|
||||||
xread "WAN ip: " WAN_IP
|
xread "WAN ip: " WAN_IP
|
||||||
xread "WAN gateway: " WAN_GATE
|
if [[ $WAN_IP != "dhcp" ]] ; then
|
||||||
|
xread "WAN gateway: " WAN_GATE
|
||||||
|
else
|
||||||
|
WAN_GATE=
|
||||||
|
fi
|
||||||
xread "LAN ip: " LAN_IP
|
xread "LAN ip: " LAN_IP
|
||||||
xread "LAN gateway: " LAN_GATE
|
if [[ $LAN_IP != "dhcp" ]] ; then
|
||||||
|
xread "LAN gateway: " LAN_GATE
|
||||||
|
else
|
||||||
|
LAN_GATE=
|
||||||
|
fi
|
||||||
xread "ADMIN ip: " ADMIN_IP
|
xread "ADMIN ip: " ADMIN_IP
|
||||||
xread "ADMIN gateway: " ADMIN_GATE
|
if [[ $ADMIN_IP != "dhcp" ]] ; then
|
||||||
|
xread "ADMIN gateway: " ADMIN_GATE
|
||||||
|
else
|
||||||
|
ADMIN_GATE=
|
||||||
|
fi
|
||||||
|
|
||||||
# root password...
|
# root password...
|
||||||
if [ -z $ROOTPASS ] ; then
|
if [ -z $ROOTPASS ] ; then
|
||||||
|
|||||||
@ -18,14 +18,6 @@
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
|
||||||
DFL_EMAIL=user@example.com
|
|
||||||
|
|
||||||
DFL_DOMAIN=example.com
|
|
||||||
|
|
||||||
DFL_WAN_IP=192.168.1.101/24
|
|
||||||
DFL_WAN_GATE=192.168.1.252
|
|
||||||
|
|
||||||
|
|
||||||
# CT interface bridge configuration.
|
# CT interface bridge configuration.
|
||||||
#
|
#
|
||||||
# These are set to the bridge number (the number in 'vmbr#') used for
|
# These are set to the bridge number (the number in 'vmbr#') used for
|
||||||
@ -41,6 +33,35 @@ LAN_BRIDGE=
|
|||||||
ADMIN_BRIDGE=
|
ADMIN_BRIDGE=
|
||||||
|
|
||||||
|
|
||||||
|
DFL_WAN_IP=192.168.1.101/24
|
||||||
|
DFL_WAN_GATE=192.168.1.252
|
||||||
|
|
||||||
|
|
||||||
|
# Doman and email configuration
|
||||||
|
#
|
||||||
|
EMAIL=user@example.com
|
||||||
|
|
||||||
|
DOMAIN=example.com
|
||||||
|
|
||||||
|
|
||||||
|
# Web app/service domain configuration
|
||||||
|
#
|
||||||
|
# Here two optional variables are provided per service:
|
||||||
|
# - <SERVICE>_DOMAIN=...
|
||||||
|
# Overrides the $DOMAIN option above for <SERVICE>
|
||||||
|
# - <SERVICE>_SUBDOMAIN=...
|
||||||
|
# Sets the subdomain of $DOMAIN (or $<SERVICE>_DOMAIN) for <SERVICE>
|
||||||
|
#
|
||||||
|
|
||||||
|
# Nextcloud
|
||||||
|
#NEXTCLOUD_DOMAIN=
|
||||||
|
NEXTCLOUD_SUBDOMAIN=nc.
|
||||||
|
|
||||||
|
# Gitea
|
||||||
|
#GITEA_DOMAIN=
|
||||||
|
#GITEA_SUBDOMAIN=git.
|
||||||
|
|
||||||
|
|
||||||
# Extra options passed to each CT created.
|
# Extra options passed to each CT created.
|
||||||
#
|
#
|
||||||
# This can be used for passing in ssh keys, etc...
|
# This can be used for passing in ssh keys, etc...
|
||||||
@ -48,6 +69,9 @@ ADMIN_BRIDGE=
|
|||||||
# see:
|
# see:
|
||||||
# man pct
|
# man pct
|
||||||
#
|
#
|
||||||
|
# Example:
|
||||||
|
# DFL_PCT_EXTRA="--ssh-public-keys /path/to/autohrized_keys"
|
||||||
|
#
|
||||||
DFL_PCT_EXTRA=SKIP
|
DFL_PCT_EXTRA=SKIP
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,8 @@ readConfig
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
webAppConfig gitea
|
||||||
|
|
||||||
DFL_ID=${DFL_ID:=300}
|
DFL_ID=${DFL_ID:=300}
|
||||||
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=gitea}
|
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=gitea}
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,8 @@ readConfig
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
webAppConfig Nextcloud
|
||||||
|
|
||||||
DFL_ID=${DFL_ID:=300}
|
DFL_ID=${DFL_ID:=300}
|
||||||
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=nextcloud}
|
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=nextcloud}
|
||||||
|
|
||||||
@ -42,6 +44,9 @@ REBOOT=${REBOOT:=1}
|
|||||||
|
|
||||||
readVars
|
readVars
|
||||||
|
|
||||||
|
# Nextcloud-specific configuration...
|
||||||
|
APP_DOMAIN=$DOMAIN
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ http:
|
|||||||
entryPoints:
|
entryPoints:
|
||||||
- https
|
- https
|
||||||
service: nextcloud
|
service: nextcloud
|
||||||
rule: "Host(`nc.${DOMAIN}`)"
|
rule: "Host(`${DOMAIN}`)"
|
||||||
tls:
|
tls:
|
||||||
certResolver: letsEncrypt
|
certResolver: letsEncrypt
|
||||||
|
|
||||||
@ -40,6 +40,8 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY)
|
|||||||
-e 's/\$${\SERVER_PRIVATE_KEY}/'$$(sed -e 's/\//\\\//g' "$(SERVER_KEY)")'/g' \
|
-e 's/\$${\SERVER_PRIVATE_KEY}/'$$(sed -e 's/\//\\\//g' "$(SERVER_KEY)")'/g' \
|
||||||
> "$@"
|
> "$@"
|
||||||
|
|
||||||
|
# XXX need to figure out a way to link this to the .config file without
|
||||||
|
# conflicting with the server's wg0.conf
|
||||||
%.client: $(CLIENT_TPL) $(SERVER_CLIENT_TPL) \
|
%.client: $(CLIENT_TPL) $(SERVER_CLIENT_TPL) \
|
||||||
$(CLIENT_DIR)/%_id $(CLIENT_DIR)/%_id.pub \
|
$(CLIENT_DIR)/%_id $(CLIENT_DIR)/%_id.pub \
|
||||||
$(SERVER_CONF) $(SERVER_PUBLIC_KEY)
|
$(SERVER_CONF) $(SERVER_PUBLIC_KEY)
|
||||||
@ -67,6 +69,12 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY)
|
|||||||
&& qrencode -t UTF8 -r "$(CLIENT_DIR)/$*.conf" )
|
&& qrencode -t UTF8 -r "$(CLIENT_DIR)/$*.conf" )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%.qr: %.client
|
||||||
|
@ ( echo "# Profile: $*" \
|
||||||
|
&& qrencode -t UTF8 -r "$*.conf" )
|
||||||
|
|
||||||
|
|
||||||
server: $(SERVER_CONF)
|
server: $(SERVER_CONF)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user