~ubuntu-branches/ubuntu/natty/ca-certificates/natty

« back to all changes in this revision

Viewing changes to sbin/update-ca-certificates

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Kern
  • Date: 2008-08-09 14:58:24 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20080809145824-4g3eot1a99uxmwzj
* New cacert.org.pem joining both CACert Class 1 and Class 3 certificates.
  This file can be used for proper certificate chaining if CACert
  server certificates are used.  The old class3.pem and root.pem
  certificates are deprecated.  This new file could safely serve as
  a replacement for both.  (Closes: #494343)
* This also reintroduces the old name for the CACert certificate,
  thus closing a long-standing bug about its rename to root.crt.
  (Closes: #413766)

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
CERTSCONF=/etc/ca-certificates.conf
39
39
CERTSDIR=/usr/share/ca-certificates
40
40
CERTBUNDLE=ca-certificates.crt
41
 
cd /etc/ssl/certs
 
41
ETCCERTSDIR=/etc/ssl/certs
 
42
cd $ETCCERTSDIR
42
43
if [ "$fresh" = 1 ]; then
43
 
  echo -n "Clearing symlinks in /etc/ssl/certs..."
 
44
  echo -n "Clearing symlinks in $ETCCERTSDIR..."
44
45
  find . -type l -print | while read symlink
45
46
  do
46
47
     case $(readlink $symlink) in
53
54
  done
54
55
  echo "done."
55
56
fi
56
 
echo -n "Updating certificates in /etc/ssl/certs...."
 
57
echo -n "Updating certificates in $ETCCERTSDIR...."
57
58
 
58
59
bundletmp=`mktemp "${CERTBUNDLE}.tmp.XXXXXX"`
59
 
sed -ne 's/^!//p' $CERTSCONF | while read crt
 
60
removed="$(sed -ne 's/^!//p' $CERTSCONF | while read crt
60
61
do
61
62
 if test "$crt" = ""; then continue; fi
62
63
 pem=$(basename "$crt" .crt).pem
63
 
 if test -e "$pem"; then rm -f "$pem"; fi
64
 
done
 
64
 if test -e "$pem"; then
 
65
  rm -f "$pem"
 
66
  echo "-$ETCCERTSDIR/$pem"
 
67
 fi
 
68
done)"
65
69
 
66
 
sed -e '/^#/d' -e '/^!/d' $CERTSCONF | while read crt
 
70
added="$(sed -e '/^#/d' -e '/^!/d' $CERTSCONF | while read crt
67
71
do
68
72
 if test "$crt" = ""; then continue; fi
69
73
 if ! test -f "$CERTSDIR/$crt"; then continue; fi
70
74
 pem=$(basename "$crt" .crt).pem
 
75
 if ! test -e "$pem"; then echo "+$ETCCERTSDIR/$pem"; fi
71
76
 ln -sf "$CERTSDIR/$crt" "$pem"
72
77
 cat "$CERTSDIR/$crt" >> "$bundletmp"
73
 
done
 
78
done)"
74
79
chmod 0644 "$bundletmp"
75
80
mv -f "$bundletmp" "$CERTBUNDLE"
76
81
 
77
 
if [ "$verbose" = 0 ]; then
78
 
  c_rehash . > /dev/null 2>&1
 
82
if [ -n "$added" ] || [ -n "$removed" ]; then
 
83
  # only run if set of files has changed
 
84
 
 
85
  if [ "$verbose" = 0 ]; then
 
86
    c_rehash . > /dev/null 2>&1
 
87
  else
 
88
    c_rehash .
 
89
  fi
 
90
  echo "done."
 
91
 
 
92
  HOOKSDIR=/etc/ca-certificates/update.d
 
93
  echo -n "Running hooks in $HOOKSDIR...."
 
94
  VERBOSE_ARG=
 
95
  [ "$verbose" = 0 ] || VERBOSE_ARG=--verbose
 
96
  eval run-parts $VERB_ARG --test -- $HOOKSDIR | while read hook; do
 
97
  printf -- "${removed:+$removed\n}${added:+$added\n}" | eval $hook
 
98
  done
 
99
  echo "done."
79
100
else
80
 
  c_rehash .
 
101
  echo "done."
81
102
fi
82
 
echo "done."
83