]> code.ossystems Code Review - openembedded-core.git/commitdiff
mime.bbclass: fix post install scriptlet error
authorChangqing Li <changqing.li@windriver.com>
Fri, 19 Jun 2020 09:11:12 +0000 (17:11 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 23 Jun 2020 09:57:20 +0000 (10:57 +0100)
fix error during post uninstall:
%postun(shared-mime-info-data-2.0-r0.4.corei7_64): execv(/bin/sh) pid 78
+ '[' 0 = 0 ']'
+ set -e
+ '[' x '!=' x ']'
+ echo 'Updating MIME database... this may take a while.'
Updating MIME database... this may take a while.
+ update-mime-database /usr/share/mime
Directory '/usr/share/mime/packages' does not exist!
%postun(shared-mime-info-data-2.0-r0.4.corei7_64): waitpid(78) rc 78 status 100
warning: %postun(shared-mime-info-data-2.0-r0.4.corei7_64) scriptlet failed, exit status 1

when run post uninstall scriptlet, /usr/share/mime/packages has been
removed during unintall, while update-mime-database will check xml under
/usr/share/mime/packages.

workaround by create this dir before update, then remove it

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/mime.bbclass

index c9072adf3b32d35206ca1a13c108e7a5d23eaf5d..bb99bc35cb62b8cb195fee001a43f5396b8a35f4 100644 (file)
@@ -24,7 +24,18 @@ if [ "x$D" != "x" ]; then
                mimedir=${MIMEDIR}
 else
        echo "Updating MIME database... this may take a while."
-       update-mime-database $D${MIMEDIR}
+       # $D${MIMEDIR}/packages belong to package shared-mime-info-data,
+       # packages like libfm-mime depend on shared-mime-info-data.
+       # after shared-mime-info-data uninstalled, $D${MIMEDIR}/packages
+       # is removed, but update-mime-database need this dir to update
+       # database, workaround to create one and remove it later
+       if [ ! -d $D${MIMEDIR}/packages ]; then
+               mkdir -p $D${MIMEDIR}/packages
+               update-mime-database $D${MIMEDIR}
+               rmdir --ignore-fail-on-non-empty $D${MIMEDIR}/packages
+       else
+               update-mime-database $D${MIMEDIR}
+fi
 fi
 }