From 1f5207bcd71ecf02e03420bd6eb5c0f23666693c Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 18 Sep 2015 14:04:54 -0300 Subject: Introduce base-nanobsd package --- tools/builder_common.sh | 8 +++- .../templates/core_pkg/base-nanobsd/exclude_files | 26 ++++++++++ .../core_pkg/base-nanobsd/metadir/+DEINSTALL | 21 ++++++++ .../templates/core_pkg/base-nanobsd/metadir/+DESC | 3 ++ .../core_pkg/base-nanobsd/metadir/+INSTALL | 56 ++++++++++++++++++++++ .../core_pkg/base-nanobsd/metadir/+MANIFEST | 15 ++++++ tools/templates/core_pkg/base-nanobsd/pkg-plist | 2 + 7 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 tools/templates/core_pkg/base-nanobsd/exclude_files create mode 100644 tools/templates/core_pkg/base-nanobsd/metadir/+DEINSTALL create mode 100644 tools/templates/core_pkg/base-nanobsd/metadir/+DESC create mode 100644 tools/templates/core_pkg/base-nanobsd/metadir/+INSTALL create mode 100644 tools/templates/core_pkg/base-nanobsd/metadir/+MANIFEST create mode 100644 tools/templates/core_pkg/base-nanobsd/pkg-plist (limited to 'tools') diff --git a/tools/builder_common.sh b/tools/builder_common.sh index aca97c3..e8b1230 100644 --- a/tools/builder_common.sh +++ b/tools/builder_common.sh @@ -1066,6 +1066,7 @@ clone_to_staging_area() { . core_pkg_create base "" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR} + core_pkg_create base-nanobsd "" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR} core_pkg_create default-config "" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR} local DEFAULTCONF=${STAGE_CHROOT_DIR}/conf.default/config.xml @@ -1123,7 +1124,12 @@ customize_stagearea_for_image() { # Prepare final stage area create_final_staging_area - pkg_chroot_add ${FINAL_CHROOT_DIR} base + if [ "${1}" = "nanobsd" -o \ + "${1}" = "nanobsd-vga" ]; then + pkg_chroot_add ${FINAL_CHROOT_DIR} base-nanobsd + else + pkg_chroot_add ${FINAL_CHROOT_DIR} base + fi if [ "${1}" = "iso" -o \ "${1}" = "memstick" -o \ diff --git a/tools/templates/core_pkg/base-nanobsd/exclude_files b/tools/templates/core_pkg/base-nanobsd/exclude_files new file mode 100644 index 0000000..d21c093 --- /dev/null +++ b/tools/templates/core_pkg/base-nanobsd/exclude_files @@ -0,0 +1,26 @@ +./boot.config +./boot/loader.conf +./boot/loader.conf.local +./boot/modules/bwi_v3_ucode.ko +./cf/conf/config.xml +./cf/conf/enableserial_force +./cf/conf/trigger_initial_wizard +./conf.default/config.xml +./etc/bogons +./etc/bogonsv6 +./etc/fstab +./etc/group +./etc/master.passwd +./etc/master.passwd.db +./etc/passwd +./etc/platform +./etc/pwd.db +./etc/rc.conf +./etc/spwd.db +./media +./mnt +./proc +./sys +./tmp +./usr/local/share/%%PRODUCT_NAME%%/base.mtree +./usr/local/share/%%PRODUCT_NAME%%/base.txz diff --git a/tools/templates/core_pkg/base-nanobsd/metadir/+DEINSTALL b/tools/templates/core_pkg/base-nanobsd/metadir/+DEINSTALL new file mode 100644 index 0000000..715125f --- /dev/null +++ b/tools/templates/core_pkg/base-nanobsd/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-nanobsd/metadir/+DESC b/tools/templates/core_pkg/base-nanobsd/metadir/+DESC new file mode 100644 index 0000000..34b9159 --- /dev/null +++ b/tools/templates/core_pkg/base-nanobsd/metadir/+DESC @@ -0,0 +1,3 @@ +%%PRODUCT_NAME%% core files + +WWW: %%PRODUCT_URL%% diff --git a/tools/templates/core_pkg/base-nanobsd/metadir/+INSTALL b/tools/templates/core_pkg/base-nanobsd/metadir/+INSTALL new file mode 100644 index 0000000..82aeafc --- /dev/null +++ b/tools/templates/core_pkg/base-nanobsd/metadir/+INSTALL @@ -0,0 +1,56 @@ +#!/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 + +echo "===> Removing static obsoleted files" + +# Set IFS to \n to deal with filenames containing spaces +oIFS=${IFS} +IFS=" +" + +PLATFORM=$(cat /etc/platform) + +# Process obsolete files +if [ "${PLATFORM}" != "nanobsd" -a -f /etc/%%PRODUCT_NAME%%.obsoletedfiles ]; then + for f in $(cat /etc/%%PRODUCT_NAME%%.obsoletedfiles); do + if [ -n "${f}" -a -d "${f}" ]; then + chflags -R noschg "${f}" + rm -rf "${f}" + elif [ -n "${f}" -a -f "${f}" ]; then + chflags noschg "${f}" + rm -f "${f}" + elif [ -n "${f}" -a -L "${f}" ]; then + rm -f "${f}" + fi + done +fi + +# Restore IFS +IFS=${oIFS} + +exit 0 diff --git a/tools/templates/core_pkg/base-nanobsd/metadir/+MANIFEST b/tools/templates/core_pkg/base-nanobsd/metadir/+MANIFEST new file mode 100644 index 0000000..f163b92 --- /dev/null +++ b/tools/templates/core_pkg/base-nanobsd/metadir/+MANIFEST @@ -0,0 +1,15 @@ +name: "%%PRODUCT_NAME%%-base-nanobsd" +version: "%%VERSION%%" +origin: "security/%%PRODUCT_NAME%%-base-nanobsd" +comment: <