An abstracted down version of the NanoBSD config files as used by
FreeNAS and the BSDRP folks.
This commit is contained in:
parent
d608bbf41b
commit
c9cab7f5e5
14
tools/tools/nanobsd/dhcpd/README
Normal file
14
tools/tools/nanobsd/dhcpd/README
Normal file
@ -0,0 +1,14 @@
|
||||
$FreeBSD$
|
||||
|
||||
Example for creating many different builds (including different
|
||||
arch) from a common set of files, as well as building natively
|
||||
using qemu user space emulation.
|
||||
|
||||
This creates a simple appliance that uses dnsmasq to serve DNS
|
||||
and DHCPd.
|
||||
|
||||
This is a work in progress. Generally, to build this you should
|
||||
cd tools/tools/nanobsd/dhcpd
|
||||
sudo sh ../nandobsd.sh -C os-base
|
||||
but do be careful if things are interrupted. There may still be
|
||||
bugs lurking that cause your entire FreeBSD tree to disappear.
|
275
tools/tools/nanobsd/dhcpd/common
Normal file
275
tools/tools/nanobsd/dhcpd/common
Normal file
@ -0,0 +1,275 @@
|
||||
# $FreeBSD$
|
||||
|
||||
#-
|
||||
# Copyright (c) 2014 Warner Losh. All Rights Reserved.
|
||||
# Copyright (c) 2010 iXsystems, Inc., All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
#
|
||||
# This file is heavily derived from both Sam Leffler's Avilia config,
|
||||
# as well as the BSDRP project's config file. Neither of these have
|
||||
# an explicit copyright/license statement, but are implicitly BSDL. This
|
||||
# example has been taken from the FreeNAS project (an early version) and
|
||||
# simplified to meet the needs of the example.
|
||||
#
|
||||
|
||||
NANO_PMAKE="make" # NB: disable -j 3
|
||||
|
||||
NANO_CFG_BASE=$(pwd)
|
||||
NANO_CFG_BASE=${NANO_CFG_BASE%/dhcpd}
|
||||
NANO_SRC=$(pwd)
|
||||
NANO_SRC=${NANO_SRC%/tools/tools/nanobsd/dhcpd}
|
||||
NANO_OBJ=${NANO_SRC}/../dhcpd/obj
|
||||
# Where cust_pkg() finds packages to install
|
||||
#XXX: Is this the right place?
|
||||
NANO_PORTS=${NANO_SRC}/../ports
|
||||
NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/Pkg
|
||||
NANO_DATADIR=${NANO_OBJ}/_.data
|
||||
NANO_DATASIZE=40960
|
||||
NANO_INIT_IMG2=0
|
||||
unset MAKEOBJDIRPREFIX
|
||||
|
||||
# this to go into nanobsd.sh
|
||||
NANO_PORTS=${NANO_PORTS:-/usr/ports}
|
||||
|
||||
customize_cmd cust_allow_ssh_root
|
||||
|
||||
add_etc_make_conf()
|
||||
{
|
||||
touch ${NANO_WORLDDIR}/etc/make.conf
|
||||
}
|
||||
customize_cmd add_etc_make_conf
|
||||
|
||||
clean_usr_local()
|
||||
{
|
||||
LOCAL_DIR=${NANO_WORLDDIR}/usr/local
|
||||
pprint 2 "Clean and create world directory (${LOCAL_DIR})"
|
||||
if rm -rf ${LOCAL_DIR}/ > /dev/null 2>&1 ; then
|
||||
true
|
||||
else
|
||||
chflags -R noschg ${LOCAL_DIR}/
|
||||
rm -rf ${LOCAL_DIR}/
|
||||
fi
|
||||
for f in bin etc lib libdata libexec sbin share; do
|
||||
mkdir -p ${LOCAL_DIR}/$f
|
||||
done
|
||||
}
|
||||
customize_cmd clean_usr_local
|
||||
|
||||
cust_install_machine_files()
|
||||
{
|
||||
echo "cd ${NANO_CFG_BASE}/Files"
|
||||
cd ${NANO_CFG_BASE}/Files
|
||||
find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${NANO_WORLDDIR}
|
||||
}
|
||||
customize_cmd cust_install_files
|
||||
customize_cmd cust_install_machine_files
|
||||
|
||||
buildenv()
|
||||
{
|
||||
cd ${NANO_SRC}
|
||||
env __MAKE_CONF=${NANO_MAKE_CONF_BUILD} DESTDIR=${NANO_WORLDDIR} make buildenv
|
||||
}
|
||||
|
||||
NANO_MAKEFS="makefs -B big \
|
||||
-o bsize=4096,fsize=512,density=8192,optimization=space"
|
||||
export NANO_MAKEFS
|
||||
|
||||
# NB: leave c++ enabled so devd can be built
|
||||
CONF_BUILD="
|
||||
WITHOUT_ACPI=true
|
||||
WITHOUT_ATM=true
|
||||
WITHOUT_AUDIT=true
|
||||
WITHOUT_BIND_DNSSEC=true
|
||||
WITHOUT_BIND_ETC=true
|
||||
WITHOUT_BIND_LIBS_LWRES=true
|
||||
WITHOUT_BLUETOOTH=true
|
||||
WITHOUT_CALENDAR=true
|
||||
WITHOUT_CVS=true
|
||||
WITHOUT_DICT=true
|
||||
WITHOUT_EXAMPLES=true
|
||||
WITHOUT_FORTRAN=true
|
||||
WITHOUT_GAMES=true
|
||||
WITHOUT_GCOV=true
|
||||
WITHOUT_GPIB=true
|
||||
WITHOUT_HTML=true
|
||||
WITHOUT_I4B=true
|
||||
WITHOUT_IPFILTER=true
|
||||
WITHOUT_IPX=true
|
||||
WITHOUT_LIBKSE=true
|
||||
WITHOUT_LOCALES=true
|
||||
WITHOUT_LPR=true
|
||||
WITHOUT_MAN=true
|
||||
WITHOUT_NETCAT=true
|
||||
WITHOUT_NIS=true
|
||||
WITHOUT_NLS=true
|
||||
WITHOUT_NS_CACHING=true
|
||||
WITHOUT_OBJC=true
|
||||
WITHOUT_PROFILE=true
|
||||
WITHOUT_RCMDS=true
|
||||
WITHOUT_SENDMAIL=true
|
||||
WITHOUT_SHAREDOCS=true
|
||||
WITHOUT_SYSCONS=true
|
||||
WITHOUT_LIB32=true
|
||||
"
|
||||
CONF_INSTALL="$CONF_BUILD
|
||||
INSTALL_NODEBUG=t
|
||||
NOPORTDOCS=t
|
||||
NO_INSTALL_MANPAGES=t
|
||||
"
|
||||
# The following would help...
|
||||
# WITHOUT_TOOLCHAIN=true can't build ports
|
||||
# WITHOUT_INSTALLLIB=true libgcc.a
|
||||
#
|
||||
# from the build
|
||||
# WITHOUT_INFO=true makeinfo
|
||||
# WITHOUT_RCS=true
|
||||
PKG_ONLY_MAKE_CONF="
|
||||
WITHOUT_TOOLCHAIN=true
|
||||
WITHOUT_INSTALLLIB=true
|
||||
WITHOUT_INFO=true
|
||||
WITHOUT_RCS=true
|
||||
"
|
||||
|
||||
NANO_PACKAGE_ONLY=1
|
||||
|
||||
CR()
|
||||
{
|
||||
chroot ${NANO_WORLDDIR} /bin/sh -exc "$*"
|
||||
}
|
||||
|
||||
# install a package from a pre-built binary
|
||||
do_add_pkg ()
|
||||
{
|
||||
# Need to create ${NANO_OBJ}/ports in this add_pkg_${port} function
|
||||
set -x
|
||||
mkdir -p ${NANO_OBJ}/ports/distfiles
|
||||
mkdir -p ${NANO_OBJ}/ports/packages
|
||||
mkdir -p ${NANO_WORLDDIR}/usr/ports/packages
|
||||
mkdir -p ${NANO_WORLDDIR}/usr/ports/distfiles
|
||||
mount -t nullfs -o noatime ${NANO_OBJ}/ports/packages \
|
||||
${NANO_WORLDDIR}/usr/ports/packages
|
||||
mount -t nullfs -o noatime ${NANO_OBJ}/ports/distfiles \
|
||||
${NANO_WORLDDIR}/usr/ports/distfiles
|
||||
CR "cd /usr/ports/packages/All;pkg_add -F $1.tbz"
|
||||
umount ${NANO_WORLDDIR}/usr/ports/distfiles
|
||||
umount ${NANO_WORLDDIR}/usr/ports/packages
|
||||
rmdir ${NANO_WORLDDIR}/usr/ports/packages
|
||||
rmdir ${NANO_WORLDDIR}/usr/ports/distfiles
|
||||
rmdir ${NANO_WORLDDIR}/usr/ports
|
||||
set +x
|
||||
}
|
||||
|
||||
# Build a port (with the side effect of creating a package)
|
||||
do_add_port ()
|
||||
{
|
||||
local port_path
|
||||
port_path=$1
|
||||
shift
|
||||
set -x
|
||||
# Need to create ${NANO_OBJ}/ports in this add_port_${port} function
|
||||
mkdir -p ${NANO_OBJ}/ports/distfiles
|
||||
mkdir -p ${NANO_OBJ}/ports/packages
|
||||
mkdir -p ${NANO_PORTS}/packages
|
||||
mkdir -p ${NANO_PORTS}/distfiles
|
||||
mkdir -p ${NANO_WORLDDIR}/usr/src
|
||||
mkdir -p ${NANO_WORLDDIR}/usr/ports
|
||||
mount -t nullfs -o noatime ${NANO_SRC} ${NANO_WORLDDIR}/usr/src
|
||||
mount -t nullfs -o noatime ${NANO_PORTS} ${NANO_WORLDDIR}/usr/ports
|
||||
mount -t nullfs -o noatime ${NANO_OBJ}/ports/packages \
|
||||
${NANO_WORLDDIR}/usr/ports/packages
|
||||
mount -t nullfs -o noatime ${NANO_OBJ}/ports/distfiles \
|
||||
${NANO_WORLDDIR}/usr/ports/distfiles
|
||||
mkdir -p ${NANO_WORLDDIR}/dev
|
||||
mount -t devfs devfs ${NANO_WORLDDIR}/dev
|
||||
mkdir -p ${NANO_WORLDDIR}/usr/workdir
|
||||
cp /etc/resolv.conf ${NANO_WORLDDIR}/etc/resolv.conf
|
||||
# Improvement: Don't know why package-recursive don't works here
|
||||
CR "env UNAME_p=${NANO_ARCH} TARGET=${NANO_ARCH} \
|
||||
TARGET_ARCH=${NANO_ARCH} make \
|
||||
__MAKE_CONF=${NANO_MAKE_CONF_BUILD} \
|
||||
WRKDIRPREFIX=/usr/workdir -C /usr/ports/$port_path \
|
||||
package BATCH=yes $* clean FORCE_PKG_REGISTER=t"
|
||||
rm ${NANO_WORLDDIR}/etc/resolv.conf
|
||||
rm -rf ${NANO_WORLDDIR}/usr/obj
|
||||
rm -rf ${NANO_WORLDDIR}/usr/workdir
|
||||
umount ${NANO_WORLDDIR}/dev
|
||||
umount ${NANO_WORLDDIR}/usr/ports/packages
|
||||
umount ${NANO_WORLDDIR}/usr/ports/distfiles
|
||||
umount ${NANO_WORLDDIR}/usr/ports
|
||||
umount ${NANO_WORLDDIR}/usr/src
|
||||
set +x
|
||||
}
|
||||
|
||||
# Need to check if this function works with cross-compiling architecture!!!!
|
||||
# Recursive complex fonction: Generate one function for each ports
|
||||
add_port () {
|
||||
local port_path=$1
|
||||
local port=`echo $1 | sed -e 's/\//_/'`
|
||||
export PORTSDIR=${NANO_PORTS}
|
||||
shift
|
||||
# Check if package allready exist
|
||||
# Need to:
|
||||
# 1. check ARCH of this package!
|
||||
# 2. Add a trap
|
||||
cd ${NANO_PORTS}/${port_path}
|
||||
PKG_NAME=`make ${PKGNAME_HACK} PORTSDIR=${NANO_PORTS} __MAKE_CONF=${NANO_MAKE_CONF_BUILD} package-name`
|
||||
if [ -f ${NANO_OBJ}/ports/packages/All/${PKG_NAME}.tbz ]; then
|
||||
# Pkg file found: Generate add_pkg_NAME function
|
||||
eval "
|
||||
add_pkg_${port} () {
|
||||
do_add_pkg ${PKG_NAME}
|
||||
}
|
||||
customize_cmd add_pkg_${port}
|
||||
"
|
||||
else
|
||||
# No pkg file: Generate add_port_NAME function
|
||||
eval "
|
||||
add_port_${port} () {
|
||||
do_add_port ${port_path} $*
|
||||
}
|
||||
customize_cmd add_port_${port}
|
||||
"
|
||||
NANO_PACKAGE_ONLY=0
|
||||
fi
|
||||
}
|
||||
|
||||
die()
|
||||
{
|
||||
echo "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
create_amd64_diskimage()
|
||||
{
|
||||
create_i386_diskimage "$*"
|
||||
}
|
||||
|
||||
rp=$(realpath ${NANO_OBJ}/)
|
||||
__a=`mount | grep ${rp} | awk '{print length($3), $3;}' | sort -rn | awk '{$1=""; print;}'`
|
||||
if [ -n "$__a" ]; then
|
||||
echo "unmounting $__a"
|
||||
umount $__a
|
||||
fi
|
||||
|
||||
NANO_BOOTLOADER="boot/boot0"
|
244
tools/tools/nanobsd/dhcpd/os-base
Normal file
244
tools/tools/nanobsd/dhcpd/os-base
Normal file
@ -0,0 +1,244 @@
|
||||
# $FreeBSD$
|
||||
|
||||
#-
|
||||
# Copyright (c) 2014 Warner Losh. All Rights Reserved.
|
||||
# Copyright (c) 2010-2011 iXsystems, Inc., All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL iXsystems, Inc. OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# This file is heavily derived from both Sam Leffler's Avilia config,
|
||||
# as well as the BSDRP project's config file. Neither of these have
|
||||
# an explicit copyright/license statement, but are implicitly BSDL. This
|
||||
# example has been taken from the FreeNAS project and simplified to meet
|
||||
# the needs of the example.
|
||||
#
|
||||
|
||||
# Pull in common definitions.
|
||||
. common
|
||||
|
||||
NANO_BOOT0CFG="-o packet -s 1 -m 3 -t 18"
|
||||
|
||||
# /var -> ~10MB (look through rc.initdiskless for the formula of how this
|
||||
# number is calculated out). Since we hope to run
|
||||
NANO_RAM_TMPVARSIZE=10240
|
||||
|
||||
NANO_IMAGES=2
|
||||
FlashDevice generic 2g
|
||||
|
||||
if [ "$DEBUG" = 1 ]; then
|
||||
DEBUG_BUILD="
|
||||
DEBUG_FLAGS= -g
|
||||
"
|
||||
else
|
||||
DEBUG_INSTALL="
|
||||
INSTALL_NODEBUG= t
|
||||
"
|
||||
fi
|
||||
|
||||
CONF_INSTALL="$CONF_BUILD
|
||||
${DEBUG_BUILD}
|
||||
"
|
||||
CONF_INSTALL="$CONF_INSTALL
|
||||
${DEBUG_INSTALL}
|
||||
"
|
||||
|
||||
add_port security/sudo
|
||||
add_port ftp/curl
|
||||
|
||||
if [ "${NANO_PACKAGE_ONLY}" -eq 1 ]; then
|
||||
CONF_INSTALL="${CONF_INSTALL}
|
||||
${PKG_ONLY_MAKE_CONF}
|
||||
"
|
||||
echo "Automatically building a thin image with packages"
|
||||
else
|
||||
echo "Automatically building a * * F A T * * image so we can build ports"
|
||||
fi
|
||||
|
||||
VARS="MASTER_SITE_BACKUP MASTER_SITE_OVERRIDE PACKAGEROOT PACKAGESITE"
|
||||
|
||||
for var in $VARS; do
|
||||
val=$(eval echo "\$$var")
|
||||
if [ -n "$val" ]; then
|
||||
CONF_INSTALL="${CONF_INSTALL}
|
||||
$var=$val"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$PACKAGE_PREP_BUILD" = 1 ]; then
|
||||
echo "Skipping post-package customize steps"
|
||||
do_image=false
|
||||
else
|
||||
|
||||
hack_nsswitch_conf ( )
|
||||
{
|
||||
# Remove all references to NIS in the nsswitch.conf file
|
||||
# Not sure this is still needed, but FreeNAS has it...
|
||||
sed -i.bak -es/nis/files/g ${NANO_WORLDDIR}/etc/nsswitch.conf
|
||||
rm -f ${NANO_WORLDDIR}/etc/nsswitch.conf.bak
|
||||
}
|
||||
customize_cmd hack_nsswitch_conf
|
||||
|
||||
save_build ( )
|
||||
{
|
||||
VERSION_FILE=${NANO_WORLDDIR}/etc/version
|
||||
if [ "${SVNREVISION}" = "${REVISION}" ]; then
|
||||
echo "${NANO_NAME}" > "${VERSION_FILE}"
|
||||
else
|
||||
echo "${NANO_NAME} (${SVNREVISION})" > "${VERSION_FILE}"
|
||||
fi
|
||||
}
|
||||
customize_cmd save_build
|
||||
|
||||
# Move the $world/data to the /data partion
|
||||
move_data()
|
||||
{
|
||||
db=${NANO_WORLDDIR}/data
|
||||
rm -rf ${NANO_DATADIR}
|
||||
mkdir -p ${NANO_DATADIR}
|
||||
( cd ${db} ; find . | cpio -R root:wheel -dumpv ${NANO_DATADIR} )
|
||||
rm -rf ${db}
|
||||
}
|
||||
customize_cmd move_data
|
||||
|
||||
add_data_to_fstab ( )
|
||||
{
|
||||
(
|
||||
cd ${NANO_WORLDDIR}
|
||||
echo "/dev/${NANO_DRIVE}s4 /data ufs rw,noatime 2 2" >> etc/fstab
|
||||
mkdir -p data
|
||||
)
|
||||
|
||||
}
|
||||
customize_cmd add_data_to_fstab
|
||||
|
||||
remove_patch_divots ( )
|
||||
{
|
||||
find ${NANO_WORLDDIR} -name \*.orig -or -name \*.rej -delete
|
||||
}
|
||||
customize_cmd remove_patch_divots
|
||||
|
||||
configure_mnt_md ( )
|
||||
{
|
||||
mkdir -m 755 -p ${NANO_WORLDDIR}/conf/base/mnt
|
||||
echo 2048 > ${NANO_WORLDDIR}/conf/base/mnt/md_size
|
||||
}
|
||||
customize_cmd configure_mnt_md
|
||||
|
||||
shrink_md_fbsize()
|
||||
{
|
||||
# We have a lot of little files on our memory disks. Let's decrease
|
||||
# the block and frag size to fit more little files on them (this
|
||||
# halves our space requirement by ~50% on /etc and /var on 8.x --
|
||||
# and gives us more back on 9.x as the default block and frag size
|
||||
# are 4 times larger).
|
||||
sed -i '' -e 's,-S -i 4096,-S -i 4096 -b 4096 -f 512,' \
|
||||
${NANO_WORLDDIR}/etc/rc.initdiskless
|
||||
}
|
||||
customize_cmd shrink_md_fbsize
|
||||
|
||||
if [ "${DEBUG}" = 1 ]; then
|
||||
|
||||
unmute_console_logging()
|
||||
{
|
||||
# /var is small. Don't fill it up with messages from console.log
|
||||
# because it's a chatty log.
|
||||
sed -i '' -e 's/#console.info/console.info/' \
|
||||
"${NANO_WORLDDIR}/etc/syslog.conf"
|
||||
}
|
||||
customize_cmd unmute_console_logging
|
||||
|
||||
fi
|
||||
|
||||
freenas_custom()
|
||||
{
|
||||
gzip -v9 ${NANO_WORLDDIR}/boot/kernel/kernel
|
||||
|
||||
# kill includes (saves 14MB)
|
||||
find ${NANO_WORLDDIR}/usr/local/include \! -name 'pyconfig.h' -type f | xargs rm -f
|
||||
|
||||
# kill docs (saves 22MB)
|
||||
rm -rf ${NANO_WORLDDIR}/usr/local/share/doc
|
||||
rm -rf ${NANO_WORLDDIR}/usr/local/share/gtk-doc
|
||||
|
||||
# and info (2MB)
|
||||
rm -rf ${NANO_WORLDDIR}/usr/local/info
|
||||
|
||||
# and man pages (4.4MB)
|
||||
rm -rf ${NANO_WORLDDIR}/usr/local/man
|
||||
|
||||
# and examples (1.7M)
|
||||
rm -rf ${NANO_WORLDDIR}/usr/local/share/examples
|
||||
|
||||
# and groff_fonts junk (3MB)
|
||||
rm -rf ${NANO_WORLDDIR}/usr/share/groff_font
|
||||
rm -rf ${NANO_WORLDDIR}/usr/share/tmac
|
||||
rm -rf ${NANO_WORLDDIR}/usr/share/me
|
||||
|
||||
# Kill all .a's and .la's that are installed (20MB+)
|
||||
find ${NANO_WORLDDIR} -name \*.a -or -name \*.la -delete
|
||||
|
||||
# magic.mgc is just a speed optimization. Kill it for 1.7MB
|
||||
rm -f ${NANO_WORLDDIR}/usr/share/misc/magic.mgc
|
||||
|
||||
# strip binaries (saves spaces on non-debug images).
|
||||
if [ "${DEBUG}" != 1 ]; then
|
||||
pprint 4 "Stripping binaries and libraries"
|
||||
for dir in $(find ${NANO_WORLDDIR}/usr/local -name '*bin' -or -name 'libexec' -maxdepth 3); do
|
||||
for f in $(find $dir -type f); do
|
||||
if ! dontstrip "$f"
|
||||
then
|
||||
strip 2>/dev/null $f || :
|
||||
fi
|
||||
done
|
||||
done
|
||||
# .so's are the only thing that need to be stripped. The rest
|
||||
# should remain untouched.
|
||||
for f in $(find ${NANO_WORLDDIR}/usr/local/lib -name '*.so' -or -name '*.so.*' -maxdepth 3); do
|
||||
strip 2>/dev/null $f || :
|
||||
done
|
||||
fi
|
||||
|
||||
# Last second tweaks
|
||||
chown -R root:wheel ${NANO_WORLDDIR}/root
|
||||
chmod 0755 ${NANO_WORLDDIR}/root/*
|
||||
chmod 0755 ${NANO_WORLDDIR}/*
|
||||
chmod 0440 ${NANO_WORLDDIR}/usr/local/etc/sudoers
|
||||
chown -R root:wheel ${NANO_WORLDDIR}/etc
|
||||
chown -R root:wheel ${NANO_WORLDDIR}/boot
|
||||
chown root:wheel ${NANO_WORLDDIR}/
|
||||
chown root:wheel ${NANO_WORLDDIR}/usr
|
||||
find ${NANO_WORLDDIR} -type f -name "*~" -delete
|
||||
find ${NANO_WORLDDIR}/usr/local -type f -name "*.po" -delete
|
||||
find ${NANO_WORLDDIR} -type f -name "*.service" -delete
|
||||
mkdir ${NANO_WORLDDIR}/data/zfs
|
||||
ln -s -f /usr/local/bin/bash ${NANO_WORLDDIR}/bin/bash
|
||||
ln -s -f /data/zfs/zpool.cache ${NANO_WORLDDIR}/boot/zfs/zpool.cache
|
||||
|
||||
# This is wrong. Needs a way to tell kernel how to find the mount utility
|
||||
# instead.
|
||||
mv ${NANO_WORLDDIR}/sbin/mount_ntfs ${NANO_WORLDDIR}/sbin/mount_ntfs-kern
|
||||
ln -s -f /usr/local/bin/ntfs-3g ${NANO_WORLDDIR}/sbin/mount_ntfs
|
||||
|
||||
}
|
||||
late_customize_cmd freenas_custom
|
||||
|
||||
fi # [ $PACKAGE_PREP_BUILD = 1 ]
|
Loading…
Reference in New Issue
Block a user