Blame SOURCES/ca-legacy

77503b
#!/bin/sh
77503b
77503b
#set -vx
77503b
77503b
LCFILE=/etc/pki/ca-trust/ca-legacy.conf
77503b
LLINK=/etc/pki/ca-trust/source/ca-bundle.legacy.crt
77503b
LDEFAULT=/usr/share/pki/ca-trust-legacy/ca-bundle.legacy.default.crt
77503b
LDISABLE=/usr/share/pki/ca-trust-legacy/ca-bundle.legacy.disable.crt
77503b
77503b
# An absent value, or any unexpected value, is treated as "default".
77503b
is_disabled()
77503b
{
77503b
    grep -i "^legacy *= *disable *$" $LCFILE >/dev/null 2>&1
77503b
}
77503b
77503b
do_check()
77503b
{
77503b
    is_disabled
77503b
    if [ $? -eq 0 ]; then
77503b
        echo "Legacy CAs are set to DISABLED in file $LCFILE (affects install/upgrade)"
77503b
        LEXPECT=$LDISABLE
77503b
    else
77503b
        echo "Legacy CAs are set to DEFAULT in file $LCFILE (affects install/upgrade)"
77503b
        LEXPECT=$LDEFAULT
77503b
    fi
77503b
    echo "Status of symbolic link $LLINK:"
77503b
    readlink -v $LLINK
77503b
}
77503b
77503b
do_install()
77503b
{
77503b
    is_disabled
77503b
    if [ $? -eq 0 ]; then
77503b
        # found, legacy is disabled
77503b
        ln -sf $LDISABLE $LLINK
77503b
    else
77503b
        # expression not found, legacy is set to default
77503b
        ln -sf $LDEFAULT $LLINK
77503b
    fi
77503b
}
77503b
77503b
do_default()
77503b
{
77503b
    sed -i 's/^legacy *=.*$/legacy=default/' $LCFILE
77503b
    do_install
77503b
    /usr/bin/update-ca-trust
77503b
}
77503b
77503b
do_disable()
77503b
{
77503b
    sed -i 's/^legacy *=.*$/legacy=disable/' $LCFILE
77503b
    do_install
77503b
    /usr/bin/update-ca-trust
77503b
}
77503b
77503b
do_help()
77503b
{
77503b
    echo "usage: $0 [check | default | disable | install]"
77503b
}
77503b
77503b
if [[ $# -eq 0 ]]; then
77503b
  # no parameters
77503b
  do_help
77503b
  exit $?
77503b
fi
77503b
77503b
if [[ "$1" = "install" ]]; then
77503b
  do_install
77503b
  exit $?
77503b
fi
77503b
77503b
if [[ "$1" = "default" ]]; then
77503b
  do_default
77503b
  exit $?
77503b
fi
77503b
if [[ "$1" = "disable" ]]; then
77503b
  do_disable
77503b
  exit $?
77503b
fi
77503b
77503b
if [[ "$1" = "check" ]]; then
77503b
  do_check
77503b
  exit $?
77503b
fi
77503b
77503b
echo "$0: Unsupported command $1"
77503b
do_help