Switch to using pkgng for all package management. Add necessary
bootstrap step for pkg. Fix a bunch of annoying little nits. We can now build fat or thin images successfully for the dhcpd config.
This commit is contained in:
parent
6d12b61a88
commit
af5905f482
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264860
@ -44,7 +44,8 @@ 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_PORTS=$(realpath ${NANO_SRC}/../ports)
|
||||
NANO_PORTS=/usr/ports
|
||||
NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/Pkg
|
||||
NANO_DATADIR=${NANO_OBJ}/_.data
|
||||
NANO_DATASIZE=40960
|
||||
@ -173,7 +174,7 @@ do_add_pkg ()
|
||||
${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"
|
||||
CR env ASSUME_ALWAYS_YES=YES SIGNATURE_TYPE=none /usr/sbin/pkg add /usr/ports/packages/All/$1.txz
|
||||
umount ${NANO_WORLDDIR}/usr/ports/distfiles
|
||||
umount ${NANO_WORLDDIR}/usr/ports/packages
|
||||
rmdir ${NANO_WORLDDIR}/usr/ports/packages
|
||||
@ -206,12 +207,16 @@ do_add_port ()
|
||||
mount -t devfs devfs ${NANO_WORLDDIR}/dev
|
||||
mkdir -p ${NANO_WORLDDIR}/usr/workdir
|
||||
cp /etc/resolv.conf ${NANO_WORLDDIR}/etc/resolv.conf
|
||||
# OK, a little inefficient, but likely not enough to worry about.
|
||||
CR ldconfig /lib /usr/lib /usr/local/lib
|
||||
CR ldconfig -R
|
||||
CR ldconfig -r
|
||||
# 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 \
|
||||
TARGET_ARCH=${NANO_ARCH} PORTSDIR=${NANO_PORTS} make \
|
||||
__MAKE_CONF=${NANO_MAKE_CONF_BUILD} \
|
||||
WRKDIRPREFIX=/usr/workdir -C /usr/ports/$port_path \
|
||||
package BATCH=yes $* clean FORCE_PKG_REGISTER=t"
|
||||
package-recursive 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
|
||||
@ -228,15 +233,14 @@ do_add_port ()
|
||||
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_NAME=`env PORTSDIR=${NANO_PORTS} make __MAKE_CONF=${NANO_MAKE_CONF_BUILD} package-name`
|
||||
if [ -f ${NANO_OBJ}/ports/packages/All/${PKG_NAME}.txz ]; then
|
||||
# Pkg file found: Generate add_pkg_NAME function
|
||||
eval "
|
||||
add_pkg_${port} () {
|
||||
@ -267,6 +271,10 @@ create_amd64_diskimage()
|
||||
create_i386_diskimage "$*"
|
||||
}
|
||||
|
||||
# Automatically include the packaging port here so it is always first so it
|
||||
# builds the port and adds the package so we can add other packages.
|
||||
add_port ports-mgmt/pkg
|
||||
|
||||
rp=$(realpath ${NANO_OBJ}/)
|
||||
__a=`mount | grep ${rp} | awk '{print length($3), $3;}' | sort -rn | awk '{$1=""; print;}'`
|
||||
if [ -n "$__a" ]; then
|
||||
|
@ -108,28 +108,6 @@ save_build ( )
|
||||
}
|
||||
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
|
||||
@ -168,7 +146,7 @@ customize_cmd unmute_console_logging
|
||||
|
||||
fi
|
||||
|
||||
freenas_custom()
|
||||
product_custom()
|
||||
{
|
||||
gzip -v9 ${NANO_WORLDDIR}/boot/kernel/kernel
|
||||
|
||||
@ -199,29 +177,10 @@ freenas_custom()
|
||||
# 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}/
|
||||
@ -229,16 +188,7 @@ freenas_custom()
|
||||
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
|
||||
late_customize_cmd product_custom
|
||||
|
||||
fi # [ $PACKAGE_PREP_BUILD = 1 ]
|
||||
|
Loading…
Reference in New Issue
Block a user