diff options
author | Michael Larson <slioch@slioch.vyatta.com> | 2010-05-28 18:18:41 -0700 |
---|---|---|
committer | Michael Larson <slioch@slioch.vyatta.com> | 2010-05-28 18:18:41 -0700 |
commit | 6b1986c30db0f0eafc9df92ee5c8c7f069af2ab2 (patch) | |
tree | 1599a327a3ba4eddd7ba6e77e20553d107c9671c | |
parent | b02d17e1d3d3ecac35a0041eb5ab8dd041d6438f (diff) | |
download | vyatta-cfg-6b1986c30db0f0eafc9df92ee5c8c7f069af2ab2.tar.gz vyatta-cfg-6b1986c30db0f0eafc9df92ee5c8c7f069af2ab2.zip |
added hook at completion of commit process.
-rw-r--r-- | src/commit2.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/commit2.c b/src/commit2.c index 97c3b26..0333411 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -112,6 +112,7 @@ usage(void) printf("\t-o\t\tdisable partial commit\n"); printf("\t-f\t\tfull iteration over configuration on commit check\n"); printf("\t-b\t\tbreak on each priority node (debug mode)\n"); + printf("\t-r [FILE]\trun hook script on finishing commit\n"); printf("\t-h\t\thelp\n"); } @@ -128,12 +129,13 @@ main(int argc, char** argv) boolean disable_partial_commit = FALSE; boolean full_commit_check = FALSE; boolean break_priority = FALSE; + char *hook = NULL; /* this is needed before calling certain glib functions */ g_type_init(); //grab inputs - while ((ch = getopt(argc, argv, "dpthsecoafb")) != -1) { + while ((ch = getopt(argc, argv, "dpthsecoafbr:")) != -1) { switch (ch) { case 'd': g_debug = TRUE; @@ -169,6 +171,9 @@ main(int argc, char** argv) case 'b': break_priority = TRUE; break; + case 'r': + hook = optarg; + break; default: usage(); exit(0); @@ -342,6 +347,10 @@ main(int argc, char** argv) fclose(fp_changes); } + if (hook != NULL) { + system(hook); + } + //remove tmp changes file as all the work is now done unlink("/tmp/.changes"); |