base-files: fix default pre-/postrm for packages with a dot

Instead of stripping everything after the first dot, strip everything
after the last dot.
This fixes pre-/postrm actions for packages with a dot in their name,
like libusb-1.0.

Fixes #19668.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>

SVN-Revision: 45702
This commit is contained in:
Jonas Gorski 2015-05-19 09:13:17 +00:00
parent 241dbffcf9
commit d0af85c9a5

View file

@ -165,7 +165,7 @@ insert_modules() {
default_prerm() { default_prerm() {
local name local name
name=$(echo $(basename $1) | cut -d. -f1) name=$(basename ${1%.*})
[ -f /usr/lib/opkg/info/${name}.prerm-pkg ] && . /usr/lib/opkg/info/${name}.prerm-pkg [ -f /usr/lib/opkg/info/${name}.prerm-pkg ] && . /usr/lib/opkg/info/${name}.prerm-pkg
for i in `cat /usr/lib/opkg/info/${name}.list | grep "^/etc/init.d/"`; do for i in `cat /usr/lib/opkg/info/${name}.list | grep "^/etc/init.d/"`; do
$i disable $i disable
@ -175,7 +175,7 @@ default_prerm() {
default_postinst() { default_postinst() {
local pkgname rusers local pkgname rusers
pkgname=$(echo $(basename $1) | cut -d. -f1) pkgname=$(basename ${1%.*})
rusers=$(grep "Require-User:" ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.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