mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
feat: install uncloud-uninstall script when provisioning machine
This commit is contained in:
@@ -111,12 +111,16 @@ install_uncloud_binaries() {
|
||||
trap "rm -rf '$tmp_dir'" EXIT
|
||||
|
||||
local uncloudd_url
|
||||
local uninstall_url
|
||||
if [ "${UNCLOUD_VERSION}" == "latest" ]; then
|
||||
uncloudd_url="${UNCLOUD_GITHUB_URL}/releases/latest/download/uncloudd_linux_${file_arch}.tar.gz"
|
||||
uninstall_url="https://github.com/psviderski/uncloud/blob/main/scripts/uninstall.sh"
|
||||
else
|
||||
uncloudd_url="${UNCLOUD_GITHUB_URL}/releases/download/${UNCLOUD_VERSION}/uncloudd_linux_${file_arch}.tar.gz"
|
||||
uninstall_url="https://github.com/psviderski/uncloud/blob/${UNCLOUD_VERSION}/scripts/uninstall.sh"
|
||||
fi
|
||||
local uncloudd_download_path="${tmp_dir}/uncloudd.tar.gz"
|
||||
local uninstall_download_path="${tmp_dir}/uninstall.sh"
|
||||
|
||||
log "⏳ Downloading uncloudd binary: ${uncloudd_url}"
|
||||
if ! curl -fsSL -o "${uncloudd_download_path}" "${uncloudd_url}"; then
|
||||
@@ -128,6 +132,16 @@ install_uncloud_binaries() {
|
||||
fi
|
||||
log "✓ uncloudd binary installed: ${uncloudd_install_path}"
|
||||
|
||||
log "⏳ Downloading uninstall script: ${uninstall_url}"
|
||||
if ! curl -fsSL -o "${uninstall_download_path}" "${uninstall_url}"; then
|
||||
error "Failed to download uninstall script."
|
||||
fi
|
||||
local uninstall_install_path="${INSTALL_BIN_DIR}/uncloud-uninstall"
|
||||
if ! install "${uninstall_download_path}" "${uninstall_install_path}"; then
|
||||
error "Failed to install uninstall.sh script to ${uninstall_install_path}"
|
||||
fi
|
||||
log "✓ uncloud-uninstall script installed: ${uninstall_install_path}"
|
||||
|
||||
# TODO: install uncloud CLI binary and create a uc alias.
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ if [ "$EUID" -ne 0 ]; then
|
||||
fi
|
||||
|
||||
# Confirm before proceeding.
|
||||
log "⚠️This script will uninstall Uncloud and remove ALL service containers deployed to this machine."
|
||||
log "⚠️This script will uninstall Uncloud and remove ALL Uncloud managed containers on this machine."
|
||||
log "The following actions will be performed:"
|
||||
echo "- Remove Uncloud systemd services"
|
||||
echo "- Remove Uncloud binaries and data"
|
||||
@@ -128,6 +128,10 @@ else
|
||||
log "WireGuard interface uncloud not found."
|
||||
fi
|
||||
|
||||
log "⏳ Removing uninstall script..."
|
||||
rm -fv "${INSTALL_BIN_DIR}/uncloud-uninstall"
|
||||
log "✓ Uninstall script removed."
|
||||
|
||||
echo
|
||||
log "✅ Uncloud has been uninstalled successfully!"
|
||||
log "Note: Docker installation was preserved. If you want to completely remove Docker as well, \
|
||||
|
||||
Reference in New Issue
Block a user