CernVM-FS  2.9.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 "hash.h"
24 #include "logging.h"
25 #include "manifest.h"
26 #include "object_fetcher.h"
27 #include "reflog.h"
28 #include "signature.h"
29 #include "signing_tool.h"
30 #include "smalloc.h"
31 #include "upload.h"
32 #include "util/posix.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  const bool garbage_collectable = (args.count('g') > 0);
55  const bool bootstrap_shortcuts = (args.count('A') > 0);
56  const bool return_early = (args.count('e') > 0);
57 
58  string reflog_chksum_path;
59  shash::Any reflog_hash;
60  if (args.find('R') != args.end()) {
61  reflog_chksum_path = *args.find('R')->second;
62  }
63 
64  SigningTool signing_tool(this);
65  return signing_tool.Run(manifest_path, repo_url, spooler_definition, temp_dir,
66  certificate, priv_key, repo_name, pwd, meta_info,
67  reflog_chksum_path, garbage_collectable,
68  bootstrap_shortcuts, return_early);
69 }
HttpObjectFetcher ObjectFetcher
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 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
int Main(const ArgumentList &args)
std::map< char, SharedPtr< std::string > > ArgumentList
Definition: swissknife.h:72
std::string meta_info() const
Definition: repository.h:126