base-files: allocate uid/gid starting from 65536
authorYousong Zhou <yszhou4tech@gmail.com>
Thu, 15 Jun 2017 10:07:32 +0000 (18:07 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Sun, 18 Jun 2017 02:39:35 +0000 (10:39 +0800)
There already exist static assignment of uid/gid 65533 in packages feed
and we have nobody/nogroup taking 65534 as their ids.  Let's change the
pid of dynamic assignment to start from 65536 so that the two assignment
scheme will not collide with each other

While at it, fix the scan command checking existence of uid/gid

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
package/base-files/Makefile
package/base-files/files/lib/functions.sh

index c669ff0ac67a462afdfa35c0e3c4a1ac7ade296b..54c157611f1cfb8f22f2eccca1ce0d30be2bc2f8 100644 (file)
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 include $(INCLUDE_DIR)/version.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=173
+PKG_RELEASE:=174
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
index 2b6415a20081b66712ad088b34ee816b5730a36a..81ef84b8ef8fc44ae8731b80766c222094408010 100755 (executable)
@@ -306,8 +306,8 @@ group_add_next() {
        gid=$(grep -s "^${1}:" ${IPKG_INSTROOT}/etc/group | cut -d: -f3)
        [ -n "$gid" ] && return $gid
        gids=$(cat ${IPKG_INSTROOT}/etc/group | cut -d: -f3)
-       gid=100
-       while [ -n "$(echo $gids | grep $gid)" ] ; do
+       gid=65536
+       while [ -n "$(echo "$gids" | grep "^$gid$")" ] ; do
                gid=$((gid + 1))
        done
        group_add $1 $gid
@@ -334,8 +334,8 @@ user_add() {
        local rc
        [ -z "$uid" ] && {
                uids=$(cat ${IPKG_INSTROOT}/etc/passwd | cut -d: -f3)
-               uid=100
-               while [ -n "$(echo $uids | grep $uid)" ] ; do
+               uid=65536
+               while [ -n "$(echo "$uids" | grep "^$uid$")" ] ; do
                        uid=$((uid + 1))
                done
        }