base-files: default_postinst() fix variable colision
The name variable contains at first the package name, and after the last group name. This patch fixes /etc/rc.d symlink creation (at least). Change name in pkgname, change the other name in ugname (user group name), and id in ugid (user group id) Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com> SVN-Revision: 44253
This commit is contained in:
parent
ee445d7cb2
commit
5cd8a482f3
1 changed files with 15 additions and 15 deletions
|
@ -171,51 +171,51 @@ default_prerm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
default_postinst() {
|
default_postinst() {
|
||||||
local name rusers
|
local pkgname rusers
|
||||||
name=$(echo $(basename $1) | cut -d. -f1)
|
pkgname=$(echo $(basename $1) | cut -d. -f1)
|
||||||
rusers=$(grep "Require-User:" ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.control)
|
rusers=$(grep "Require-User:" ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.control)
|
||||||
[ -n "$rusers" ] && {
|
[ -n "$rusers" ] && {
|
||||||
local user group uid gid
|
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
|
local ugname ugid
|
||||||
|
|
||||||
name=$(echo $b | cut -d= -f1)
|
ugname=$(echo $b | cut -d= -f1)
|
||||||
id=$(echo $b | cut -d= -f2)
|
ugid=$(echo $b | cut -d= -f2)
|
||||||
|
|
||||||
[ -z "$user" ] && {
|
[ -z "$user" ] && {
|
||||||
user=$name
|
user=$ugname
|
||||||
uid=$id
|
uid=$ugid
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
gid=$id
|
gid=$ugid
|
||||||
[ -n "$gid" ] && {
|
[ -n "$gid" ] && {
|
||||||
group_exists $name || group_add $name $gid
|
group_exists $ugname || group_add $ugname $gid
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -z "$gid" ] && {
|
[ -z "$gid" ] && {
|
||||||
group_add_next $name
|
group_add_next $ugname
|
||||||
gid=$?
|
gid=$?
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -z "$group" ] && {
|
[ -z "$group" ] && {
|
||||||
user_exists $user || user_add $user "$uid" $gid
|
user_exists $user || user_add $user "$uid" $gid
|
||||||
group=$name
|
group=$ugname
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
group_add_user $name $user
|
group_add_user $ugname $user
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -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/${pkgname}.postinst-pkg ] && ( . ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.postinst-pkg )
|
||||||
[ -n "${IPKG_INSTROOT}" ] || rm -f /tmp/luci-indexcache 2>/dev/null
|
[ -n "${IPKG_INSTROOT}" ] || rm -f /tmp/luci-indexcache 2>/dev/null
|
||||||
|
|
||||||
[ "$PKG_UPGRADE" = "1" ] || for i in `cat ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.list | grep "^/etc/init.d/"`; do
|
[ "$PKG_UPGRADE" = "1" ] || for i in `cat ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.list | grep "^/etc/init.d/"`; do
|
||||||
[ -n "${IPKG_INSTROOT}" ] && $(which bash) ${IPKG_INSTROOT}/etc/rc.common ${IPKG_INSTROOT}$i enable; \
|
[ -n "${IPKG_INSTROOT}" ] && $(which bash) ${IPKG_INSTROOT}/etc/rc.common ${IPKG_INSTROOT}$i enable; \
|
||||||
[ -n "${IPKG_INSTROOT}" ] || {
|
[ -n "${IPKG_INSTROOT}" ] || {
|
||||||
$i enable
|
$i enable
|
||||||
|
|
Loading…
Reference in a new issue