mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
Merge from bittboy/buildroot@db180c0
This commit is contained in:
10
package/getent/Config.in
Normal file
10
package/getent/Config.in
Normal file
@@ -0,0 +1,10 @@
|
||||
config BR2_PACKAGE_GETENT
|
||||
bool "getent"
|
||||
help
|
||||
This package installs the 'getent' utility, which allows to
|
||||
get entries from Name Service Switch libraries. For glibc
|
||||
toolchains, it's the real getent program from the C library
|
||||
that gets installed, which is NSS-capable. For uclibc and
|
||||
musl toolchains, it's a simple wrapper script that emulates
|
||||
getent's behavior, since there is no NSS support in uclibc
|
||||
and musl.
|
||||
45
package/getent/getent
Normal file
45
package/getent/getent
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
# $Header: /var/cvs/uClibc/extra/scripts/getent,v 1.2 2005/02/02 14:18:01 solar Exp $
|
||||
#
|
||||
# Closely (not perfectly) emulate the behavior of glibc's getent utility
|
||||
#
|
||||
#passwd|shadow|group|aliases|hosts|networks|ethers|netgroup|protocols|services|rpc
|
||||
# only returns the first match (by design)
|
||||
# dns based search is not supported (hosts,networks)
|
||||
# case-insensitive matches not supported (ethers; others?)
|
||||
# may return false-positives (hosts,protocols,rpc,services,ethers)
|
||||
#
|
||||
# Taken from uClibc 0.9.33.
|
||||
|
||||
export PATH="${PATH}:/bin:/usr/bin"
|
||||
|
||||
file="/etc/$1"
|
||||
case $1 in
|
||||
passwd|group)
|
||||
match="^$2:\|^[^:]*:[^:]*:$2:" ;;
|
||||
shadow)
|
||||
match="^$2:" ;;
|
||||
networks|netgroup)
|
||||
match="^[[:space:]]*$2\>" ;;
|
||||
hosts|protocols|rpc|services|ethers)
|
||||
match="\<$2\>" ;;
|
||||
aliases)
|
||||
match="^[[:space:]]*$2[[:space:]]*:" ;;
|
||||
""|-h|--help)
|
||||
echo "USAGE: $0 database [key]"
|
||||
exit 0 ;;
|
||||
*)
|
||||
echo "$0: Unknown database: $1" 1>&2
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
||||
if [ ! -f "$file" ] ; then
|
||||
echo "$0: Could not find database file for $1" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -eq 1 ] ; then
|
||||
exec cat "$file"
|
||||
else
|
||||
sed "s/#.*//; /$match/q; d" "$file" | grep . || exit 2
|
||||
fi
|
||||
26
package/getent/getent.mk
Normal file
26
package/getent/getent.mk
Normal file
@@ -0,0 +1,26 @@
|
||||
################################################################################
|
||||
#
|
||||
# getent
|
||||
#
|
||||
################################################################################
|
||||
|
||||
GETENT_LICENSE = LGPL-2.1+
|
||||
|
||||
# For glibc toolchains, we use the getent program built/installed by
|
||||
# the C library. For other toolchains, we use the wrapper script
|
||||
# included in this package.
|
||||
ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
|
||||
# Sourcery toolchains install it in sysroot/usr/lib/bin
|
||||
# Buildroot toolchains install it in sysroot/usr/bin
|
||||
GETENT_LOCATION = $(firstword $(wildcard \
|
||||
$(STAGING_DIR)/usr/bin/getent \
|
||||
$(STAGING_DIR)/usr/lib/bin/getent))
|
||||
else
|
||||
GETENT_LOCATION = package/getent/getent
|
||||
endif
|
||||
|
||||
define GETENT_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -D -m 0755 $(GETENT_LOCATION) $(TARGET_DIR)/usr/bin/getent
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user