X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=main.ml;h=391074d3ea6ca58a2e383199c2b52e756849c9f4;hb=4ceb13b255ee9068bc070551b1abe1b293fdecc1;hp=be96b82e074bafa8996f1ac0436499190cfb2f27;hpb=02c48a292844be161535d6aeb8c96b018d4b0ac9;p=vsys.git diff --git a/main.ml b/main.ml index be96b82..391074d 100644 --- a/main.ml +++ b/main.ml @@ -5,6 +5,7 @@ open Inotify open Backend open Frontend open Fifowatcher +open Conffile let input_file_list = ref [] let cur_dir = ref "" @@ -12,6 +13,7 @@ let cur_slice = ref "" let cmdspeclist = [ + ("-conffile",Arg.Set_string(Globals.conffile), "Config file"); ("-backend",Arg.Set_string(Globals.backend), "Backend directory"); ("-frontend",Arg.Tuple[Arg.String(fun s->cur_dir:=s);Arg.String(fun s->cur_slice:=s;input_file_list:=(!cur_dir,!cur_slice)::!input_file_list)], "frontendN,slicenameN"); ("-nochroot",Arg.Set(Globals.nochroot), "Run in non-chroot environment") @@ -22,13 +24,17 @@ let cont = ref true let _ = printf "Vsys v%s\n" Globals.vsys_version;flush stdout; Arg.parse cmdspeclist (fun x->()) "Usage: vsys "; - if (!Globals.backend == "" || !input_file_list == []) then + if (!Globals.backend == "") then printf "Try vsys --help\n" else begin Dirwatcher.initialize (); Fifowatcher.initialize (); - let felst = List.map (fun lst->new frontendHandler lst) !input_file_list in + if (!Globals.conffile != "") then + let frontends = Conffile.read_frontends !Globals.conffile in + input_file_list:=List.concat [!input_file_list;frontends]; + + let felst = List.map (fun lst->let (x,y)=lst in printf "Slice %s (%s)\n" x y;flush Pervasives.stdout;new frontendHandler lst) !input_file_list in let _ = new backendHandler !Globals.backend felst in Fdwatcher.start_watch () end