Update build.func
This commit is contained in:
parent
10b980fb86
commit
e1edebd91c
@ -46,8 +46,8 @@ error_handler() {
|
|||||||
if [[ -n "$CT_ID" ]]; then
|
if [[ -n "$CT_ID" ]]; then
|
||||||
read -p "Remove this Container? <y/N> " prompt
|
read -p "Remove this Container? <y/N> " prompt
|
||||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||||
pct stop "$CT_ID" &> /dev/null
|
pct stop "$CT_ID" &>/dev/null
|
||||||
pct destroy "$CT_ID" &> /dev/null
|
pct destroy "$CT_ID" &>/dev/null
|
||||||
msg_ok "Removed this Container"
|
msg_ok "Removed this Container"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -498,7 +498,6 @@ advanced_settings() {
|
|||||||
exit_script
|
exit_script
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
IFACE_FILEPATH_LIST="/etc/network/interfaces"$'\n'$(find "/etc/network/interfaces.d/" -type f)
|
IFACE_FILEPATH_LIST="/etc/network/interfaces"$'\n'$(find "/etc/network/interfaces.d/" -type f)
|
||||||
BRIDGES=""
|
BRIDGES=""
|
||||||
OLD_IFS=$IFS
|
OLD_IFS=$IFS
|
||||||
@ -506,7 +505,7 @@ advanced_settings() {
|
|||||||
for iface_filepath in ${IFACE_FILEPATH_LIST}; do
|
for iface_filepath in ${IFACE_FILEPATH_LIST}; do
|
||||||
|
|
||||||
iface_indexes_tmpfile=$(mktemp -q -u '.iface-XXXX')
|
iface_indexes_tmpfile=$(mktemp -q -u '.iface-XXXX')
|
||||||
( grep -Pn '^\s*iface' "${iface_filepath}" | cut -d':' -f1 && wc -l "${iface_filepath}" | cut -d' ' -f1 ) | awk 'FNR==1 {line=$0; next} {print line":"$0-1; line=$0}' > "${iface_indexes_tmpfile}" || true
|
(grep -Pn '^\s*iface' "${iface_filepath}" | cut -d':' -f1 && wc -l "${iface_filepath}" | cut -d' ' -f1) | awk 'FNR==1 {line=$0; next} {print line":"$0-1; line=$0}' >"${iface_indexes_tmpfile}" || true
|
||||||
|
|
||||||
if [ -f "${iface_indexes_tmpfile}" ]; then
|
if [ -f "${iface_indexes_tmpfile}" ]; then
|
||||||
|
|
||||||
@ -519,7 +518,7 @@ advanced_settings() {
|
|||||||
BRIDGES="${iface_name}"$'\n'"${BRIDGES}"
|
BRIDGES="${iface_name}"$'\n'"${BRIDGES}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done < "${iface_indexes_tmpfile}"
|
done <"${iface_indexes_tmpfile}"
|
||||||
rm -f "${iface_indexes_tmpfile}"
|
rm -f "${iface_indexes_tmpfile}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -779,7 +778,6 @@ EOF
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
install_script() {
|
install_script() {
|
||||||
pve_check
|
pve_check
|
||||||
shell_check
|
shell_check
|
||||||
@ -1077,7 +1075,27 @@ EOF'
|
|||||||
pct exec "$CTID" -- bash -c "apt-get update >/dev/null && apt-get install -y sudo curl mc gnupg2 >/dev/null"
|
pct exec "$CTID" -- bash -c "apt-get update >/dev/null && apt-get install -y sudo curl mc gnupg2 >/dev/null"
|
||||||
fi
|
fi
|
||||||
msg_ok "Customized LXC Container"
|
msg_ok "Customized LXC Container"
|
||||||
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/install/$var_install.sh)" $?
|
|
||||||
|
# Remote-Skript innerhalb des Containers mit Trap sauber ausführen
|
||||||
|
lxc-attach -n "$CTID" -- bash -c '
|
||||||
|
set -e
|
||||||
|
trap "echo Aborted in container; exit 130" SIGINT SIGTERM
|
||||||
|
|
||||||
|
tmp_script="/tmp/install_remote.sh"
|
||||||
|
curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/install/'"$var_install"'.sh -o "$tmp_script"
|
||||||
|
chmod +x "$tmp_script"
|
||||||
|
bash "$tmp_script"
|
||||||
|
'
|
||||||
|
exit_code=$?
|
||||||
|
if [[ "$exit_code" -eq 130 || "$exit_code" -eq 143 ]]; then
|
||||||
|
echo
|
||||||
|
msg_error "Script aborted by user inside container"
|
||||||
|
exit "$exit_code"
|
||||||
|
elif [[ "$exit_code" -ne 0 ]]; then
|
||||||
|
echo
|
||||||
|
msg_error "Install script failed in container (exit code $exit_code)"
|
||||||
|
exit "$exit_code"
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1124,8 +1142,6 @@ EOF
|
|||||||
systemctl start ping-instances.service
|
systemctl start ping-instances.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
post_update_to_api "done" "none"
|
post_update_to_api "done" "none"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user