From 4ae3118aa89251b8e3d493bf2908d5a9f6243f7d Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 15 Dec 2025 18:05:14 +0100 Subject: [PATCH] Fix error in determin systemd support for debian 13 and newer. --- add-new-account.sh | 10 ++++++---- add_missing_columns.sh | 8 +++++--- add_missing_indices.sh | 8 +++++--- add_missing_primary-keys.sh | 8 +++++--- add_user_to_group.sh | 8 +++++--- check_cert_coolwsd.sh | 8 ++++---- check_cert_loolwsd.sh | 8 ++++---- check_encryption_scan_legacy-format.sh | 8 +++++--- check_for_old_files.sh | 8 +++++--- convert_filecache_bigint.sh | 8 +++++--- install_apps.sh | 8 +++++--- occ_file_scan_all_accounts.sh | 8 +++++--- occ_file_scan_app-data.sh | 8 +++++--- occ_maintenance.sh | 8 +++++--- occ_manual_upgrade.sh | 8 +++++--- occ_migrate_mimetipes.sh | 8 +++++--- occ_update_apps.sh | 8 +++++--- reinstall-notify_push.sh | 8 +++++--- remove-app_api.sh | 8 +++++--- remove-old-nc-installations.sh | 8 +++++--- remove_user_from_group.sh | 8 +++++--- replace_favicon.sh | 8 +++++--- replace_logo.sh | 8 +++++--- restore_nextcloud.sh | 8 +++++--- update_nextcloud.sh | 8 +++++--- 25 files changed, 124 insertions(+), 78 deletions(-) diff --git a/add-new-account.sh b/add-new-account.sh index 1bb1dcc..5abc340 100755 --- a/add-new-account.sh +++ b/add-new-account.sh @@ -298,16 +298,18 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi # - Running in a terminal? # - if [[ -t 1 ]] ; then - terminal=true + terminal=true else terminal=false fi diff --git a/add_missing_columns.sh b/add_missing_columns.sh index 989589b..8a0d833 100755 --- a/add_missing_columns.sh +++ b/add_missing_columns.sh @@ -196,9 +196,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/add_missing_indices.sh b/add_missing_indices.sh index 171c250..214a693 100755 --- a/add_missing_indices.sh +++ b/add_missing_indices.sh @@ -196,9 +196,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/add_missing_primary-keys.sh b/add_missing_primary-keys.sh index f7f56c5..aba2cfc 100755 --- a/add_missing_primary-keys.sh +++ b/add_missing_primary-keys.sh @@ -196,9 +196,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/add_user_to_group.sh b/add_user_to_group.sh index 29b6418..7fc4bd3 100755 --- a/add_user_to_group.sh +++ b/add_user_to_group.sh @@ -234,9 +234,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/check_cert_coolwsd.sh b/check_cert_coolwsd.sh index 7fea729..f96577c 100755 --- a/check_cert_coolwsd.sh +++ b/check_cert_coolwsd.sh @@ -145,12 +145,12 @@ fi # - Systemd supported ? # - -systemd_supported=false +SYSTEMD_EXISTS=false systemd=$(which systemd) systemctl=$(which systemctl) -if [[ -n "$systemd" ]] && [[ -n "$systemctl" ]] ; then - systemd_supported=true +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then + SYSTEMD_EXISTS=true fi @@ -382,7 +382,7 @@ if ! diff "$(realpath "$cert_installed")" "$(realpath "$cert_newest")" > /dev/nu # - echo "" echononl " Restart Service '$SERVICE_NAME'.." - if $systemd_supported ; then + if $SYSTEMD_EXISTS ; then systemctl restart "$SERVICE_NAME" > $log_file 2>&1 diff --git a/check_cert_loolwsd.sh b/check_cert_loolwsd.sh index 246996c..b7dd0bc 100755 --- a/check_cert_loolwsd.sh +++ b/check_cert_loolwsd.sh @@ -145,12 +145,12 @@ fi # - Systemd supported ? # - -systemd_supported=false +SYSTEMD_EXISTS=false systemd=$(which systemd) systemctl=$(which systemctl) -if [[ -n "$systemd" ]] && [[ -n "$systemctl" ]] ; then - systemd_supported=true +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then + SYSTEMD_EXISTS=true fi @@ -382,7 +382,7 @@ if ! diff "$(realpath "$cert_installed")" "$(realpath "$cert_newest")" > /dev/nu # - echo "" echononl " Restart Service '$SERVICE_NAME'.." - if $systemd_supported ; then + if $SYSTEMD_EXISTS ; then systemctl restart loolwsd > $log_file 2>&1 diff --git a/check_encryption_scan_legacy-format.sh b/check_encryption_scan_legacy-format.sh index 2ebe21f..029fab6 100755 --- a/check_encryption_scan_legacy-format.sh +++ b/check_encryption_scan_legacy-format.sh @@ -204,9 +204,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/check_for_old_files.sh b/check_for_old_files.sh index a6dbe44..55987f0 100755 --- a/check_for_old_files.sh +++ b/check_for_old_files.sh @@ -204,9 +204,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/convert_filecache_bigint.sh b/convert_filecache_bigint.sh index 576c3b0..11398c6 100755 --- a/convert_filecache_bigint.sh +++ b/convert_filecache_bigint.sh @@ -204,9 +204,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/install_apps.sh b/install_apps.sh index 6c78905..8e175fe 100755 --- a/install_apps.sh +++ b/install_apps.sh @@ -267,9 +267,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/occ_file_scan_all_accounts.sh b/occ_file_scan_all_accounts.sh index e89bc39..91ea0a0 100755 --- a/occ_file_scan_all_accounts.sh +++ b/occ_file_scan_all_accounts.sh @@ -275,9 +275,11 @@ CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)" # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/occ_file_scan_app-data.sh b/occ_file_scan_app-data.sh index 10acd98..04824e3 100755 --- a/occ_file_scan_app-data.sh +++ b/occ_file_scan_app-data.sh @@ -280,9 +280,11 @@ CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)" # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/occ_maintenance.sh b/occ_maintenance.sh index 00a4f40..48d5559 100755 --- a/occ_maintenance.sh +++ b/occ_maintenance.sh @@ -280,9 +280,11 @@ CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)" # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/occ_manual_upgrade.sh b/occ_manual_upgrade.sh index 4c8358d..70fd43a 100755 --- a/occ_manual_upgrade.sh +++ b/occ_manual_upgrade.sh @@ -280,9 +280,11 @@ CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)" # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/occ_migrate_mimetipes.sh b/occ_migrate_mimetipes.sh index 8c5e7f7..6e4a0d4 100755 --- a/occ_migrate_mimetipes.sh +++ b/occ_migrate_mimetipes.sh @@ -196,9 +196,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/occ_update_apps.sh b/occ_update_apps.sh index 56b824e..6ed174b 100755 --- a/occ_update_apps.sh +++ b/occ_update_apps.sh @@ -282,9 +282,11 @@ CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)" # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/reinstall-notify_push.sh b/reinstall-notify_push.sh index 4d6f225..58175ec 100755 --- a/reinstall-notify_push.sh +++ b/reinstall-notify_push.sh @@ -196,9 +196,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/remove-app_api.sh b/remove-app_api.sh index 13d8d9b..a06210d 100755 --- a/remove-app_api.sh +++ b/remove-app_api.sh @@ -196,9 +196,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/remove-old-nc-installations.sh b/remove-old-nc-installations.sh index f94842c..f346eec 100755 --- a/remove-old-nc-installations.sh +++ b/remove-old-nc-installations.sh @@ -201,9 +201,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/remove_user_from_group.sh b/remove_user_from_group.sh index 0593968..2de8d5d 100755 --- a/remove_user_from_group.sh +++ b/remove_user_from_group.sh @@ -234,9 +234,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/replace_favicon.sh b/replace_favicon.sh index fed3c2c..f45bcd6 100755 --- a/replace_favicon.sh +++ b/replace_favicon.sh @@ -196,9 +196,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/replace_logo.sh b/replace_logo.sh index a8f8d5a..f494bb0 100755 --- a/replace_logo.sh +++ b/replace_logo.sh @@ -196,9 +196,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/restore_nextcloud.sh b/restore_nextcloud.sh index c58b058..0a0fa14 100755 --- a/restore_nextcloud.sh +++ b/restore_nextcloud.sh @@ -201,9 +201,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi diff --git a/update_nextcloud.sh b/update_nextcloud.sh index 7b2359e..e253a55 100755 --- a/update_nextcloud.sh +++ b/update_nextcloud.sh @@ -301,9 +301,11 @@ IFS=$CUR_IFS # - Support systemd ? # - -if [[ "X$(which systemd)" = "X" ]]; then - SYSTEMD_EXISTS=false -else +SYSTEMD_EXISTS=false +systemd=$(which systemd) +systemctl=$(which systemctl) + +if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then SYSTEMD_EXISTS=true fi