Blame SOURCES/ca-legacy

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