Date: Thu, 18 Sep 2025 19:17:24 GMT From: Enji Cooper <ngie@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: c99bb5747f5e - main - nanobsd: minor formatting cleanup Message-ID: <202509181917.58IJHOn8088552@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=c99bb5747f5e88527e7414fd543c903f367001c4 commit c99bb5747f5e88527e7414fd543c903f367001c4 Author: Enji Cooper <ngie@FreeBSD.org> AuthorDate: 2025-09-17 18:06:43 +0000 Commit: Enji Cooper <ngie@FreeBSD.org> CommitDate: 2025-09-18 19:17:11 +0000 nanobsd: minor formatting cleanup - Reformat function definitions POSIX states that compound commands, i.e., ones that use `(..)` or `{ .. } `, are permissible as function definitions, however, many shell syntax validators do not acknowledge the former format. Switch to the latter format so more naive editors, like the vim syntax highlighter, better parse the syntax of the file. Moreover, replacing `(..)` with `{..}` replaces several subshells with their non-subshell equivalents. Given that `set -e` is used liberally and `exit` is not used in the calling code when `set -e` is not enforced, there is no net loss by making this change. - Clean trailing whitespace. - Reindent some related comments to match the indentation of the previous line. - Add shebangs to the tops of files to help syntax colorizers and file identifiers understand that the files are in shell syntax. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D52596 --- tools/tools/nanobsd/defaults.sh | 162 ++++++++++++++++++------------------ tools/tools/nanobsd/embedded/common | 56 ++++++------- tools/tools/nanobsd/legacy.sh | 12 +-- tools/tools/nanobsd/rescue/common | 32 +++---- 4 files changed, 130 insertions(+), 132 deletions(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index 4c4323c4bd87..4f0cc2fa99bd 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -209,30 +209,29 @@ SRC_ENV_CONF=/dev/null # ####################################################################### -# Export values into the shell. Must use { } instead of ( ) like -# other functions to avoid a subshell. +# Export values into the shell. # We set __MAKE_CONF as a global since it is easier to get quoting # right for paths with spaces in them. -make_export ( ) { +make_export() { # Similar to export_var, except puts the data out to stdout - var=$1 + local var=$1 eval val=\$$var echo "Setting variable: $var=\"$val\"" export $1 } -nano_make_build_env ( ) { +nano_make_build_env() { __MAKE_CONF="${NANO_MAKE_CONF_BUILD}" make_export __MAKE_CONF } -nano_make_install_env ( ) { +nano_make_install_env() { __MAKE_CONF="${NANO_MAKE_CONF_INSTALL}" make_export __MAKE_CONF } # Extra environment variables for kernel builds -nano_make_kernel_env ( ) { +nano_make_kernel_env() { if [ -f "${NANO_KERNEL}" ] ; then KERNCONFDIR="$(realpath $(dirname ${NANO_KERNEL}))" KERNCONF="$(basename ${NANO_KERNEL})" @@ -244,23 +243,23 @@ nano_make_kernel_env ( ) { fi } -nano_global_make_env ( ) ( +nano_global_make_env() { # global settings for the make.conf file, if set [ -z "${NANO_ARCH}" ] || echo TARGET_ARCH="${NANO_ARCH}" [ -z "${NANO_CPUTYPE}" ] || echo TARGET_CPUTYPE="${NANO_CPUTYPE}" -) +} # # Create empty files in the target tree, and record the fact. All paths # are relative to NANO_WORLDDIR. # -tgt_touch ( ) ( +tgt_touch() { cd "${NANO_WORLDDIR}" for i; do touch $i echo "./${i} type=file" >> ${NANO_METALOG} done -) +} # # Convert a directory into a symlink. Takes two arguments, the @@ -268,9 +267,9 @@ tgt_touch ( ) ( # directory is removed and a symlink is created. If we're doing # a nopriv build, then append this fact to the metalog # -tgt_dir2symlink ( ) ( - dir=$1 - symlink=$2 +tgt_dir2symlink() { + local dir=$1 + local symlink=$2 cd "${NANO_WORLDDIR}" rm -xrf "$dir" @@ -278,28 +277,28 @@ tgt_dir2symlink ( ) ( if [ -n "$NANO_METALOG" ]; then echo "./${dir} type=link mode=0777 link=${symlink}" >> ${NANO_METALOG} fi -) +} # run in the world chroot, errors fatal -CR ( ) { +CR() { chroot "${NANO_WORLDDIR}" /bin/sh -exc "$*" } # run in the world chroot, errors not fatal -CR0 ( ) { +CR0() { chroot "${NANO_WORLDDIR}" /bin/sh -c "$*" || true } -clean_build ( ) ( +clean_build() { pprint 2 "Clean and create object directory (${MAKEOBJDIRPREFIX})" if ! rm -xrf ${MAKEOBJDIRPREFIX}/ > /dev/null 2>&1 ; then chflags -R noschg ${MAKEOBJDIRPREFIX}/ rm -xr ${MAKEOBJDIRPREFIX}/ fi -) +} -make_conf_build ( ) ( +make_conf_build() { pprint 2 "Construct build make.conf ($NANO_MAKE_CONF_BUILD)" mkdir -p ${MAKEOBJDIRPREFIX} @@ -312,9 +311,9 @@ make_conf_build ( ) ( echo "${CONF_WORLD}" echo "${CONF_BUILD}" ) > ${NANO_MAKE_CONF_BUILD} -) +} -build_world ( ) ( +build_world() { pprint 2 "run buildworld" pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.bw" @@ -324,9 +323,9 @@ build_world ( ) ( cd "${NANO_SRC}" ${NANO_PMAKE} buildworld ) > ${MAKEOBJDIRPREFIX}/_.bw 2>&1 -) +} -build_kernel ( ) ( +build_kernel() { pprint 2 "build kernel ($NANO_KERNEL)" pprint 3 "log: ${MAKEOBJDIRPREFIX}/_.bk" @@ -342,9 +341,9 @@ build_kernel ( ) ( cd "${NANO_SRC}" ${NANO_PMAKE} buildkernel ) > ${MAKEOBJDIRPREFIX}/_.bk 2>&1 -) +} -clean_world ( ) ( +clean_world() { if [ "${NANO_OBJ}" != "${MAKEOBJDIRPREFIX}" ]; then pprint 2 "Clean and create object directory (${NANO_OBJ})" if ! rm -xrf ${NANO_OBJ}/ > /dev/null 2>&1 ; then @@ -361,9 +360,9 @@ clean_world ( ) ( fi mkdir -p "${NANO_WORLDDIR}" fi -) +} -make_conf_install ( ) ( +make_conf_install() { pprint 2 "Construct install make.conf ($NANO_MAKE_CONF_INSTALL)" # Make sure we get all the global settings that NanoBSD wants @@ -377,9 +376,9 @@ make_conf_install ( ) ( echo METALOG=${NANO_METALOG} fi ) > ${NANO_MAKE_CONF_INSTALL} -) +} -install_world ( ) ( +install_world() { pprint 2 "installworld" pprint 3 "log: ${NANO_LOG}/_.iw" @@ -390,9 +389,9 @@ install_world ( ) ( ${NANO_MAKE} installworld DESTDIR="${NANO_WORLDDIR}" DB_FROM_SRC=yes chflags -R noschg "${NANO_WORLDDIR}" ) > ${NANO_LOG}/_.iw 2>&1 -) +} -install_etc ( ) ( +install_etc() { pprint 2 "install /etc" pprint 3 "log: ${NANO_LOG}/_.etc" @@ -405,9 +404,9 @@ install_etc ( ) ( # so they can spam it. cp /dev/null "${NANO_WORLDDIR}"/etc/make.conf ) > ${NANO_LOG}/_.etc 2>&1 -) +} -install_kernel ( ) ( +install_kernel() { pprint 2 "install kernel ($NANO_KERNEL)" pprint 3 "log: ${NANO_LOG}/_.ik" @@ -426,9 +425,9 @@ install_kernel ( ) ( ${NANO_MAKE} installkernel DESTDIR="${NANO_WORLDDIR}" DB_FROM_SRC=yes ) > ${NANO_LOG}/_.ik 2>&1 -) +} -native_xtools ( ) ( +native_xtools() { pprint 2 "Installing the optimized native build tools for cross env" pprint 3 "log: ${NANO_LOG}/_.native_xtools" @@ -441,13 +440,13 @@ native_xtools ( ) ( ${NANO_MAKE} native-xtools-install DESTDIR="${NANO_WORLDDIR}" ) > ${NANO_LOG}/_.native_xtools 2>&1 -) +} # # Run the requested set of early customization scripts, run before # buildworld. # -run_early_customize ( ) { +run_early_customize() { pprint 2 "run early customize scripts" for c in $NANO_EARLY_CUSTOMIZE do @@ -467,7 +466,7 @@ run_early_customize ( ) { # done an installworld, installed the etc files, installed the kernel # and tweaked them in the standard way. # -run_customize ( ) ( +run_customize() { pprint 2 "run customize scripts" for c in $NANO_CUSTOMIZE @@ -477,13 +476,13 @@ run_customize ( ) ( pprint 4 "`type $c`" ( set -o xtrace ; $c ) > ${NANO_LOG}/_.cust.$c 2>&1 done -) +} # # Run any last-minute customization commands after we've had a chance to # setup nanobsd, prune empty dirs from /usr, etc # -run_late_customize ( ) ( +run_late_customize() { pprint 2 "run late customize scripts" for c in $NANO_LATE_CUSTOMIZE do @@ -492,7 +491,7 @@ run_late_customize ( ) ( pprint 4 "`type $c`" ( set -o xtrace ; $c ) > ${NANO_LOG}/_.late_cust.$c 2>&1 done -) +} # # Hook called after we run all the late customize commands, but @@ -501,7 +500,7 @@ run_late_customize ( ) ( # have been recording their actions. It's not anticipated that # a user's cfg file would override this. # -fixup_before_diskimage ( ) ( +fixup_before_diskimage() { # Run the deduplication script that takes the metalog journal and # combines multiple entries for the same file (see source for # details). We take the extra step of removing the size keywords. This @@ -517,9 +516,9 @@ fixup_before_diskimage ( ) ( cat ${NANO_METALOG}.pre | ${NANO_TOOLS}/mtree-dedup.awk | \ sed -e 's/ size=[0-9][0-9]*//' | sort >> ${NANO_METALOG} fi -) +} -setup_nanobsd ( ) ( +setup_nanobsd() { pprint 2 "configure nanobsd setup" pprint 3 "log: ${NANO_LOG}/_.dl" @@ -564,9 +563,9 @@ setup_nanobsd ( ) ( tgt_dir2symlink tmp var/tmp ) > ${NANO_LOG}/_.dl 2>&1 -) +} -setup_nanobsd_etc ( ) ( +setup_nanobsd_etc() { pprint 2 "configure nanobsd /etc" ( @@ -623,18 +622,18 @@ EOF # Create directory for eventual /usr/local/etc contents mkdir -p etc/local ) -) +} -prune_usr ( ) ( +prune_usr() { # Remove all empty directories in /usr find "${NANO_WORLDDIR}"/usr -type d -depth -print | while read d do rmdir $d > /dev/null 2>&1 || true done -) +} -newfs_part ( ) ( +newfs_part() { local dev mnt lbl dev=$1 mnt=$2 @@ -642,15 +641,15 @@ newfs_part ( ) ( echo newfs ${NANO_NEWFS} ${NANO_LABEL:+-L${NANO_LABEL}${lbl}} ${dev} newfs ${NANO_NEWFS} ${NANO_LABEL:+-L${NANO_LABEL}${lbl}} ${dev} mount -o async ${dev} ${mnt} -) +} # Convenient spot to work around any umount issues that your build environment # hits by overriding this method. -nano_umount ( ) ( +nano_umount() { umount ${1} -) +} -populate_slice ( ) ( +populate_slice() { local dev dir mnt lbl dev=$1 dir=$2 @@ -665,23 +664,23 @@ populate_slice ( ) ( fi df -i ${mnt} nano_umount ${mnt} -) +} -populate_cfg_slice ( ) ( +populate_cfg_slice() { populate_slice "$1" "$2" "$3" "$4" -) +} -populate_data_slice ( ) ( +populate_data_slice() { populate_slice "$1" "$2" "$3" "$4" -) +} -last_orders ( ) ( +last_orders() { # Redefine this function with any last orders you may have # after the build completed, for instance to copy the finished # image to a more convenient place: # cp ${NANO_DISKIMGDIR}/${NANO_IMG1NAME} /home/ftp/pub/nanobsd.disk true -) +} ####################################################################### # @@ -693,7 +692,7 @@ last_orders ( ) ( # Common Flash device geometries # -FlashDevice ( ) { +FlashDevice() { if [ -d ${NANO_TOOLS} ] ; then . ${NANO_TOOLS}/FlashDevice.sub else @@ -722,8 +721,8 @@ FlashDevice ( ) { # The generic-hdd device is preferred for flash devices larger than 1GB. # -UsbDevice ( ) { - a1=`echo $1 | tr '[:upper:]' '[:lower:]'` +UsbDevice() { + local a1=`echo $1 | tr '[:upper:]' '[:lower:]'` case $a1 in generic-fdd) NANO_HEADS=64 @@ -745,7 +744,7 @@ UsbDevice ( ) { ####################################################################### # Setup serial console -cust_comconsole ( ) ( +cust_comconsole() { # Enable getty on console sed -i "" -e '/^tty[du]0/s/off/onifconsole/' ${NANO_WORLDDIR}/etc/ttys @@ -754,32 +753,32 @@ cust_comconsole ( ) ( # Tell loader to use serial console early. echo "${NANO_BOOT2CFG}" > ${NANO_WORLDDIR}/boot.config -) +} ####################################################################### # Allow root login via ssh -cust_allow_ssh_root ( ) ( +cust_allow_ssh_root() { sed -i "" -E 's/^#?PermitRootLogin.*/PermitRootLogin yes/' \ ${NANO_WORLDDIR}/etc/ssh/sshd_config -) +} ####################################################################### # Install the stuff under ./Files -cust_install_files ( ) ( +cust_install_files() { cd "${NANO_TOOLS}/Files" find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)/' | cpio ${CPIO_SYMLINK} -Ldumpv ${NANO_WORLDDIR} if [ -n "${NANO_CUST_FILES_MTREE}" -a -f ${NANO_CUST_FILES_MTREE} ]; then CR "mtree -eiU -p /" <${NANO_CUST_FILES_MTREE} fi -) +} ####################################################################### # Install packages from ${NANO_PACKAGE_DIR} -cust_pkgng ( ) ( +cust_pkgng() { mkdir -p ${NANO_WORLDDIR}/usr/local/etc local PKG_CONF="${NANO_WORLDDIR}/usr/local/etc/pkg.conf" local PKGCMD="env BATCH=YES ASSUME_ALWAYS_YES=YES PKG_DBDIR=${NANO_PKG_META_BASE}/pkg SIGNATURE_TYPE=none /usr/sbin/pkg" @@ -841,14 +840,14 @@ cust_pkgng ( ) ( umount ${NANO_WORLDDIR}/dev umount ${NANO_WORLDDIR}/_.p rm -xrf ${NANO_WORLDDIR}/_.p -) +} ####################################################################### # Convenience function: # Register all args as early customize function to run just before # build commences. -early_customize_cmd ( ) { +early_customize_cmd() { NANO_EARLY_CUSTOMIZE="$NANO_EARLY_CUSTOMIZE $*" } @@ -856,7 +855,7 @@ early_customize_cmd ( ) { # Convenience function: # Register all args as customize function. -customize_cmd ( ) { +customize_cmd() { NANO_CUSTOMIZE="$NANO_CUSTOMIZE $*" } @@ -865,7 +864,7 @@ customize_cmd ( ) { # Register all args as late customize function to run just before # image creation. -late_customize_cmd ( ) { +late_customize_cmd() { NANO_LATE_CUSTOMIZE="$NANO_LATE_CUSTOMIZE $*" } @@ -877,14 +876,14 @@ late_customize_cmd ( ) { # Progress Print # Print $2 at level $1. -pprint ( ) ( +pprint() { if [ "$1" -le $PPLEVEL ]; then runtime=$(( `date +%s` - $NANO_STARTTIME )) printf "%s %.${1}s %s\n" "`date -u -r $runtime +%H:%M:%S`" "#####" "$2" 1>&3 fi -) +} -usage ( ) { +usage() { ( echo "Usage: $0 [-BbfhIiKknpqvWwX] [-c config_file]" echo " -B suppress installs (both kernel and world)" @@ -911,7 +910,7 @@ usage ( ) { # Setup and Export Internal variables # -export_var ( ) { # Don't want a subshell +export_var() { var=$1 # Lookup value of the variable. eval val=\$$var @@ -920,8 +919,7 @@ export_var ( ) { # Don't want a subshell } # Call this function to set defaults _after_ parsing options. -# don't want a subshell otherwise variable setting is thrown away. -set_defaults_and_export ( ) { +set_defaults_and_export() { : ${NANO_OBJ:=/usr/obj/nanobsd.${NANO_NAME}${NANO_LAYOUT:+.${NANO_LAYOUT}}} : ${MAKEOBJDIRPREFIX:=${NANO_OBJ}} : ${NANO_DISKIMGDIR:=${NANO_OBJ}} diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common index 4aecd3602f6f..132ca9e2ba5b 100644 --- a/tools/tools/nanobsd/embedded/common +++ b/tools/tools/nanobsd/embedded/common @@ -1,4 +1,4 @@ - +#!/bin/sh #- # Copyright (c) 2015 M. Warner Losh <imp@FreeBSD.org> # Copyright (c) 2010-2011 iXsystems, Inc. @@ -113,18 +113,18 @@ NANO_FAT_DIR=${NANO_LOG}/_.fat customize_cmd cust_allow_ssh_root -add_etc_make_conf ( ) ( +add_etc_make_conf() { touch ${NANO_WORLDDIR}/etc/make.conf -) +} customize_cmd add_etc_make_conf -cust_install_machine_files ( ) ( +cust_install_machine_files() { echo "cd ${NANO_CFG_BASE}/Files" cd ${NANO_CFG_BASE}/Files find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)' | cpio -dumpv ${NANO_WORLDDIR} -) +} customize_cmd cust_install_files -customize_cmd cust_install_machine_files +customize_cmd cust_install_machine_files CONF_BUILD=" LOCAL_XTOOL_DIRS=usr.bin/mkimg @@ -173,13 +173,13 @@ NANO_PACKAGE_ONLY=1 # Creates images for all the formats that use MBR / GPT # split later if the #ifdef soup gets too bad. -create_diskimage_gpt ( ) ( +create_diskimage_gpt() { pprint 2 "build diskimage gpt ${NANO_NAME}" create_diskimage_mbr $* -) +} -create_diskimage_mbr ( ) ( +create_diskimage_mbr() { local fmt @@ -314,7 +314,7 @@ create_diskimage_mbr ( ) ( rm -f ${out}.xz xz -9 --keep ${out} ) > ${NANO_LOG}/_.di 2>&1 -) +} die( ) { echo "$*" @@ -373,7 +373,7 @@ $var=$val" fi done -typical_embedded ( ) ( +typical_embedded() { # Need to create rc.conf before we copy over /etc to /conf/base/etc # so now's a good time. @@ -388,10 +388,10 @@ typical_embedded ( ) ( # Make sure that firstboot scripts run so growfs works. # Note: still some issues remvoing this XXX touch ${NANO_WORLDDIR}/firstboot -) +} customize_cmd typical_embedded -fix_pkg ( ) ( +fix_pkg() { chdir ${NANO_WORLDDIR} mkdir -p pkg mkdir -p pkg/db @@ -410,20 +410,20 @@ fix_pkg ( ) ( echo "./pkg/db type=dir uname=root gname=wheel mode=0755" echo "./pkg/tmp type=dir uname=root gname=wheel mode=0755" ) >> ${NANO_METALOG} -) +} customize_cmd fix_pkg -save_build ( ) ( +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 -shrink_md_fbsize ( ) ( +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 -- @@ -431,12 +431,12 @@ shrink_md_fbsize ( ) ( # 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 customize_cmd cust_comconsole -dos_boot_part ( ) ( +dos_boot_part() { local d=/usr/local/share/u-boot/${NANO_BOOT_PKG} local f=${NANO_FAT_DIR} @@ -453,7 +453,7 @@ dos_boot_part ( ) ( # Now we need to copy over dtb files from the build. cp ${NANO_WORLDDIR}/boot/dtb/*.dtb . -) +} if [ -n "$NANO_BOOT_PKG" ]; then d=/usr/local/share/u-boot/${NANO_BOOT_PKG} @@ -468,7 +468,7 @@ if [ -n "$NANO_BOOT_PKG" ]; then customize_cmd dos_boot_part fi -product_custom ( ) ( +product_custom() { # not quite ready to tweak these in nopriv build if [ -z ${NANO_NOPRIV_BUILD} ]; then # Last second tweaks -- generally not needed @@ -480,7 +480,7 @@ product_custom ( ) ( chown root:wheel ${NANO_WORLDDIR}/ chown root:wheel ${NANO_WORLDDIR}/usr fi -) +} late_customize_cmd product_custom # @@ -615,19 +615,19 @@ esac NANO_SLICE_DATA= # Not included # These don't make any sense to this strategy, so stub them out. -calculate_partitioning ( ) ( -) +calculate_partitioning() { +} # These don't make any sense to this strategy, so stub them out. -create_code_slice ( ) ( -) +create_code_slice() { +} # Each major disk scheme has its own routine. Generally # this is for mbr, gpt, etc. These are generally are widely # shared, but some specialized formats won't be shared. -create_diskimage ( ) ( +create_diskimage() { eval create_diskimage_${NANO_DISK_SCHEME} -) +} # Set the path to the same path we use for buldworld to use latest mkimg NANO_TARGET=$(cd ${NANO_SRC}; ${NANO_MAKE} TARGET_ARCH=${NANO_ARCH} -V _TARGET) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index 2f689212263e..cbe56d6f560c 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -34,7 +34,7 @@ # Functions and variable definitions used by the legacy nanobsd # image building system. -calculate_partitioning ( ) ( +calculate_partitioning() { echo $NANO_MEDIASIZE $NANO_IMAGES \ $NANO_SECTS $NANO_HEADS \ $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | @@ -90,9 +90,9 @@ calculate_partitioning ( ) ( } } ' > ${NANO_LOG}/_.partitioning -) +} -create_code_slice ( ) ( +create_code_slice() { pprint 2 "build code slice" pprint 3 "log: ${NANO_OBJ}/_.cs" @@ -142,10 +142,10 @@ create_code_slice ( ) ( trap - 1 2 15 EXIT ) > ${NANO_OBJ}/_.cs 2>&1 -) +} -create_diskimage ( ) ( +create_diskimage() { pprint 2 "build diskimage" pprint 3 "log: ${NANO_OBJ}/_.di" @@ -243,4 +243,4 @@ create_diskimage ( ) ( trap - 1 2 15 EXIT ) > ${NANO_LOG}/_.di 2>&1 -) +} diff --git a/tools/tools/nanobsd/rescue/common b/tools/tools/nanobsd/rescue/common index 15bf10f5e67d..a145a1ded32a 100644 --- a/tools/tools/nanobsd/rescue/common +++ b/tools/tools/nanobsd/rescue/common @@ -1,5 +1,5 @@ -# -# +#!/bin/sh + #NANO_SRC=$(pwd) #NANO_SRC=${NANO_SRC%/tools/tools/nanobsd/rescue} #NANO_OBJ=${NANO_SRC}/../nanobsd-builds/${NANO_NAME}/obj @@ -24,12 +24,12 @@ NANO_MD_BACKING=file # Options to put in make.conf during buildworld only CONF_BUILD=' ' -# Options to put in make.conf during installworld only +# Options to put in make.conf during installworld only CONF_INSTALL=' ' -# Options to put in make.conf during both build- & installworld. -CONF_WORLD=' -CFLAGS=-O -pipe +# Options to put in make.conf during both build- & installworld. +CONF_WORLD=' +CFLAGS=-O -pipe # We do not need these for rescue WITHOUT_TESTS=true WITHOUT_DEBUG_FILES=true @@ -71,9 +71,9 @@ customize_cmd cust_install_files #customize_cmd cust_pkgng -cust_etc_cfg () ( - cd ${NANO_WORLDDIR} -# mkdir -pv scratch +cust_etc_cfg() { + cd ${NANO_WORLDDIR} + # mkdir -pv scratch echo "hostname=\"rescue\"" > etc/rc.conf echo "font8x14=\"iso15-8x14\"" >> etc/rc.conf echo "font8x16=\"iso15-8x16\"" >> etc/rc.conf @@ -85,12 +85,12 @@ cust_etc_cfg () ( echo "/dev/${NANO_DRIVE}s3 /cfg ufs rw,noauto 2 2" >> etc/fstab echo "tmpfs /boot/zfs tmpfs rw,size=1048576,mode=777 0 0" >> etc/fstab echo "ports:/usr/ports /usr/ports nfs rw,noauto,noatime,bg,soft,intr,nfsv3 0 0" >> etc/fstab -# echo "/dev/ad1s1a /scratch ufs rw,noauto,noatime 0 0" >> etc/fstab + # echo "/dev/ad1s1a /scratch ufs rw,noauto,noatime 0 0" >> etc/fstab /usr/sbin/pwd_mkdb -d etc etc/master.passwd -) +} customize_cmd cust_etc_cfg -setup_nanobsd_etc ( ) ( +setup_nanobsd_etc() { pprint 2 "configure nanobsd /etc" ( cd ${NANO_WORLDDIR} @@ -102,8 +102,8 @@ setup_nanobsd_etc ( ) ( echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf mkdir -p cfg ) -) -last_orders () ( +} +last_orders() { pprint 2 "last orders" ( cd ${NANO_WORLDDIR} @@ -112,7 +112,7 @@ last_orders () ( echo "/dev/iso9660/${BIGLABEL} / cd9660 ro,noatime 0 0" > etc/fstab echo "tmpfs /boot/zfs tmpfs rw,size=1048576,mode=777 0 0" >> etc/fstab echo "ports:/usr/ports /usr/ports nfs rw,noauto,noatime,bg,soft,intr,nfsv3 0 0" >> etc/fstab -# echo "/dev/ad1s1a /scratch ufs rw,noauto,noatime 0 0" >> etc/fstab + # echo "/dev/ad1s1a /scratch ufs rw,noauto,noatime 0 0" >> etc/fstab rm -f conf/default/etc/remount touch conf/default/etc/.keepme touch conf/default/var/.keepme @@ -125,4 +125,4 @@ last_orders () ( -o label="${BIGLABEL}" -o publisher="RMX" \ -o bootimage="i386;_.w/boot/cdboot" -o no-emul-boot _.disk.iso _.w/ ) -) +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509181917.58IJHOn8088552>