system/pcsc-lite: Fix user/group detection.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2023-08-01 15:27:46 -04:00 committed by Willy Sudiarto Raharjo
parent f4d5e0c6d6
commit 035396b379
No known key found for this signature in database
GPG key ID: 3F617144D7238786

View file

@ -23,11 +23,15 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 20230801 bkw: Modified by SlackBuilds.org, BUILD=2:
# - handle user and group detection better.
# - get rid of generic GNU INSTALL from doc dir.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=pcsc-lite
VERSION=${VERSION:-1.9.9}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -39,9 +43,6 @@ if [ -z "$ARCH" ]; then
esac
fi
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
@ -54,12 +55,12 @@ OUTPUT=${OUTPUT:-/tmp}
# Bail out if user or group isn't valid on your system
# For slackbuilds.org, assigned pcscd uid/gid are 257/257
# See http://slackbuilds.org/uid_gid.txt
if ! grep ^pcscd: /etc/group 2>&1 > /dev/null; then
echo " You must have a \"pcscd\" group to run this script."
# 20230801 bkw: grepping /etc/passwd and /etc/group may fail if e.g. NIS
# or LDAP is in use; always use getent. Also, print both messages (for user
# and group) if either doesn't exist.
if ! getent group pcscd &>/dev/null || ! getent passwd pcscd &>/dev/null; then
echo " You must have a \"pcscd\" user and group to run this script."
echo " # groupadd -g 257 pcscd"
exit 1
elif ! grep ^pcscd: /etc/passwd 2>&1 > /dev/null; then
echo " You must have a \"pcscd\" user to run this script."
echo " # useradd -u 257 -g pcscd -d /var/run/pcscd -s /bin/false pcscd"
exit 1
fi
@ -70,7 +71,7 @@ DEBUGATR=${DEBUGATR:-0}
AUTOPOFF=${AUTOPOFF:-0} # disabled by default
# README and README.DAEMON are not useful and partly outdated.
DOCFILES="SECURITY ChangeLog* COPYING HELP NEWS TODO AUTHORS INSTALL"
DOCFILES="SECURITY ChangeLog* COPYING HELP NEWS TODO AUTHORS"
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
@ -97,9 +98,9 @@ cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
-o -perm 511 \) -exec chmod 755 {} + -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} +
# ATR (answer to reset) debug parsing output
case "$DEBUGATR" in