CernVM-FS  2.12.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 #include "cvmfs_config.h"
9 
10 #include <dirent.h>
11 #include <sys/stat.h>
12 #include <sys/types.h>
13 #include <termios.h>
14 #include <unistd.h>
15 
16 #include <cstdio>
17 #include <cstdlib>
18 #include <set>
19 #include <string>
20 #include <vector>
21 
22 #include "compression.h"
23 #include "crypto/hash.h"
24 #include "crypto/signature.h"
25 #include "manifest.h"
26 #include "object_fetcher.h"
27 #include "reflog.h"
28 #include "signing_tool.h"
29 #include "upload.h"
30 #include "util/logging.h"
31 #include "util/posix.h"
32 #include "util/smalloc.h"
33 
34 using namespace std; // NOLINT
35 
37 
39  string manifest_path = *args.find('m')->second;
40  string repo_url = *args.find('u')->second;
41  string spooler_definition = *args.find('r')->second;
42  string temp_dir = *args.find('t')->second;
43 
44  string certificate = "";
45  if (args.find('c') != args.end()) certificate = *args.find('c')->second;
46  string priv_key = "";
47  if (args.find('k') != args.end()) priv_key = *args.find('k')->second;
48  string repo_name = "";
49  if (args.find('n') != args.end()) repo_name = *args.find('n')->second;
50  string pwd = "";
51  if (args.find('s') != args.end()) pwd = *args.find('s')->second;
52  string meta_info = "";
53  if (args.find('M') != args.end()) meta_info = *args.find('M')->second;
54  string proxy = "";
55  if (args.find('@') != args.end()) proxy = *args.find('@')->second;
56  const bool garbage_collectable = (args.count('g') > 0);
57  const bool bootstrap_shortcuts = (args.count('A') > 0);
58  const bool return_early = (args.count('e') > 0);
59 
60  string reflog_chksum_path;
61  shash::Any reflog_hash;
62  if (args.find('R') != args.end()) {
63  reflog_chksum_path = *args.find('R')->second;
64  }
65 
66  SigningTool signing_tool(this);
67  return signing_tool.Run(manifest_path, repo_url, spooler_definition, temp_dir,
68  certificate, priv_key, repo_name, pwd, meta_info,
69  reflog_chksum_path, proxy, garbage_collectable,
70  bootstrap_shortcuts, return_early);
71 }
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:27
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