mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-01-10 19:05:09 +00:00
Patch Netbird Script | Container Boot-Check | Debian/Ubuntu Only (#528)
* Update Add-Netbird - Container Online-Check (Boot if LXC stopped) - Alpine Check -> Abort if not Debian/Ubuntu * Improve Netbird Json for website * remove dev comments * Change copyright
This commit is contained in:
parent
9d72b5872a
commit
928a5cb9e5
@ -33,11 +33,15 @@
|
|||||||
"notes": [
|
"notes": [
|
||||||
{
|
{
|
||||||
"text": "After the script finishes, reboot the LXC then run `netbird up` in the LXC console",
|
"text": "After the script finishes, reboot the LXC then run `netbird up` in the LXC console",
|
||||||
"type": "warning"
|
"type": "info"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "Execute within the Proxmox shell",
|
"text": "Execute within the Proxmox main shell",
|
||||||
|
"type": "info"
|
||||||
|
}
|
||||||
|
{
|
||||||
|
"text": "The script only works in Debian/Ubuntu, not in Alpine!",
|
||||||
"type": "warning"
|
"type": "warning"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# Copyright (c) 2021-2024 tteck
|
# Copyright (c) 2021-2024 tteck
|
||||||
# Author: tteck (tteckster)
|
# Author: tteck (tteckster)
|
||||||
|
# Co-Author: MickLesk (Canbiz)
|
||||||
# License: MIT
|
# License: MIT
|
||||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
@ -10,9 +11,9 @@ clear
|
|||||||
cat <<"EOF"
|
cat <<"EOF"
|
||||||
_ __ __ ____ _ __
|
_ __ __ ____ _ __
|
||||||
/ | / /__ / /_/ __ )(_)________/ /
|
/ | / /__ / /_/ __ )(_)________/ /
|
||||||
/ |/ / _ \/ __/ __ / / ___/ __ /
|
/ |/ / _ \/ __/ __ / / ___/ __ /
|
||||||
/ /| / __/ /_/ /_/ / / / / /_/ /
|
/ /| / __/ /_/ /_/ / / / / /_/ /
|
||||||
/_/ |_/\___/\__/_____/_/_/ \__,_/
|
/_/ |_/\___/\__/_____/_/_/ \__,_/
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@ -28,6 +29,7 @@ while true; do
|
|||||||
done
|
done
|
||||||
header_info
|
header_info
|
||||||
echo "Loading..."
|
echo "Loading..."
|
||||||
|
|
||||||
function msg() {
|
function msg() {
|
||||||
local TEXT="$1"
|
local TEXT="$1"
|
||||||
echo -e "$TEXT"
|
echo -e "$TEXT"
|
||||||
@ -52,6 +54,23 @@ while [ -z "${CTID:+x}" ]; do
|
|||||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
|
|
||||||
|
LXC_STATUS=$(pct status "$CTID" | awk '{print $2}')
|
||||||
|
if [[ "$LXC_STATUS" != "running" ]]; then
|
||||||
|
msg "\e[1;33m The container $CTID is not running. Starting it now...\e[0m"
|
||||||
|
pct start "$CTID"
|
||||||
|
while [[ "$(pct status "$CTID" | awk '{print $2}')" != "running" ]]; do
|
||||||
|
msg "\e[1;33m Waiting for the container to start...\e[0m"
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
msg "\e[1;32m Container $CTID is now running.\e[0m"
|
||||||
|
fi
|
||||||
|
|
||||||
|
DISTRO=$(pct exec "$CTID" -- cat /etc/os-release | grep -w "ID" | cut -d'=' -f2 | tr -d '"')
|
||||||
|
if [[ "$DISTRO" != "debian" && "$DISTRO" != "ubuntu" ]]; then
|
||||||
|
msg "\e[1;31m Error: This script only supports Debian or Ubuntu LXC containers. Detected: $DISTRO. Aborting...\e[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
|
CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >>$CTID_CONFIG_PATH
|
cat <<EOF >>$CTID_CONFIG_PATH
|
||||||
lxc.cgroup2.devices.allow: c 10:200 rwm
|
lxc.cgroup2.devices.allow: c 10:200 rwm
|
||||||
|
Loading…
Reference in New Issue
Block a user