Compare commits

..

2 Commits

Author SHA1 Message Date
MickLesk d20c06ce0e change comments for new variant
Update `_deploy_source_tarball` and related helper comments to note that CLEAN_INSTALL wipes target contents including dotfiles while preserving mount points. This improves guidance around backup/restore of config dotfiles during source deployments.
2026-08-15 23:26:30 +02:00
MickLesk c0ce8b3a11 Skip mount points during backup and clean install
Prevent accidental deletion or backup of mount points:
- In create_backup(), skip paths that are mount points with a warning
- In _deploy_source_tarball(), _deploy_unpacked_archive(), and fetch_and_deploy_from_url(), use find with mountpoint pruning to avoid deleting mount point directories during CLEAN_INSTALL
2026-08-15 23:22:59 +02:00
3 changed files with 106 additions and 9 deletions
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2026 tteck
# Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.nocodb.com/ | Github: https://github.com/nocodb/nocodb
APP="NocoDB"
var_tags="${var_tags:-noCode}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-1024}"
var_disk="${var_disk:-4}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
#RELEASE="0.301.1"
if [[ ! -f /etc/systemd/system/nocodb.service ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
#if check_for_gh_release "nocodb" "nocodb/nocodb" "${RELEASE}"; then
if check_for_gh_release "nocodb" "nocodb/nocodb"; then
msg_info "Stopping Service"
systemctl stop nocodb
msg_ok "Stopped Service"
fetch_and_deploy_gh_release "nocodb" "nocodb/nocodb" "singlefile" "latest" "/opt/nocodb/" "Noco-linux-$(arch_resolve "x64" "arm64")"
msg_info "Starting Service"
systemctl start nocodb
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
exit
}
start
build_container
description
msg_ok "Completed successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}:8080/dashboard${CL}"
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 tteck
# Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.nocodb.com/ | Github: https://github.com/nocodb/nocodb
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
fetch_and_deploy_gh_release "nocodb" "nocodb/nocodb" "singlefile" "latest" "/opt/nocodb/" "Noco-linux-$(arch_resolve "x64" "arm64")"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/nocodb.service
[Unit]
Description=nocodb
[Service]
Type=simple
Restart=always
User=root
WorkingDirectory=/opt/nocodb
ExecStart=/opt/nocodb/./nocodb
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now nocodb
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc
+13 -9
View File
@@ -1336,6 +1336,10 @@ create_backup() {
msg_warn "Skipping backup of '${path}' (not found)"
continue
fi
if mountpoint -q "$path" 2>/dev/null; then
msg_warn "Skipping backup of '${path}' (is a mount point)"
continue
fi
dest="${store}/files${path}"
if ! mkdir -p "$(dirname "$dest")" || ! cp -a "$path" "$dest"; then
msg_error "Backup of '${path}' failed - aborting update"
@@ -2524,9 +2528,9 @@ _download_source_tarball() {
# directory). Extracts <tarball_path> into <workdir>, then copies the contents
# of that top-level directory into <target>.
#
# - Honors CLEAN_INSTALL=1 (wipes <target> first, dotfiles included — back
# up config dotfiles like .env via create_backup and call restore_backup
# BEFORE any build step that sources them).
# - Honors CLEAN_INSTALL=1 (wipes <target> first, dotfiles included, mount
# points preserved — back up config dotfiles like .env via create_backup
# and call restore_backup BEFORE any build step that sources them).
# - Does NOT own <workdir>: the caller creates it and is responsible for its
# cleanup (typically via a RETURN trap on its tmpdir).
# - cp failures are non-fatal here, matching the previous inline behavior.
@@ -2538,7 +2542,7 @@ _deploy_source_tarball() {
mkdir -p "$target"
if [[ "${CLEAN_INSTALL:-0}" == "1" ]]; then
find "${target:?}" -mindepth 1 -delete
find "${target:?}" -mindepth 1 \( -type d -exec mountpoint -q {} \; -prune \) -o -delete
fi
tar --no-same-owner -xzf "$tarball" -C "$workdir" || {
@@ -2564,9 +2568,9 @@ _deploy_source_tarball() {
# a single top-level directory, that directory is stripped (its contents land
# directly in <target>); otherwise the archive contents are copied as-is.
#
# - Honors CLEAN_INSTALL=1 (wipes <target> first, dotfiles included — back
# up config dotfiles like .env via create_backup and call restore_backup
# BEFORE any build step that sources them).
# - Honors CLEAN_INSTALL=1 (wipes <target> first, dotfiles included, mount
# points preserved — back up config dotfiles like .env via create_backup
# and call restore_backup BEFORE any build step that sources them).
# - Does NOT own <workdir>: the caller creates it and cleans it up.
#
# Returns: 0 on success, 65 on unsupported format, 251 on extraction failure,
@@ -2627,7 +2631,7 @@ _deploy_unpacked_archive() {
# was truncated, the archive was unreadable, or it unpacked to nothing.
mkdir -p "$target"
if [[ "${CLEAN_INSTALL:-0}" == "1" ]]; then
find "${target:?}" -mindepth 1 -delete
find "${target:?}" -mindepth 1 \( -type d -exec mountpoint -q {} \; -prune \) -o -delete
fi
if ! cp -r "$source_dir"/* "$target/"; then
@@ -9368,7 +9372,7 @@ fetch_and_deploy_from_url() {
mkdir -p "$directory"
if [[ "${CLEAN_INSTALL:-0}" == "1" ]]; then
find "${directory:?}" -mindepth 1 -delete
find "${directory:?}" -mindepth 1 \( -type d -exec mountpoint -q {} \; -prune \) -o -delete
fi
local unpack_tmp