projects
/
crypto-install.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f575613
)
Log directory creation.
author
Olof-Joachim Frahm
<olof@macrolet.net>
Sat, 10 Jan 2015 21:12:13 +0000
(21:12 +0000)
committer
Olof-Joachim Frahm
<olof@macrolet.net>
Sat, 10 Jan 2015 21:12:33 +0000
(21:12 +0000)
crypto-install.py
patch
|
blob
|
history
diff --git
a/crypto-install.py
b/crypto-install.py
index
9715441
..
11e45eb
100755
(executable)
--- a/
crypto-install.py
+++ b/
crypto-install.py
@@
-70,6
+70,14
@@
def parse_arguments ():
return parser.parse_args ()
return parser.parse_args ()
+def ensure_directories (path, mode = 0o777):
+ try:
+ os.makedirs (path, mode)
+ except OSError as exception:
+ if exception.errno != errno.EEXIST:
+ raise
+
+
def gnupg_setup (arguments):
gnupg_home = os.path.expanduser (arguments.gnupg_home)
gnupg_secring = os.path.join (gnupg_home, "secring.gpg")
def gnupg_setup (arguments):
gnupg_home = os.path.expanduser (arguments.gnupg_home)
gnupg_secring = os.path.join (gnupg_home, "secring.gpg")
@@
-92,6
+100,7
@@
def gnupg_setup (arguments):
comment = read_input_string ("What is your comment phrase, if any (e.g. 'key for 2014')? ")
if not os.path.exists (gnupg_home):
comment = read_input_string ("What is your comment phrase, if any (e.g. 'key for 2014')? ")
if not os.path.exists (gnupg_home):
+ print ("Creating GnuPG directory at {!r}.".format (gnupg_home))
ensure_directories (gnupg_home, 0o700)
with tempfile.NamedTemporaryFile () as tmp:
ensure_directories (gnupg_home, 0o700)
with tempfile.NamedTemporaryFile () as tmp:
@@
-123,21
+132,15
@@
def gnupg_setup (arguments):
raise Exception ("Couldn't create GnuPG key.")
raise Exception ("Couldn't create GnuPG key.")
-def ensure_directories (path, mode = 0o777):
- try:
- os.makedirs (path, mode)
- except OSError as exception:
- if exception.errno != errno.EEXIST:
- raise
-
-
def openssh_setup (arguments):
openssh_home = os.path.expanduser (arguments.openssh_home)
openssh_config = os.path.join (openssh_home, "config")
if not os.path.exists (openssh_config):
def openssh_setup (arguments):
openssh_home = os.path.expanduser (arguments.openssh_home)
openssh_config = os.path.join (openssh_home, "config")
if not os.path.exists (openssh_config):
+ print ("Creating OpenSSH directory at {!r}.".format (openssh_home))
ensure_directories (openssh_home, 0o700)
ensure_directories (openssh_home, 0o700)
+ print ("Creating OpenSSH configuration at {!r}.".format (openssh_config))
with open (openssh_config, "w") as config:
config.write (dedented ("""
ForwardAgent yes
with open (openssh_config, "w") as config:
config.write (dedented ("""
ForwardAgent yes
@@
-147,7
+150,7
@@
def openssh_setup (arguments):
openssh_key = os.path.join (openssh_home, "id_rsa")
if os.path.exists (openssh_key):
openssh_key = os.path.join (openssh_home, "id_rsa")
if os.path.exists (openssh_key):
- print("OpenSSH key already exists at {!r}.".format (openssh_key))
+ print ("OpenSSH key already exists at {!r}.".format (openssh_key))
return
print (filled ("No OpenSSH key available. Generating new key."))
return
print (filled ("No OpenSSH key available. Generating new key."))