3 namespace WebProvisioning
7 public static int main (string[] args)
10 int force_flat_file_store = 0;
11 bool bad_switch = false;
12 for (arg_index = 1; arg_index < args.length; arg_index++) {
13 string arg = args[arg_index];
14 unichar c = arg.get_char();
16 arg = arg.next_char();
20 force_flat_file_store = 1;
27 break; // arg is not a switch; presume it's the file
30 if (bad_switch || (arg_index != args.length - 1))
32 stdout.printf (_("Usage %s [-f] WEB_PROVISIONING_FILE\n -f: add identities to flat file store.\n"), args[0]);
35 string webp_file = args[arg_index];
37 if (!FileUtils.test (webp_file, FileTest.EXISTS | FileTest.IS_REGULAR))
39 stdout.printf (_("%s does not exist\n"), webp_file);
43 var webp = new Parser (webp_file);
46 foreach (IdCard card in cards)
49 string[] rules_patterns = {};
50 string[] rules_always_confirm = {};
52 /* use temp arrays to workaround centos array property bug */
53 var rules = card.rules;
54 var services = card.services;
58 rules_patterns = new string[rules.length];
59 rules_always_confirm = new string[rules.length];
60 foreach (Rule r in rules)
62 rules_patterns[i] = r.pattern;
63 rules_always_confirm[i] = r.always_confirm;
68 Moonshot.install_id_card (card.display_name,
75 card.trust_anchor.ca_cert,
76 card.trust_anchor.subject,
77 card.trust_anchor.subject_alt,
78 card.trust_anchor.server_cert,
79 force_flat_file_store,
84 stderr.printf ("Error: %s", error.message);