@@ -145,6 +145,7 @@ static void usage(char *progname)
145145 printf (" -v,--verbose be verbose\n" );
146146 printf (" -P,--preserve_tunables Preserve tunables in policy\n" );
147147 printf (" -C,--ignore-module-cache Rebuild CIL modules compiled from HLL files\n" );
148+ printf (" -o,--config=PATH use an alternate path for the semanage config\n" );
148149 printf (" -p,--path use an alternate path for the policy root\n" );
149150 printf (" -S,--store-path use an alternate path for the policy store root\n" );
150151 printf (" -c, --cil extract module as cil. This only affects module extraction.\n" );
@@ -210,6 +211,7 @@ static void parse_command_line(int argc, char **argv)
210211 {"enable" , required_argument , NULL , 'e' },
211212 {"disable" , required_argument , NULL , 'd' },
212213 {"path" , required_argument , NULL , 'p' },
214+ {"config" , required_argument , NULL , 'o' },
213215 {"store-path" , required_argument , NULL , 'S' },
214216 {"checksum" , 0 , NULL , 'm' },
215217 {NULL , 0 , NULL , 0 }
@@ -223,7 +225,7 @@ static void parse_command_line(int argc, char **argv)
223225 check_ext_changes = 0 ;
224226 priority = 400 ;
225227 while ((i =
226- getopt_long (argc , argv , "s:b:hi:l::vr:u:RnNBDCPX:e:d:p:S:E:cHm" ,
228+ getopt_long (argc , argv , "s:b:hi:l::vr:u:RnNBDCPX:e:d:p:o: S:E:cHm" ,
227229 opts , & longind )) != -1 ) {
228230 switch (i ) {
229231 case '\0' :
@@ -304,6 +306,14 @@ static void parse_command_line(int argc, char **argv)
304306 case 'C' :
305307 ignore_module_cache = 1 ;
306308 break ;
309+ case 'o' :
310+ sh = semanage_handle_create_with_path (optarg );
311+ if (!sh ) {
312+ fprintf (stderr , "%s: Could not create semanage handle\n" ,
313+ argv [0 ]);
314+ exit (1 );
315+ }
316+ break ;
307317 case 'X' :
308318 set_mode (PRIORITY_M , optarg );
309319 break ;
@@ -421,11 +431,13 @@ int main(int argc, char *argv[])
421431 if (build || check_ext_changes )
422432 commit = 1 ;
423433
424- sh = semanage_handle_create ();
425434 if (!sh ) {
426- fprintf (stderr , "%s: Could not create semanage handle\n" ,
427- argv [0 ]);
428- goto cleanup_nohandle ;
435+ sh = semanage_handle_create ();
436+ if (!sh ) {
437+ fprintf (stderr , "%s: Could not create semanage handle\n" ,
438+ argv [0 ]);
439+ goto cleanup_nohandle ;
440+ }
429441 }
430442
431443 if (store ) {
0 commit comments