cloudron-support: remove --patch

This commit is contained in:
Girish Ramakrishnan
2026-01-13 10:20:40 +01:00
parent 692fb1a68c
commit a3d1838a8c

View File

@@ -30,7 +30,6 @@ readonly HELP_MESSAGE="
--disable-remote-support Disable SSH Remote Access for the Cloudron support team
--fix-docker-version Ensures the correct docker version is installed
--owner-login Login as owner
--patch Apply a patch from git. WARNING: Do not use unless you know what you are doing!
--recreate-containers Deletes all existing containers and recreates them without loss of data
--recreate-docker Deletes docker storage (containers and images) and recreates it without loss of data
--send-diagnostics Collects server diagnostics and uploads it to ${PASTEBIN}
@@ -840,38 +839,6 @@ function fix_docker_version() {
rm /tmp/containerd.deb /tmp/docker-ce-cli.deb /tmp/docker.deb
}
function apply_patch() {
commit_id="$1"
patch_file="/tmp/${commit_id}.patch"
# gitlab will return 404 if it looks like a valid commit id but doesn't exist. it returns login page with invalid commit id
if ! curl -s "https://git.cloudron.io/cloudron/box/-/commit/${commit_id}.patch" -D /tmp/headers -o "${patch_file}"; then
echo "Could not connect to git"
exit 1
fi
if ! grep -q "content-type: text/plain" /tmp/headers; then
echo "Not a valid commit"
exit 1
fi
echo "This will apply ${commit_id} (${patch_file}) from git and restart the box code."
warn "Do not proceed unless you know what you are doing."
read -p "Do you want to apply the patch? [y/N] " choice
choice=${choice:-n}
[[ ! $choice =~ ^[Yy]$ ]] && exit 1
if ! patch --force --dry-run -d /home/yellowtent/box -p1 -i "${patch_file}"; then
echo "Patch does not apply cleanly"
exit 1
fi
patch -d /home/yellowtent/box -p1 -i "${patch_file}"
systemctl restart box
echo "Patch applied"
}
function check_db_migrations() {
local -r last_migration_from_db="$(mysql -NB -uroot -ppassword -e "SELECT name FROM box.migrations ORDER BY run_on DESC, name DESC LIMIT 1" 2>/dev/null).js"
local -r last_migration_file="/$(ls --ignore schema.sql --ignore initial-schema.sql /home/yellowtent/box/migrations/ | sort | tail -1)"
@@ -922,7 +889,7 @@ function check_services() {
check_disk_space
args=$(getopt -o "" -l "admin-login,disable-dnssec,enable-remote-support,disable-remote-support,help,owner-login,patch:,recreate-containers,recreate-docker,fix-docker-version,send-diagnostics,unbound-forward-dns:,troubleshoot,check-db-migrations,apply-db-migrations,check-services" -n "$0" -- "$@")
args=$(getopt -o "" -l "admin-login,disable-dnssec,enable-remote-support,disable-remote-support,help,owner-login,recreate-containers,recreate-docker,fix-docker-version,send-diagnostics,unbound-forward-dns:,troubleshoot,check-db-migrations,apply-db-migrations,check-services" -n "$0" -- "$@")
eval set -- "${args}"
while true; do
@@ -946,7 +913,6 @@ while true; do
--check-db-migrations) check_db_migrations; exit 0;;
--apply-db-migrations) apply_db_migrations; exit 0;;
--check-services) check_services; exit 0;;
--patch) apply_patch "$2"; exit 0;;
--help) break;;
--) break;;
*) echo "Unknown option $1"; exit 1;;