aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2018-09-17 11:06:33 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2019-04-23 13:44:38 +0200
commitd373285bbf1fa2c954e968abd2b6e2362684d334 (patch)
treef245b42e8156b9fc65df39f5713251bdf4b27e0e
parent83ac3d4fd8039d114336e67e8a65a2b701814485 (diff)
wgtpkg-install: Force uninstalleel
This commit forces uninstall of the previous installed version instead of reinstall to get around a bug in cynara. Bug-AGL: SPEC-1230 Cherry-picked from master for EEL version of AGL for bug SPEC-2286. Bug-AGL: SPEC-2286 Change-Id: I679b7b51ac978364c660d3275b2b132e99601e3a Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/wgtpkg-install.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c
index 2b57a4e..896392a 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;