Files
ProxmoxVE/install/openziti-tunnel-install.sh
T
CanbiZ (MickLesk) 54c8b2393e install: answer every prompt from the environment, survive a closed stdin (#18121)
* install: answer every prompt from the environment, survive a closed stdin

Every interactive prompt takes a var_<app>_<name> override and treats a
closed stdin like Enter (`|| true`), so an install keeps going after the
console that started it is gone. Values the script cannot do without end
with exit 64 and name the variable to set. Validation loops stop asking
when nobody can answer instead of spinning on an empty read.

* mongodb, paperless-gpt: accept yes as well as y
2026-10-24 17:55:50 +02:00

48 lines
1.6 KiB
Bash

#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: emoscardini
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/openziti/ziti
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing openziti"
mkdir -p --mode=0755 /usr/share/keyrings
curl -sSLf https://get.openziti.io/tun/package-repos.gpg | gpg --dearmor -o /usr/share/keyrings/openziti.gpg
cat <<EOF >/etc/apt/sources.list.d/openziti.sources
Types: deb
URIs: https://packages.openziti.org/zitipax-openziti-deb-stable
Suites: jammy
Components: main
Signed-By: /usr/share/keyrings/openziti.gpg
EOF
apt_update_safe
$STD apt install -y ziti-edge-tunnel
sed -i '0,/^ExecStart/ { /^ExecStart/ { n; s|^ExecStart.*|ExecStart=/opt/openziti/bin/ziti-edge-tunnel run-host --verbose=${ZITI_VERBOSE} --identity-dir=${ZITI_IDENTITY_DIR}| } }' /usr/lib/systemd/system/ziti-edge-tunnel.service
systemctl daemon-reload
msg_ok "Installed openziti"
prompt="${var_openziti_tunnel_enrollment_token:-}"
[[ -n "$prompt" ]] || read -r -p "${TAB3}Please paste an identity enrollment token(JTW)" prompt || true
if [[ ${prompt} ]]; then
msg_info "Adding identity"
echo "${prompt}" >/opt/openziti/etc/identities/identity.jwt
chown ziti:ziti /opt/openziti/etc/identities/identity.jwt
systemctl enable -q --now ziti-edge-tunnel
msg_ok "Service Started"
else
systemctl enable -q ziti-edge-tunnel
msg_error "No identity provided; please place an identity file in /opt/openziti/etc/identities/ and restart the service"
fi
motd_ssh
customize
cleanup_lxc