From: Jose Bollo Date: Mon, 17 Sep 2018 09:06:33 +0000 (+0200) Subject: wgtpkg-install: Force uninstall X-Git-Tag: 6.90.0~1 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-main.git;a=commitdiff_plain;h=2a0ac96c8e5b510c3767ff054156f17c67225a62 wgtpkg-install: Force uninstall This commit forces uninstall of the previous installed version instead of reinstall to get around a bug in cynara. Bug-AGL: SPEC-1230 Change-Id: Id29fc59794aed7386e0a32df43f9fbacc25c0863 Signed-off-by: Jose Bollo --- diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c index 27dcb87..5e8b0e9 100644 --- a/src/wgtpkg-install.c +++ b/src/wgtpkg-install.c @@ -40,6 +40,7 @@ #include "wgtpkg-permissions.h" #include "wgtpkg-digsig.h" #include "wgtpkg-install.h" +#include "wgtpkg-uninstall.h" #include "secmgr-wrap.h" #include "utils-dir.h" #include "wgtpkg-unit.h" @@ -532,6 +533,16 @@ struct wgt_info *install_widget(const char *wgtfile, const char *root, int force if (get_target_directory(installdir, root, desc)) goto error3; + if (access(installdir, F_OK) == 0) { + if (!force) { + ERROR("widget already installed"); + errno = EEXIST; + goto error3; + } + if (uninstall_widget(desc->idaver, root)) + goto error3; + } + if (move_widget_to(installdir, force)) goto error3;