Blame SOURCES/ca-legacy

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