Pkg test: refactor for readability

This commit is contained in:
Dmitry Maksyoma 2021-01-28 23:44:25 +13:00
parent ead31ae2e7
commit 9eb9664bcf

View File

@ -1,14 +1,13 @@
detect_libnss_wrapper() {
if $(which dpkg &>/dev/null); then
libnss_wrapper_file=$(dpkg -S libnss_wrapper.so | awk -F' ' '{ print $2 }')
LD_PRELOAD="$libnss_wrapper_file"
return
fi
if [ -r /usr/lib/libnss_wrapper.so ]; then
LD_PRELOAD=/usr/lib/libnss_wrapper.so
libnss_wrapper_file=/usr/lib/libnss_wrapper.so
elif [ -r /usr/lib64/libnss_wrapper.so ]; then
LD_PRELOAD=/usr/lib64/libnss_wrapper.so
libnss_wrapper_file=/usr/lib64/libnss_wrapper.so
else
echo "no libnss_wrapper.so installed!"
exit 1
@ -42,6 +41,6 @@ if [ x"$USER_ID" != x"0" ]; then
export NSS_WRAPPER_GROUP
detect_libnss_wrapper
echo "nss_wrapper location: $LD_PRELOAD"
export LD_PRELOAD
echo "nss_wrapper location: $libnss_wrapper_file"
export LD_PRELOAD="$libnss_wrapper_file"
fi