mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add initial pre-deinstall and post-install scripts for base pkg
This commit is contained in:
parent
cfa4c5224b
commit
34c3ffa7ed
21
tools/templates/core_pkg/base/metadir/+DEINSTALL
Normal file
21
tools/templates/core_pkg/base/metadir/+DEINSTALL
Normal file
@ -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 $?
|
||||
29
tools/templates/core_pkg/base/metadir/+INSTALL
Normal file
29
tools/templates/core_pkg/base/metadir/+INSTALL
Normal file
@ -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 $?
|
||||
Loading…
Reference in New Issue
Block a user