Prevent overwriting /var/run and lock symlinks with PM

/var/run and /var/lock are created as symlinks in creatingdirs. But
if a package install something into those dirs (with DESTDIR install),
they get overwritten with true directories if using a package
manager. Note that without PM, anything installed into those dirs
is lost at next reboot. So remove those dirs before packaging.
This commit is contained in:
Pierre Labastie 2020-07-09 17:02:10 +00:00
parent ee842e234b
commit 46c6113b28

View file

@ -311,6 +311,12 @@ rm -fv $PKG_DEST/sbin/nologin
done done
[ -d $PKG_DEST/lib64 ] && [ -z "$(ls $PKG_DEST/lib64)" ] && [ -d $PKG_DEST/lib64 ] && [ -z "$(ls $PKG_DEST/lib64)" ] &&
rmdir -v $PKG_DEST/lib64 rmdir -v $PKG_DEST/lib64
<!-- prevent overwriting symlinks: if a package install something in
these directories, it'll be lost if not using package management,
since they are symlinks to tmpfs. So, remove it too if using PM. -->
rm -rf $PKG_DEST/var/{run,lock}
<!-- Remove /var if it is empty, then -->
[ -d $PKG_DEST/var ] &amp;&amp; [ -z "$(ls $PKG_DEST/var)" ] &amp;&amp; rmdir -v $PKG_DEST/var
PREV_SEC=${SECONDS} PREV_SEC=${SECONDS}
packInstall packInstall
SECONDS=${PREV_SEC} SECONDS=${PREV_SEC}