From 78d21ec286b2e3aee85fe7d42dd391ba6375ef26 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Sat, 20 Jul 2024 11:55:14 +0200 Subject: [PATCH] checkservices: honor -R flag Even though the -R flag were parsed it were not honored and there was no way to skip being asked for restart with the -R flag. Useful for putting checkservices in an alpm hook. --- admin/checkservices | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/admin/checkservices b/admin/checkservices index f2a59b4..4afb171 100755 --- a/admin/checkservices +++ b/admin/checkservices @@ -297,10 +297,14 @@ main() { local -a broken_services=($(get_broken_maps)) echo "Found: ${#broken_services[@]}" if (( ${#broken_services[@]} )); then - display_restart "${broken_services[@]}" - if confirm 'Execute?'; then - arrow 'Restart broken services' - restart_services "${broken_services[@]}" + if (( RESTART )); then + display_restart "${broken_services[@]}" + if confirm 'Execute?'; then + arrow 'Restart broken services' + restart_services "${broken_services[@]}" + fi + else + display_restart "${broken_services[@]}" | sed "s/systemctl restart //g" fi fi @@ -308,10 +312,14 @@ main() { local -a missing_services=($(get_missing_dbus)) echo "Found: ${#missing_services[@]}" if (( ${#missing_services[@]} )); then - display_restart "${missing_services[@]}" - if confirm 'Execute?'; then - arrow 'Restart missing services' - restart_services "${missing_services[@]}" + if (( RESTART )); then + display_restart "${missing_services[@]}" + if confirm 'Execute?'; then + arrow 'Restart missing services' + restart_services "${missing_services[@]}" + fi + else + display_restart "${missing_services[@]}" | sed "s/systemctl restart //g" fi fi