Handle more general formats (#527051)

This commit is contained in:
Elio Maldonado 2009-10-06 00:09:59 +00:00
parent a7f6c1391e
commit 362e48244d

View File

@ -22,13 +22,6 @@ if test $# -eq 0; then
usage 1 1>&2 usage 1 1>&2
fi fi
on="1"
case "$1" in
on | ON ) on="1";;
off | OFF ) on="";;
* ) usage 1 1>&2;;
esac
# the system-wide configuration file # the system-wide configuration file
p11conf="/etc/pki/nssdb/pkcs11.txt" p11conf="/etc/pki/nssdb/pkcs11.txt"
# must exist, otherwise report it and exit with failure # must exist, otherwise report it and exit with failure
@ -37,19 +30,28 @@ if [ ! -f $p11conf ]; then
exit 1 exit 1
fi fi
# turn on or off on="1"
if [ on = "1" ]; then case "$1" in
cat ${p11conf} | sed -e 's/^library=$/library=libnsssysinit.so/' \ on | ON )
-e 'g/^NSS/ s; Flags=internal,critical; Flags=internal,moduleDBOnly,critical;' > \ cat ${p11conf} | \
sed -e 's/^library=$/library=libnsssysinit.so/' \
-e '/^NSS/s/Flags=internal,critical/Flags=internal,moduleDBOnly,critical/' \
-e '/^NSS/s/Flags=internal,FIPS,critical/Flags=internal,moduleDBOnly,FIPS,critical/' > \
${p11conf}.on ${p11conf}.on
mv ${p11conf}.on ${p11conf} mv ${p11conf}.on ${p11conf}
else ;;
if [ `grep "^library=libnsssysinit" ${p11conf}` == ""]; then off | OFF )
if [ ! `grep "^library=libnsssysinit" ${p11conf}` ]; then
exit 0 exit 0
fi fi
cat ${p11conf} | sed -e 's/^library=libnsssysinit.so/library=/' \ cat ${p11conf} | \
-e 'g/^NSS/ s; Flags=internal,moduleDBOnly,critical; Flags=internal,critical;' > \ sed -e 's/^library=libnsssysinit.so/library=/' \
-e '/^NSS/s/Flags=internal,moduleDBOnly,critical/Flags=internal,critical/' \
-e '/^NSS/s/Flags=internal,moduleDBOnly,FIPS,critical/Flags=internal,FIPS,critical/' > \
${p11conf}.off ${p11conf}.off
mv ${p11conf}.off ${p11conf} mv ${p11conf}.off ${p11conf}
fi ;;
* )
usage 1 1>&2
;;
esac