@@ -21,23 +21,30 @@ do_configure()
2121 fi
2222 # add android groups
2323 if [ -n " ${PRIVILEGED_USERS} " ]; then
24- local aid uid
24+ local aid usr
2525 for aid in $( cat " ${COMPONENT_DIR} /android_groups" )
2626 do
2727 local xname=$( echo ${aid} | awk -F: ' {print $1}' )
2828 local xid=$( echo ${aid} | awk -F: ' {print $2}' )
29- sed -i " s|^${xname} :.*|${xname} :x:${xid} :${USER_NAME} |" " ${CHROOT_DIR} /etc/group"
29+ sed -i " s|^${xname} :.*|${xname} :x:${xid} :|" " ${CHROOT_DIR} /etc/group"
3030 if ! $( grep -q " ^${xname} :" " ${CHROOT_DIR} /etc/group" ) ; then
31- echo " ${xname} :x:${xid} :${USER_NAME} " >> " ${CHROOT_DIR} /etc/group"
31+ echo " ${xname} :x:${xid} :" >> " ${CHROOT_DIR} /etc/group"
3232 fi
3333 if ! $( grep -q " ^${xname} :" " ${CHROOT_DIR} /etc/passwd" ) ; then
3434 echo " ${xname} :x:${xid} :${xid} ::/:/bin/false" >> " ${CHROOT_DIR} /etc/passwd"
3535 fi
36- # add users to aid_inet group
37- for uid in ${PRIVILEGED_USERS}
36+ # add users to Android group
37+ for usr in ${PRIVILEGED_USERS}
3838 do
39- if ! $( grep -q " ^${xname} :.*${uid} " " ${CHROOT_DIR} /etc/group" ) ; then
40- sed -i " s|^\(${xname} :.*\)|\1,${uid} |" " ${CHROOT_DIR} /etc/group"
39+ local uid=${usr%%:* }
40+ local gid=${usr##*: }
41+ if [ " ${uid} " = " ${gid} " ]; then
42+ gid=" ${xname} "
43+ elif [ " ${gid} " != " ${xname} " ]; then
44+ continue
45+ fi
46+ if ! $( grep -q " ^${gid} :.*${uid} " " ${CHROOT_DIR} /etc/group" ) ; then
47+ sed -i " s|^\(${gid} :.*\)|\1,${uid} |" " ${CHROOT_DIR} /etc/group"
4148 fi
4249 done
4350 done
@@ -49,7 +56,8 @@ do_help()
4956{
5057cat << EOF
5158 --privileged-users="${PRIVILEGED_USERS} "
52- A list of users separated by a space to be added to Android groups.
59+ A list of users separated by a space to be added to Android groups. Use
60+ a format UID:GID.
5361
5462EOF
5563}
0 commit comments