From 8d3755648f93103974b7012af3af7359a33374fc Mon Sep 17 00:00:00 2001
From: obarun <eric@obarun.org>
Date: Sat, 11 Mar 2023 02:38:07 +1100
Subject: [PATCH] sanitize the graph of the system at every service parsing,
 remove -F option, force to use unsupervise command instead of -u at stop
 command

---
 src/lib66/exec/ssexec_help.c  | 12 ++++++++----
 src/lib66/exec/ssexec_parse.c | 12 ++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/lib66/exec/ssexec_help.c b/src/lib66/exec/ssexec_help.c
index f1489be6..8be48597 100644
--- a/src/lib66/exec/ssexec_help.c
+++ b/src/lib66/exec/ssexec_help.c
@@ -106,7 +106,7 @@ char const *help_start =
 "   -P: do not propagate signal to its dependencies\n"
 ;
 
-char const *usage_stop = "66 stop [ -h ] [ -P ] [ -u ] service..." ;
+char const *usage_stop = "66 stop [ -h ] [ -P ] service..." ;
 
 char const *help_stop =
 "\nbring down services\n"
@@ -114,7 +114,6 @@ char const *help_stop =
 "options:\n"
 "   -h: print this help\n"
 "   -P: do not propagate signal to its requiredby\n"
-"   -u: unsupervise service(s)\n"
 ;
 
 char const *usage_env = "66 env [ -h ] [ -c version ] [ -s version ] [ -V|L ] [ -r key=value ] [ -i src,dst ] [ -e editor ] service" ;
@@ -142,7 +141,7 @@ char const *help_init =
 "   -h: print this help\n"
 ;
 
-char const *usage_parse = "66 parse [ -h ] [ -f|F ] [ -I ] service..." ;
+char const *usage_parse = "66 parse [ -h ] [ -f ] [ -I ] service..." ;
 
 char const *help_parse =
 "\nparse a frontend service file and install its result to resolve files\n"
@@ -150,7 +149,6 @@ char const *help_parse =
 "options:\n"
 "   -h: print this help\n"
 "   -f: force to overwrite existing destination\n"
-"   -F: also force to overwrite its dependencies\n"
 "   -I: do not import modified configuration files from previous version\n"
 ;
 
@@ -373,6 +371,8 @@ char const *help_tree_up =
 "options:\n"
 "   -h: print this help\n"
 "   -f: fork the process\n"
+"\n"
+"If no tree name are provided, it bring up all enabled trees from the system\n"
 ;
 
 char const *usage_tree_down = "66 tree down [ -h ] [ -f ] tree" ;
@@ -383,6 +383,8 @@ char const *help_tree_down =
 "options:\n"
 "   -h: print this help\n"
 "   -f: fork the process\n"
+"\n"
+"If no tree name are provided, it bring down all enabled trees from the system\n"
 ;
 
 char const *usage_tree_unsupervise = "66 tree unsupervise [ -h ] [ -f ] tree" ;
@@ -393,6 +395,8 @@ char const *help_tree_unsupervise =
 "options:\n"
 "   -h: print this help\n"
 "   -f: fork the process\n"
+"\n"
+"If no tree name are provided, it unsupervise all enabled trees from the system\n"
 ;
 
 char const *usage_service_wrapper = "66 service [ -h ] status|resolve|state|remove [<command options>] service..." ;
diff --git a/src/lib66/exec/ssexec_parse.c b/src/lib66/exec/ssexec_parse.c
index d5478253..1e22bf68 100644
--- a/src/lib66/exec/ssexec_parse.c
+++ b/src/lib66/exec/ssexec_parse.c
@@ -26,6 +26,7 @@
 #include <66/parser.h>
 #include <66/ssexec.h>
 #include <66/utils.h>
+#include <66/sanitize.h>
 
 int ssexec_parse(int argc, char const *const *argv, ssexec_t *info)
 {
@@ -57,19 +58,12 @@ int ssexec_parse(int argc, char const *const *argv, ssexec_t *info)
                     force = 1 ;
                     break ;
 
-                case 'F' :
-
-                     /** force to rewrite it dependencies */
-                     if (force)
-                        log_usage(info->usage, "\n", info->help) ;
-                    force = 2 ;
-                    break ;
-
                 case 'I' :
 
                     conf = 1 ;
                     break ;
 
+                case 'F' :  log_1_warn("deprecated option -- ignoring") ; break ;
                 case 'c' :  log_1_warn("deprecated option -- ignoring") ; break ;
                 case 'm' :  log_1_warn("deprecated option -- ignoring") ; break ;
                 case 'C' :  log_1_warn("deprecated option -- ignoring") ; break ;
@@ -119,6 +113,8 @@ int ssexec_parse(int argc, char const *const *argv, ssexec_t *info)
             parse_service(sa.s + pos, info, force, conf) ;
     }
 
+    sanitize_graph(info) ;
+
     stralloc_free(&sa) ;
 
     return 0 ;
-- 
GitLab