diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2017-06-15 18:07:32 +0800 |
---|---|---|
committer | Yousong Zhou <yszhou4tech@gmail.com> | 2017-06-18 10:39:35 +0800 |
commit | f334a0cdb8498dfd2bbb780245e4e0ed0d103ece (patch) | |
tree | 2e563f1bebf93593ecc3f9e045ca6f219457b573 /package/base-files/files/lib/functions.sh | |
parent | 3ccca56eb0a44bb72561c6381faf63564eeec858 (diff) | |
download | upstream-f334a0cdb8498dfd2bbb780245e4e0ed0d103ece.tar.gz upstream-f334a0cdb8498dfd2bbb780245e4e0ed0d103ece.tar.bz2 upstream-f334a0cdb8498dfd2bbb780245e4e0ed0d103ece.zip |
base-files: allocate uid/gid starting from 65536
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>
Diffstat (limited to 'package/base-files/files/lib/functions.sh')
-rwxr-xr-x | package/base-files/files/lib/functions.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index 2b6415a200..81ef84b8ef 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -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 } |