--- cfengine2-2.0.3.orig/src/cf.extern.h +++ cfengine2-2.0.3/src/cf.extern.h @@ -265,6 +265,8 @@ extern struct Item *VACCESSLIST; extern struct Item *VADDCLASSES; extern struct Item *VALLADDCLASSES; +extern struct Item *VJUSTACTIONS; +extern struct Item *VAVOIDACTIONS; extern struct Edit *VEDITLIST; extern struct Edit *VEDITLISTTOP; extern struct Filter *VFILTERLIST; --- cfengine2-2.0.3.orig/src/prototypes.h +++ cfengine2-2.0.3/src/prototypes.h @@ -251,6 +251,7 @@ void FatalError ARGLIST((char *s)); void Warning ARGLIST((char *s)); void ResetLine ARGLIST((char *s)); +void Deprecated ARGLIST((char *version, char *s)); /* eval.c */ @@ -521,6 +522,7 @@ int IsItemIn ARGLIST((struct Item *list, char *item)); int IsClassedItemIn ARGLIST((struct Item *list, char *item)); int IsFuzzyItemIn ARGLIST((struct Item *list, char *item)); +struct Item *ConcatLists ARGLIST((struct Item *list1, struct Item *list2)); int FuzzySetMatch ARGLIST((char *s1, char *s2)); int FuzzyMatchParse ARGLIST((char *item)); void PrependItem ARGLIST((struct Item **liststart, char *itemstring, char *classes)); --- cfengine2-2.0.3.orig/src/cfagent.c +++ cfengine2-2.0.3/src/cfagent.c @@ -1054,8 +1056,18 @@ { for (action = VACTIONSEQ; action !=NULL; action=action->next) { - SetStartTime(false); + SetStartTime(false); + if (VJUSTACTIONS && (!IsItemIn(VJUSTACTIONS, action->name))) + { + continue; + } + + if (VAVOIDACTIONS && IsItemIn(VAVOIDACTIONS, action->name)) + { + continue; + } + if (IsExcluded(action->classes)) { continue; @@ -1415,10 +1427,11 @@ int argc; { extern char *optarg; + struct Item *actionList; int optindex = 0; int c; -while ((c=getopt_long(argc,argv,"bzMgAbKqkhYHd:vlniIf:pPmcCtsSaeEVD:N:LwxXuU",OPTIONS,&optindex)) != EOF) +while ((c=getopt_long(argc,argv,"bzMgAbKqkhYHd:vlniIf:pPmcCtsSaeEVD:N:LwxXuUj:o:",OPTIONS,&optindex)) != EOF) { switch ((char) c) { @@ -1477,9 +1490,11 @@ break; case 'e': NOEDITS = true; + Deprecated("2.0.4", "Replace '-e' with '--avoid=editfiles'"); break; case 'i': IFCONF = false; + Deprecated("2.0.4", "Replace '-i' with '--avoid=interfaces'"); break; case 'I': INFORM = true; @@ -1504,15 +1519,18 @@ break; case 'c': NOFILECHECK = true; + Deprecated("2.0.4", "Replace '-c' with '--avoid=directories,files'"); break; case 'C': MOUNTCHECK = true; break; case 't': NOTIDY = true; + Deprecated("2.0.4", "Replace '-t' with '--avoid=tidy'"); break; case 's': NOSCRIPTS = true; + Deprecated("2.0.4", "Replace '-s' with '--avoid=shellcommands'"); break; case 'a': PRSYSADM = true; @@ -1546,6 +1564,7 @@ break; case 'k': NOCOPY = true; + Deprecated("2.0.4", "Replace '-k' with '--avoid=copy'"); break; case 'S': SILENT = true; @@ -1561,6 +1580,7 @@ break; case 'P': NOPROCS = true; + Deprecated("2.0.4", "Replace '-p' with '--avoid=processes'"); break; case 'q': NOSPLAY = true; @@ -1569,7 +1589,15 @@ case 'Y': CFPARANOID = true; break; + case 'j': actionList = SplitStringAsItemList(optarg, ','); + VJUSTACTIONS = ConcatLists(actionList, VJUSTACTIONS); + break; + + case 'o': actionList = SplitStringAsItemList(optarg, ','); + VAVOIDACTIONS = ConcatLists(actionList, VAVOIDACTIONS); + break; + default: Syntax(); exit(1); --- cfengine2-2.0.3.orig/src/item.c +++ cfengine2-2.0.3/src/item.c @@ -98,6 +98,28 @@ /*********************************************************************/ +/* Notes: * Refrain from freeing list2 after using ConcatLists + * * list1 must have at least one element in it */ +struct Item *ConcatLists (list1, list2) + +struct Item *list1, *list2; + +{ struct Item *endOfList1; + +if (list1 == NULL) + { + FatalError("ConcatLists: first argument must have at least one element"); + } + +for (endOfList1=list1; endOfList1->next!=NULL; endOfList1=endOfList1->next) + { + } +endOfList1->next = list2; +return list1; +} + +/*********************************************************************/ + void PrependItem (liststart,itemstring,classes) struct Item **liststart; --- cfengine2-2.0.3.orig/src/globals.c +++ cfengine2-2.0.3/src/globals.c @@ -221,6 +221,8 @@ PROTECTED struct Item *VACCESSLIST=NULL; PROTECTED struct Item *VADDCLASSES=NULL; /* Action sequence defs */ PROTECTED struct Item *VALLADDCLASSES=NULL; /* All classes */ + PROTECTED struct Item *VJUSTACTIONS=NULL; + PROTECTED struct Item *VAVOIDACTIONS=NULL; PROTECTED struct UnMount *VUNMOUNT=NULL; PROTECTED struct UnMount *VUNMOUNTTOP=NULL; PROTECTED struct Edit *VEDITLIST=NULL; @@ -335,6 +337,8 @@ { "zone-info",no_argument,0,'z'}, { "update-only",no_argument,0,'B'}, { "check-contradictions",no_argument,0,'g'}, + { "just",required_argument,0,'j'}, + { "avoid",required_argument,0,'o'}, { NULL,0,0,0 } }; --- cfengine2-2.0.3.orig/src/errors.c +++ cfengine2-2.0.3/src/errors.c @@ -59,6 +59,19 @@ } } +void Deprecated(deprecatedVersion, s) + +char *deprecatedVersion; +char *s; + +{ +if (strcmp(deprecatedVersion, VERSION) <= 0) + { + fprintf (stderr, "%s: Warning: deprecated in %s: %s", + VPREFIX, deprecatedVersion, s); + } +} + /*********************************************************************/ void ResetLine(s)