Created
April 28, 2019 21:44
-
-
Save blacklion/4b6f275a7abf3f1efcc44ec0e032b844 to your computer and use it in GitHub Desktop.
my NanoBSD router config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
NANO_NAME=gateway-j3160 | |
NANO_SRC=/data/src | |
NANO_OBJ=/usr/obj/nanobsd/gateway.v3 | |
NANO_ROOT_DIR=/usr/home/lev/nanobsd | |
NANO_CONFROOT=${NANO_ROOT_DIR}/gateway.v3 | |
NANO_TOOLS=${NANO_ROOT_DIR}/scripts | |
NANO_PACKAGE_DIR=${NANO_CONFROOT}/Pkg | |
NANO_FILESDIR=${NANO_CONFROOT}/Files | |
NANO_KERNEL=${NANO_CONFROOT}/J3160 | |
NANO_DISKIMGDIR=/data/nanobsd | |
NANO_IMGNAME="${NANO_NAME}" | |
# Parallel make | |
NANO_PMAKE="make -j4" | |
# Images | |
NANO_INIT_IMG2=0 | |
# Code size 512MB | |
NANO_CODESIZE=1060232 | |
# 8MB | |
NANO_CONFSIZE=16384 | |
# Data slice for named & dhcpd - 6.2Gb to minimize code section | |
#NANO_DATASIZE=14065664 | |
#NANO_DATASIZE=5677056 | |
#NANO_DATASIZE=27934098 | |
#NANO_DATADIR=${NANO_CONFROOT}/Data | |
NANO_DATASIZE=0 | |
NANO_RAM_ETCSIZE=20480 | |
NANO_RAM_TMPVARSIZE=524288 | |
# glabel support | |
NANO_LABEL=gw | |
# Buildworld | |
CONF_BUILD='' | |
# Modules | |
NANO_MODULES= | |
# Packages to remove after full installation | |
#PACKAGES_TO_REMOVE="python2 python27 libffi indexinfo" | |
PACKAGES_TO_REMOVE= | |
# Special instruction to "install" | |
# Installworld | |
CONF_INSTALL=' | |
WITHOUT_INSTALLLIB=yes | |
WITHOUT_MAKE=yes | |
WITHOUT_TOOLCHAIN=yes | |
WITHOUT_INCLUDES=yes | |
' | |
CONF_WORLD=' | |
BOOT_COMCONSOLE_SPEED=115200 | |
BOOT_BOOT0_COMCONSOLE_SPEED=0 | |
BOOT_BOOT0_RESET_TERM=yes | |
MODULES_OVERRIDE= | |
WITHOUT_CROSS_COMPILER=yes | |
WITHOUT_BINUTILS_BOOTSTRAP=yes | |
WITHOUT_BINUTILS=yes | |
WITHOUT_CLANG_BOOTSTRAP=yes | |
WITHOUT_CLANG=yes | |
WITHOUT_CLANG_EXTRAS=yes | |
WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=yes | |
WITHOUT_ELFTOOLCHAIN=yes | |
WITHOUT_ELFTOOLCHAIN_TOOLS=yes | |
WITHOUT_GCC_BOOTSTRAP=yes | |
WITHOUT_GCC=yes | |
WITHOUT_LLD_BOOTSTRAP=yes | |
WITHOUT_LLD=yes | |
XCC=/usr/bin/cc | |
XCXX=/usr/bin/c++ | |
XCPP=/usr/bin/cpp | |
XAS=/usr/bin/as | |
XAR=/usr/bin/ar | |
XLD=/usr/bin/ld | |
XNM=/usr/bin/nm | |
XOBJDUMP=/usr/bin/objdump | |
XRANLIB=/usr/bin/ranlib | |
XSTRINGS=/usr/bin/strings | |
XSTRIPBIN=/usr/bin/strip | |
COMPILER_TYPE=clang | |
WITH_FAST_DEPEND=yes | |
MALLOC_PRODUCTION=yes | |
WITH_BSD_GREP=yes | |
WITHOUT_ACCT=yes | |
WITHOUT_ACPI=yes | |
WITHOUT_AMD=yes | |
WITHOUT_APM=yes | |
WITHOUT_ATM=yes | |
WITHOUT_AUDIT=yes | |
WITHOUT_AUTHPF=yes | |
WITHOUT_AUTOFS=yes | |
WITHOUT_BHYVE=yes | |
WITHOUT_BLACKLIST=yes | |
WITHOUT_BLACKLIST_SUPPORT=yes | |
WITHOUT_BIND_DNSSEC=yes | |
WITHOUT_BOOTPARAMD=yes | |
WITHOUT_BOOTPD=yes | |
WITHOUT_BSD_CPIO=yes | |
WITHOUT_BSDINSTALL=yes | |
WITHOUT_BZIP2=yes | |
WITHOUT_BZIP2_SUPPORT=yes | |
WITHOUT_CALENDAR=yes | |
WITHOUT_CAPSICUM=yes | |
WITHOUT_CASPER=yes | |
WITHOUT_CCD=yes | |
WITHOUT_CDDL=yes | |
WITHOUT_CTM=yes | |
WITHOUT_CUSE=yes | |
WITHOUT_CXGBETOOL=yes | |
WITHOUT_DEBUG_FILES=yes | |
WITHOUT_DICT=yes | |
WITHOUT_EXAMPLES=yes | |
WITHOUT_FDT=yes | |
WITHOUT_FILE=yes | |
WITHOUT_FINGER=yes | |
WITHOUT_FLOPPY=yes | |
WITHOUT_FREEBSD_UPDATE=yes | |
WITHOUT_GAMES=yes | |
WITHOUT_GCOV=yes | |
WITHOUT_GNUCXX=yes | |
WITHOUT_GNU_GREP=yes | |
WITHOUT_GNU_GREP_COMPAT=yes | |
WITHOUT_GDB=yes | |
WITHOUT_GPIO=yes | |
WITHOUT_GPL_DTC=yes | |
WITHOUT_GROFF=yes | |
WITHOUT_GSSAPI=yes | |
WITHOUT_HAST=yes | |
WITHOUT_HTML=yes | |
WITHOUT_HYPERV=yes | |
WITHOUT_INETD=yes | |
WITHOUT_INFO=yes | |
WITHOUT_IPFILTER=yes | |
WITHOUT_ISCSI=yes | |
WITHOUT_JAIL=yes | |
WITHOUT_KERBEROS=yes | |
WITHOUT_KERBEROS_SUPPORT=yes | |
WITHOUT_KERNEL_SYMBOLS=yes | |
WITHOUT_LEGACY_CONSOLE=yes | |
WITHOUT_LIB32=yes | |
WITHOUT_LLDB=yes | |
WITHOUT_LOCALES=yes | |
WITHOUT_LOCATE=yes | |
WITHOUT_LPR=yes | |
WITHOUT_MAN=yes | |
WITHOUT_MANDOCDB=yes | |
WITHOUT_MAN_UTILS=yes | |
WITHOUT_NDIS=yes | |
WITHOUT_NIS=yes | |
WITHOUT_NLS=yes | |
WITHOUT_NLS_CATALOGS=yes | |
WITHOUT_NS_CACHING=yes | |
WITHOUT_PC_SYSINSTALL=yes | |
WITHOUT_PF=yes | |
WITHOUT_PORTSNAP=yes | |
WITHOUT_PPP=yes | |
WITHOUT_PROFILE=yes | |
WITHOUT_QUOTAS=yes | |
WITHOUT_RADIUS_SUPPORT=yes | |
WITHOUT_RCMDS=yes | |
WITHOUT_RESCUE=yes | |
WITHOUT_RBOOTD=yes | |
WITHOUT_ROUTED=yes | |
WITHOUT_SENDMAIL=yes | |
WITHOUT_SHAREDOCS=yes | |
WITHOUT_SVNLITE=yes | |
WITHOUT_SYSCONS=yes | |
WITHOUT_TALK=yes | |
WITHOUT_TCP_WRAPPERS=yes | |
WITHOUT_TELNET=yes | |
WITHOUT_TESTS=yes | |
WITHOUT_TESTS_SUPPORT=yes | |
WITHOUT_TFTP=yes | |
WITHOUT_TIMED=yes | |
WITHOUT_UNBOUND=yes | |
WITHOUT_USB_GADGET_EXAMPLES=yes | |
WITHOUT_VI=yes | |
WITHOUT_VT=yes | |
WITHOUT_ZFS=yes | |
' | |
# | |
NANO_BOOT0CFG="-o packet -s 1 -m 3 -t 18" | |
NANO_BOOTLOADER="boot/boot0sio" | |
# BOOT | |
NANO_BOOT2CFG="-DhS115200" | |
# Media | |
NANO_HEADS=255 | |
NANO_SECTS=63 | |
NANO_MEDIASIZE=30031250 | |
# Additional FSes | |
NANO_ADD_FS="unifi home" | |
NANO_ADD_FS_unifi_DEV="/dev/ufs/unifi" | |
NANO_ADD_FS_unifi_MNT="/usr/local/share/java/unifi" | |
NANO_ADD_FS_unifi_TYP="ufs" | |
NANO_ADD_FS_unifi_OPT="rw,union" | |
NANO_ADD_FS_unifi_CHK="3" | |
NANO_ADD_FS_home_DEV="192.168.134.2:/home" | |
NANO_ADD_FS_home_MNT="/usr/home" | |
NANO_ADD_FS_home_TYP="nfs" | |
NANO_ADD_FS_home_OPT="nfsv4,rw,late,soft,intr,bg,wsize=65536,rsize=65536,tcp" | |
# Totally new | |
cust_remove_samples() ( | |
pprint 2 "remove samples from /usr/local/etc" | |
( | |
cd ${NANO_WORLDDIR} | |
find usr/local/etc -name '*sample' -delete | |
find usr/local/etc -name '*dist' -delete | |
find usr/local/etc -name '*example' -delete | |
rm usr/local/etc/nsd/nsd.conf | |
) | |
) | |
cust_remove_pkgdb() ( | |
pprint 2 "remove package database to save space" | |
( | |
cd ${NANO_WORLDDIR} | |
rm -rf var/db/pkg/* | |
) | |
) | |
cust_remove_sys_leftovers() ( | |
pprint 2 "remove system's files which is not needed" | |
( | |
cd ${NANO_WORLDDIR} | |
rm -rf usr/include/* | |
rm -rf usr/lib/debug | |
find usr/lib/ -name \*.a -delete | |
) | |
) | |
cust_remove_unneeded_packages() ( | |
if [ -z "${PACKAGES_TO_REMOVE}" ] ; then return 0 ; fi | |
pprint 2 "remove packages which is not needed" | |
chroot ${NANO_WORLDDIR} sh -c "pkg delete -f -y ${PACKAGES_TO_REMOVE}" | |
) | |
cust_remove_packages_leftovers() ( | |
pprint 2 "remove packages' files which is not needed" | |
( | |
cd ${NANO_WORLDDIR} | |
find usr/local/lib/ -name \*.a -delete | |
rm -rf usr/local/man/* | |
rm -rf usr/local/include/* | |
rm -rf usr/local/lib/python2.7 | |
rm -rf usr/local/share/doc | |
rm -rf usr/local/share/examples | |
rm -rf usr/local/share/python2.7 | |
rm -rf usr/local/share/licenses | |
rm -rf usr/local/share/aclocal | |
rm -rf usr/local/share/zsh | |
rm -rf usr/local/bin/mongo | |
rm -rf usr/local/bin/mongoperf | |
rm -rf usr/local/bin/mongos | |
) | |
) | |
cust_additionalfs () ( | |
pprint 2 "configure nanobsd /etc/fstab: add additional FSes" | |
( | |
cd ${NANO_WORLDDIR} | |
for fs in ${NANO_ADD_FS} ; do | |
eval dev=\$NANO_ADD_FS_${fs}_DEV | |
eval mnt=\$NANO_ADD_FS_${fs}_MNT | |
eval typ=\$NANO_ADD_FS_${fs}_TYP | |
eval opt=\$NANO_ADD_FS_${fs}_OPT | |
eval frq=\$NANO_ADD_FS_${fs}_FRQ | |
eval chk=\$NANO_ADD_FS_${fs}_CHK | |
if [ -z "${dev}" ] ; then | |
echo "Device for additional fs '${fs}' unknown" 1>&2 | |
exit 1 | |
fi | |
if [ -z "${mnt}" ] ; then | |
echo "Mountpoint for additional fs '${fs}' unknown" 1>&2 | |
exit 1 | |
fi | |
typ=${typ:=ufs} | |
opt=${opt:=ro} | |
frq=${frq:=0} | |
chk=${chk:=0} | |
if [ ! -d ./${mnt} ] ; then | |
mkdir -p ./${mnt} ; touch ./${mnt}/.keepthis | |
fi | |
printf "%s\t%s\t%s\t%s\t%s\t%s\n" $dev $mnt $typ $opt $frq $chk >> etc/fstab | |
done | |
) | |
) | |
cust_etcdb () ( | |
pprint 2 "Call pwd_mkdb & cap_mkdb" | |
( | |
cd ${NANO_WORLDDIR} | |
pwd_mkdb -p -d etc etc/master.passwd | |
cap_mkdb etc/login.conf | |
) | |
) | |
####################################################################### | |
# Install the stuff under ./Files | |
cust_install_files_my () ( | |
cd ${NANO_FILESDIR} | |
find . -print | grep -Ev '/(CVS|\.svn|.mtree)' | cpio -dumpv ${NANO_WORLDDIR} | |
find . -type f -name .mtree -print | while read fn ; do | |
dir=`dirname ${fn}` | |
mtree -Ueq -f ${fn} -p ${NANO_WORLDDIR}/${dir} | |
done | |
) | |
customize_cmd cust_comconsole | |
customize_cmd cust_pkgng | |
customize_cmd cust_remove_unneeded_packages | |
customize_cmd cust_remove_samples | |
customize_cmd cust_remove_pkgdb | |
customize_cmd cust_remove_sys_leftovers | |
customize_cmd cust_remove_packages_leftovers | |
customize_cmd cust_install_files_my | |
customize_cmd cust_additionalfs | |
customize_cmd cust_etcdb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment