66 lines
1.5 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../ca-certificates/ca-certificates.conf
# Copyright (C) 2011 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
oval=""
target=${root}/etc/ssl/certs/ca-bundle.crt
do_append ()
{
while [ 1 ]; do
shift
if [ -z $1 ]; then break; fi
oval="$oval\0$1"
done
}
ca_convert()
{
local incert=0
local count=0
echo -n > ${target}
while read -r LINE; do
if [ "${LINE}" = "CKA_VALUE MULTILINE_OCTAL" ]
then
# certificate start
incert=1
oval=""
elif [ "${LINE}" = "END" -a $incert -eq 1 ]
then
# certificate end
echo -e -n "$oval" | openssl x509 -text -inform DER -fingerprint >> ${target}
echo -n "."
count=$(($count + 1))
incert=0
elif [ $incert -eq 1 ]
then
# certificate data
IFS="\\"
do_append $LINE
fi
done < $1
echo -e "\nDone. $count CA's converted."
}
ca_pm()
{
mkdir -p $root/etc/ssl
ca_convert "$( match_source_file -p ca-certificates )"
cd $root/etc/ssl && ln -sf certs/ca-bundle.crt cert.pem
}
chownsrcdir=0
runconf=0
mainfunction=ca_pm