Changeset 299
- Timestamp:
- 08/15/08 20:36:18 (3 months ago)
- Files:
-
- gpgdir/trunk/gpgdir (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gpgdir/trunk/gpgdir
r293 r299 32 32 # 33 33 34 use lib '/usr/lib/gpgdir';35 34 use File::Find; 36 35 use File::Copy; 37 use Term::ReadKey;38 use GnuPG::Interface;39 36 use IO::File; 40 37 use IO::Handle; … … 61 58 my $include_pat = ''; 62 59 my $include_file = ''; 60 my $lib_dir = '/usr/lib/gpgdir'; 63 61 my $pid_file = ''; 64 62 my $total_encrypted = 0; … … 181 179 'no-LC_ALL' => \$no_locale, 182 180 'no-locale' => \$no_locale, # synonym 181 'Lib-dir=s' => \$lib_dir, # Path to perl module path 183 182 'verbose' => \$verbose, # Verbose mode. 184 183 'Version' => \$printver, # Print version … … 204 203 die "[*] The -d and --overwrite-encrypted options are incompatible."; 205 204 } 205 206 ### import perl modules (GnuPG::Interface, etc.) 207 &import_perl_modules(); 206 208 207 209 if ($wipe_mode) { … … 1080 1082 my $msg = 'Password: '; 1081 1083 ### get the password without echoing the chars back to the screen 1082 ReadMode 'noecho';1084 ReadMode('noecho'); 1083 1085 while (! $pw) { 1084 1086 print $msg; 1085 $pw = ReadLine 0;1087 $pw = ReadLine(0); 1086 1088 chomp $pw; 1087 1089 } 1088 ReadMode 'normal';1090 ReadMode('normal'); 1089 1091 if ($quiet) { 1090 1092 print "\n"; … … 1204 1206 close P; 1205 1207 return; 1208 } 1209 1210 sub import_perl_modules() { 1211 1212 my $mod_paths_ar = &get_mod_paths(); 1213 1214 if ($#$mod_paths_ar > -1) { ### /usr/lib/gpgdir/ exists 1215 push @$mod_paths_ar, @INC; 1216 splice @INC, 0, $#$mod_paths_ar+1, @$mod_paths_ar; 1217 } 1218 1219 if ($verbose) { 1220 print "[+] import_perl_modules(): The \@INC array:\n"; 1221 print "$_\n" for @INC; 1222 } 1223 1224 require GnuPG::Interface; 1225 require Term::ReadKey; 1226 1227 Term::ReadKey->import(qw/ReadMode ReadLine/); 1228 1229 return; 1230 } 1231 1232 sub get_mod_paths() { 1233 1234 my @paths = (); 1235 1236 unless (-d $lib_dir) { 1237 my $dir_tmp = $lib_dir; 1238 $dir_tmp =~ s|lib/|lib64/|; 1239 if (-d $dir_tmp) { 1240 $lib_dir = $dir_tmp; 1241 } else { 1242 return []; 1243 } 1244 } 1245 1246 opendir D, $lib_dir or die "[*] Could not open $lib_dir: $!"; 1247 my @dirs = readdir D; 1248 closedir D; 1249 1250 push @paths, $lib_dir; 1251 1252 for my $dir (@dirs) { 1253 ### get directories like "/usr/lib/gpgdir/x86_64-linux" 1254 next unless -d "$lib_dir/$dir"; 1255 push @paths, "$lib_dir/$dir" 1256 if $dir =~ m|linux| or $dir =~ m|thread|; 1257 } 1258 return \@paths; 1206 1259 } 1207 1260 … … 1285 1338 -u, --user-homedir <dir> - Path to home directory. 1286 1339 -l, --locale <locale> - Manually define a locale setting. 1340 --Lib-dir <path> - Path to the perl modules directory (not 1341 usually necessary). 1287 1342 --no-locale - Don't set the locale to anything (the 1288 1343 default is the "C" locale).
