OSDN Git Service

2010-05-07 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / libjava / classpath / scripts / import-cacerts.sh
1 #!/bin/sh
2
3 function visitFile() {
4         install/bin/gkeytool \
5         -cacert \
6         -v \
7         -storepass changeit \
8         -keystore resource/java/security/cacerts.gkr \
9         -file "$1"
10 }
11
12 function visitDir() {
13         local d
14         d=$1
15         for f in "$d/"*
16         do
17                 if [ -d "$f" ] ; then
18                         visitDir "$f"
19                 else
20                         visitFile "$f"
21                 fi
22         done
23 }
24
25 if [ "$#" -lt "1" ] ; then
26         echo "Usage: import-cacerts DIR"
27         echo "Import CA trusted certificates into a 'cacerts.gkr' key store"
28         echo "under resource/java/security using 'changeit' as its password,"
29         echo "and constructing the Alias from the certificate's file name."
30         echo
31         echo "  DIR  the 'ca-certificates' deb package installation directory"
32         echo "         containing trusted CA certificates."
33         echo
34 else
35         caDir=$1
36         if [ ! -d $caDir ] ; then
37                 echo "Argument MUST be a directory."
38                 echo "Type command with no arguments for usage string."
39                 exit 1
40         fi
41         visitDir $caDir
42 fi
43 exit 0