remove various 18.04 specific code

This commit is contained in:
Girish Ramakrishnan
2025-06-15 13:58:28 +02:00
parent 2d5ef36a7f
commit 0ebda97b03
3 changed files with 2 additions and 17 deletions

View File

@@ -34,15 +34,8 @@ elif [[ "${service}" == "docker" ]]; then
elif [[ "${service}" == "collectd" ]]; then
systemctl restart --no-block collectd
elif [[ "${service}" == "box" ]]; then
readonly ubuntu_version=$(lsb_release -rs)
if [[ "${ubuntu_version}" == "18.04" ]]; then
pid=$(systemctl show box -p MainPID | sed 's/MainPID=//g')
kill -HUP $pid
else
systemctl reload --no-block box
fi
systemctl reload --no-block box
else
echo "Unknown service ${service}"
exit 1
fi

View File

@@ -30,7 +30,6 @@ readonly service_name="box-task-${task_id}"
systemctl reset-failed "${service_name}" 2>/dev/null || true
readonly id=$(id -u $SUDO_USER)
readonly ubuntu_version=$(lsb_release -rs)
options="-p TimeoutStopSec=10s -p MemoryMax=${memory_limit_mb}M -p OOMScoreAdjust=${oom_score_adjust} --pipe --wait"
@@ -38,11 +37,6 @@ options="-p TimeoutStopSec=10s -p MemoryMax=${memory_limit_mb}M -p OOMScoreAdjus
# For this reason, we have code to kill the tasks both on shutdown and startup.
[[ "$BOX_ENV" == "cloudron" ]] && options="${options} -p BindsTo=box.service"
# systemd 237 on ubuntu 18.04 does not apply --nice
if [[ "${ubuntu_version}" == "18.04" ]]; then
(sleep 1; pid=$(systemctl show "${service_name}" -p MainPID | sed 's/MainPID=//g'); renice -n ${nice} -g ${pid} || true) &
fi
# DEBUG has to be hardcoded because it is not set in the tests. --setenv is required for ubuntu 16 (-E does not work)
# NODE_OPTIONS is used because env -S does not work in ubuntu 16/18.
# it seems systemd-run does not return the exit status of the process despite --wait

View File

@@ -27,14 +27,12 @@ readonly source_dir="${1}"
readonly log_file="${2}"
readonly installer_path="${source_dir}/scripts/installer.sh"
readonly ubuntu_version=$(lsb_release -rs)
log "updating Cloudron with ${source_dir}"
# StandardError will follow StandardOutput in default inherit mode. https://www.freedesktop.org/software/systemd/man/systemd.exec.html
systemctl reset-failed "${updater_service}" 2>/dev/null || true
[[ "${ubuntu_version}" == "18.04" ]] && file_mode="file" || file_mode="append"
if ! systemd-run --property=OOMScoreAdjust=-1000 --unit "${updater_service}" -p StandardOutput=${file_mode}:${log_file} ${installer_path}; then
if ! systemd-run --property=OOMScoreAdjust=-1000 --unit "${updater_service}" -p StandardOutput=append:${log_file} ${installer_path}; then
log "Failed to install cloudron"
exit 1
fi