CernVM-FS  2.13.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
swissknife_sign.cc
Go to the documentation of this file.
1 
7 #include "swissknife_sign.h"
8 
9 #include <dirent.h>
10 #include <sys/stat.h>
11 #include <sys/types.h>
12 #include <termios.h>
13 #include <unistd.h>
14 
15 #include <cstdio>
16 #include <cstdlib>
17 #include <set>
18 #include <string>
19 #include <vector>
20 
22 #include "crypto/hash.h"
23 #include "crypto/signature.h"
24 #include "manifest.h"
25 #include "object_fetcher.h"
26 #include "reflog.h"
27 #include "signing_tool.h"
28 #include "upload.h"
29 #include "util/logging.h"
30 #include "util/posix.h"
31 #include "util/smalloc.h"
32 
33 using namespace std; // NOLINT
34 
36 
38  string manifest_path = *args.find('m')->second;
39  string repo_url = *args.find('u')->second;
40  string spooler_definition = *args.find('r')->second;
41  string temp_dir = *args.find('t')->second;
42 
43  string certificate = "";
44  if (args.find('c') != args.end())
45  certificate = *args.find('c')->second;
46  string priv_key = "";
47  if (args.find('k') != args.end())
48  priv_key = *args.find('k')->second;
49  string repo_name = "";
50  if (args.find('n') != args.end())
51  repo_name = *args.find('n')->second;
52  string pwd = "";
53  if (args.find('s') != args.end())
54  pwd = *args.find('s')->second;
55  string meta_info = "";
56  if (args.find('M') != args.end())
57  meta_info = *args.find('M')->second;
58  string proxy = "";
59  if (args.find('@') != args.end())
60  proxy = *args.find('@')->second;
61  const bool garbage_collectable = (args.count('g') > 0);
62  const bool bootstrap_shortcuts = (args.count('A') > 0);
63  const bool return_early = (args.count('e') > 0);
64 
65  string reflog_chksum_path;
66  shash::Any reflog_hash;
67  if (args.find('R') != args.end()) {
68  reflog_chksum_path = *args.find('R')->second;
69  }
70 
71  SigningTool signing_tool(this);
72  return signing_tool.Run(manifest_path, repo_url, spooler_definition, temp_dir,
73  certificate, priv_key, repo_name, pwd, meta_info,
74  reflog_chksum_path, proxy, garbage_collectable,
75  bootstrap_shortcuts, return_early);
76 }
Result Run(const std::string &manifest_path, const std::string &repo_url, const std::string &spooler_definition, const std::string &temp_dir, const std::string &certificate="", const std::string &priv_key="", const std::string &repo_name="", const std::string &pwd="", const std::string &meta_info="", const std::string &reflog_chksum_path="", const std::string &proxy="", const bool garbage_collectable=false, const bool bootstrap_shortcuts=false, const bool return_early=false, const std::vector< shash::Any > reflog_catalogs=std::vector< shash::Any >())
Definition: signing_tool.cc:28
HttpObjectFetcher ObjectFetcher
int Main(const ArgumentList &args)
std::map< char, SharedPtr< std::string > > ArgumentList
Definition: swissknife.h:72
std::string meta_info() const
Definition: repository.h:128