[Pgp-tools-commit] r761 - trunk/caff

Guilhem Moulin guilhem-guest at moszumanska.debian.org
Wed Jan 21 00:15:54 UTC 2015


Author: guilhem-guest
Date: 2015-01-21 00:15:54 +0000 (Wed, 21 Jan 2015)
New Revision: 761

Modified:
   trunk/caff/caff
Log:
caff: auto-create ~/.caff/gnupghome before the symlinks if needed.

Modified: trunk/caff/caff
===================================================================
--- trunk/caff/caff	2015-01-21 00:15:43 UTC (rev 760)
+++ trunk/caff/caff	2015-01-21 00:15:54 UTC (rev 761)
@@ -571,12 +571,15 @@
 			."Create a symlink to $CONFIG{'secret-keyring'} in $CONFIG{'caffhome'}/gnupghome instead.\n");
 		delete $CONFIG{'secret-keyring'};
 	} else {
+		unless (-d $CONFIG{'caffhome'}.'/gnupghome') {
+			mkdir $CONFIG{'caffhome'}.'/gnupghome', 0700 or die "Cannot mkdir: $!\n";
+		}
 		foreach my $sec (qw/secring.gpg private-keys-v1.d/) {
 			my $osec = ($ENV{'GNUPGHOME'} || "$ENV{'HOME'}/.gnupg") .'/'. $sec;
 			my $nsec = $CONFIG{'caffhome'}.'/gnupghome/'.$sec;
 			unless (-e $nsec) {
 				info ("Creating symlink $nsec to $osec.");
-				symlink $osec, $nsec;
+				symlink $osec, $nsec or die "Cannot create symlink: $!\n";
 			}
 		}
 	}




More information about the Pgp-tools-commit mailing list