@@ -226,7 +226,12 @@ func (u *Upgrader) ensureRestarted(service ...string) error {
226
226
227
227
// UninstallBinary from a single flist.
228
228
func (u * Upgrader ) UninstallBinary (flist FListInfo ) error {
229
- return u .uninstall (flist )
229
+ // we never delete those files from the system
230
+ // since there is no `package manager` for zos (yet)
231
+ // deleting the files from the flist blindly can cause
232
+ // issues if some deleted files were shared between
233
+ // multiple packages.
234
+ return u .uninstall (flist , false )
230
235
}
231
236
232
237
// upgradeSelf will try to check if the flist has
@@ -284,7 +289,9 @@ func (u *Upgrader) upgradeSelf(store meta.Walker) error {
284
289
return ErrRestartNeeded
285
290
}
286
291
287
- func (u * Upgrader ) uninstall (flist FListInfo ) error {
292
+ // uninstall a package, if del is true, also delete the files in that package
293
+ // from the system filesystem
294
+ func (u * Upgrader ) uninstall (flist FListInfo , del bool ) error {
288
295
files , err := flist .Files ()
289
296
if err != nil {
290
297
return errors .Wrapf (err , "failed to get list of current installed files for '%s'" , flist .Absolute ())
@@ -326,6 +333,10 @@ func (u *Upgrader) uninstall(flist FListInfo) error {
326
333
}
327
334
}
328
335
336
+ if ! del {
337
+ return nil
338
+ }
339
+
329
340
// now delete ALL files, ignore what doesn't delete
330
341
for _ , file := range files {
331
342
stat , err := os .Stat (file .Path )
@@ -367,7 +378,7 @@ func (u *Upgrader) applyUpgrade(from, to FullFListInfo) error {
367
378
return err
368
379
}
369
380
370
- if err := u .uninstall (from .FListInfo ); err != nil {
381
+ if err := u .uninstall (from .FListInfo , true ); err != nil {
371
382
log .Error ().Err (err ).Msg ("failed to uninstall current flist. Upgraded anyway" )
372
383
}
373
384
0 commit comments