summaryrefslogtreecommitdiffstats
path: root/tools/templates/core_pkg/base/metadir/+DEINSTALL
diff options
context:
space:
mode:
Diffstat (limited to 'tools/templates/core_pkg/base/metadir/+DEINSTALL')
-rw-r--r--tools/templates/core_pkg/base/metadir/+DEINSTALL21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/templates/core_pkg/base/metadir/+DEINSTALL b/tools/templates/core_pkg/base/metadir/+DEINSTALL
new file mode 100644
index 0000000..715125f
--- /dev/null
+++ b/tools/templates/core_pkg/base/metadir/+DEINSTALL
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+if [ "${2}" != "DEINSTALL" ]; then
+ exit 0
+fi
+
+echo "===> Keeping a copy of current version mtree"
+
+# Check if there is a current mtree to be saved
+if [ ! -f /usr/local/share/%%PRODUCT_NAME%%/base.mtree ]; then
+ echo "===> Current mtree file not found"
+ exit 1
+fi
+
+[ -f /usr/local/share/%%PRODUCT_NAME%%/base.mtree.previous ] \
+ && rm -f /usr/local/share/%%PRODUCT_NAME%%/base.mtree.previous
+
+cp -f /usr/local/share/%%PRODUCT_NAME%%/base.mtree \
+ /usr/local/share/%%PRODUCT_NAME%%/base.mtree.previous
+
+exit $?
OpenPOWER on IntegriCloud