~ubuntu-branches/ubuntu/trusty/ca-certificates/trusty-proposed

« back to all changes in this revision

Viewing changes to sbin/update-ca-certificates

  • Committer: Bazaar Package Importer
  • Author(s): Fumitoshi UKAI
  • Date: 2004-08-09 03:23:20 UTC
  • mfrom: (1.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040809032320-29vpp5g9f4xroy2g
Tags: 20040809
previous version was not fixed Bug#255933 correctly.
update-ca-certificates now remove symlinks of deselected entries 
in ca-certificates.conf
closes: Bug#255933

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
#
 
3
# update-ca-certificates
 
4
#
 
5
# Copyright (c) 2003 Fumitoshi UKAI <ukai@debian.or.jp>
 
6
 
7
# This program is free software; you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation; either version 2 of the License, or
 
10
# (at your option) any later version.
 
11
#
 
12
# This program is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with this program; if not, write to the Free Software
 
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
20
#
 
21
 
 
22
verbose=0
 
23
fresh=0
 
24
while [ $# -gt 0 ];
 
25
do
 
26
  case $1 in
 
27
  --verbose|-v)
 
28
        verbose=1;;
 
29
  --fresh|-f)
 
30
        fresh=1;;
 
31
  --help|-h|*)
 
32
        echo "$0: [--verbose] [--fresh]"
 
33
        exit;;
 
34
  esac
 
35
  shift
 
36
done
 
37
 
 
38
CERTSCONF=/etc/ca-certificates.conf
 
39
CERTSDIR=/usr/share/ca-certificates
 
40
cd /etc/ssl/certs
 
41
if [ "$fresh" = 1 ]; then
 
42
  echo -n "Clearing symlinks in /etc/ssl/certs..."
 
43
  find . -type l -print0 | xargs -0 rm -f
 
44
  echo "done."
 
45
fi
 
46
echo -n "Updating certificates in /etc/ssl/certs...."
 
47
 
 
48
rm -f ca-certificates.crt
 
49
sed -ne 's/^!//p' $CERTSCONF | while read crt
 
50
do
 
51
 if test "$crt" = ""; then continue; fi
 
52
 pem=$(basename "$crt" .crt).pem
 
53
 if test -e "$pem"; then rm -f "$pem"; fi
 
54
done
 
55
 
 
56
sed -e '/^#/d' -e '/^!/d' $CERTSCONF | while read crt
 
57
do
 
58
 if test "$crt" = ""; then continue; fi
 
59
 if ! test -f "$CERTSDIR/$crt"; then continue; fi
 
60
 pem=$(basename "$crt" .crt).pem
 
61
 ln -sf "$CERTSDIR/$crt" "$pem"
 
62
 cat "$CERTSDIR/$crt" >> ca-certificates.crt
 
63
done
 
64
if [ "$verbose" = 0 ]; then
 
65
  c_rehash . > /dev/null 2>&1
 
66
else
 
67
  c_rehash .
 
68
fi
 
69
echo "done."
 
70