import-cacerts.sh 885 B

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