From 34c3ffa7ed71d76a0c47b2776e37c32ae989bcdb Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 4 Sep 2015 07:32:57 -0300 Subject: Add initial pre-deinstall and post-install scripts for base pkg --- tools/templates/core_pkg/base/metadir/+DEINSTALL | 21 +++++++++++++++++ tools/templates/core_pkg/base/metadir/+INSTALL | 29 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 tools/templates/core_pkg/base/metadir/+DEINSTALL create mode 100644 tools/templates/core_pkg/base/metadir/+INSTALL (limited to 'tools/templates') 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 $? diff --git a/tools/templates/core_pkg/base/metadir/+INSTALL b/tools/templates/core_pkg/base/metadir/+INSTALL new file mode 100644 index 0000000..895c39c --- /dev/null +++ b/tools/templates/core_pkg/base/metadir/+INSTALL @@ -0,0 +1,29 @@ +#!/bin/sh + +if [ "${2}" = "POST-INSTALL" ]; then + exit 0 +fi + +if [ ! -f /usr/local/share/%%PRODUCT_NAME%%/base.txz ]; then + echo "===> ERROR: base tarball not found!" + exit 1 +fi + +echo "===> Removing schg flag from base files" + +# Cleanup schg flags +chflags -R noschg \ + /bin \ + /sbin \ + /usr/bin \ + /usr/sbin \ + /libexec \ + /lib \ + /usr/lib >/dev/null 2>&1 + +echo "===> Extracting new base tarball" + +# Install new base files +tar -C / -xJPUf /usr/local/share/%%PRODUCT_NAME%%/base.txz + +exit $? -- cgit v1.1