sbcl rebuild
[arch-packages.git] / imap / trunk / imap.install
blob1f554a88284cc93cf541d3ccf3cb7ccc994acbbe
1 post_install() {
2   if [ ! -e /etc/ssl/certs/imapd.pem ]; then
3     generate_certificate imapd
4   fi
5   if [ ! -e /etc/ssl/certs/ipop3d.pem ]; then
6     generate_certificate ipop3d
7   fi
10 post_upgrade() {
11   post_install
14 generate_certificate() {
15   t=$1
16   echo -n "Generating $t certificate..."
18   umask 077
19   tmpdir=$(mktemp -d)
20   PEM1="$tmpdir/$t.pem1"
21   PEM2="$tmpdir/$t.pem2"
22   cert="$tmpdir/$t.pem"
23   /usr/bin/openssl req -newkey rsa:4096 -keyout "$PEM1" \
24     -nodes -x509 -days 365 -out "$PEM2" >/dev/null 2>&1 << EOF
26 SomeState
27 SomeCity
28 SomeOrganization
29 SomeOrganizationalUnit
30 localhost.localdomain
31 root@localhost.localdomain
32 EOF
34   cat "$PEM1" >  "$cert"
35   echo ""     >> "$cert"
36   cat "$PEM2" >> "$cert"
37   install -Dm 600 "$cert" -t /etc/ssl/certs
38   rm -rf "$tmpdir"
39   echo "done."