mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-12 09:54:53 +00:00
base-files: extend USERID:=syntax
it is now possible to inlie the uid and gid in the syntax USERID:=username=uid:group=gid:group2=gid2:... Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42838
This commit is contained in:
parent
90120bb771
commit
a3bf98495a
@ -176,24 +176,36 @@ default_postinst() {
|
|||||||
[ -f ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.postinst-pkg ] && ( . ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.postinst-pkg )
|
[ -f ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.postinst-pkg ] && ( . ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.postinst-pkg )
|
||||||
rusers=$(grep "Require-User:" ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.control)
|
rusers=$(grep "Require-User:" ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.control)
|
||||||
[ -n "$rusers" ] && {
|
[ -n "$rusers" ] && {
|
||||||
local user group
|
local user group uid gid
|
||||||
for a in $(echo $rusers | sed "s/Require-User://g"); do
|
for a in $(echo $rusers | sed "s/Require-User://g"); do
|
||||||
user=""
|
user=""
|
||||||
group=""
|
group=""
|
||||||
for b in $(echo $a | sed "s/:/ /g"); do
|
for b in $(echo $a | sed "s/:/ /g"); do
|
||||||
|
local name id
|
||||||
|
|
||||||
|
name=$(echo $b | cut -d= -f1)
|
||||||
|
id=$(echo $b | cut -d= -f2)
|
||||||
|
|
||||||
[ -z "$user" ] && {
|
[ -z "$user" ] && {
|
||||||
user=$b
|
user=$name
|
||||||
|
uid=$id
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
[ -z "$group" ] && {
|
|
||||||
group=$b
|
gid=$id
|
||||||
group_add_next $b
|
[ -n "$gid" ] && group_add $name $gid
|
||||||
|
[ -z "$gid" ] && {
|
||||||
|
group_add_next $name
|
||||||
gid=$?
|
gid=$?
|
||||||
user_exists $user || user_add $user "" $gid
|
}
|
||||||
|
|
||||||
|
[ -z "$group" ] && {
|
||||||
|
user_exists $user || user_add $user "$uid" $gid
|
||||||
|
group=$name
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
group_add_next $b
|
|
||||||
group_add_user $b $user
|
group_add_user $name $user
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user