On Thu, Jun 18, 2020 at 3:16 AM Changqing Li <changqing...@windriver.com> wrote:
>
> From: Changqing Li <changqing...@windriver.com>
>
> 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...@windriver.com>
> ---
>  meta/classes/mime.bbclass | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/mime.bbclass b/meta/classes/mime.bbclass
> index c9072adf3b..728fba1d94 100644
> --- a/meta/classes/mime.bbclass
> +++ b/meta/classes/mime.bbclass
> @@ -24,7 +24,13 @@ if [ "x$D" != "x" ]; then
>                 mimedir=${MIMEDIR}
>  else
>         echo "Updating MIME database... this may take a while."
> -       update-mime-database $D${MIMEDIR}
> +       if [ ! -d $D${MIMEDIR}/packages ]; then
> +               mkdir $D${MIMEDIR}/packages
^ Add '-p' otherwise an error is created for path already existing
> +               update-mime-database $D${MIMEDIR}
> +               rmdir $D${MIMEDIR}/packages
^ Similar: add '--ignore-fail-on-non-empty' otherwise all 'non-last'
is going to create an error
> +       else
> +               update-mime-database $D${MIMEDIR}
> +       fi
>  fi
>  }
>
And maybe a short comment would be helpful to understand why the
mkdir/rmdir-dance is done (otherwise somebody else could be tempted to
remove it later :)

Andreas
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#139626): 
https://lists.openembedded.org/g/openembedded-core/message/139626
Mute This Topic: https://lists.openembedded.org/mt/74950565/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to