From 53220a3535e67e9a06773c246a049acaf910d450 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Sun, 20 Feb 2011 01:40:56 -0600 Subject: [PATCH] script/makeworld: rename target to arch and config to conf --- script/makeworld | 55 ++++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/script/makeworld b/script/makeworld index 9554a7a..3b53b36 100755 --- a/script/makeworld +++ b/script/makeworld @@ -1,30 +1,15 @@ #!/bin/sh -# Makeworld dir structure should contain, at minimum: -# script -# makeworld (this file) -# worlds -# seed -# base -# (arch of build host: i386, amd64, etc) -# base.* (virgin base tree of same arch as host, used to seed chroot for clean build) -# (i386, amd64, etc) -# (GENERIC, SABA, SS4200, etc) -# config -# make.conf -# src.conf -# CONFIG (Matches config name: GENERIC, SABA, SS4200, etc) - # Load shlib and modules _root="$(dirname "${0}")"; . "${_root}/lib/env.sh" want log pebkac() { [ "${*}" ] && printf "%s\n\n" "${*}" - echo "Usage: $(basename "${0}") -m -t -c " + echo "Usage: $(basename "${0}") -m -a -c " echo " -m Provide additional flags to make" - echo " -t Target architecture (i386, amd64)" - echo " -c Target configuration (in worlds//)" + echo " -a World architecture (i386, amd64)" + echo " -c World configuration (in worlds//)" echo " -h Help!" echo "" echo "If, for some reason, you wish to spread out builds across multiple" @@ -34,9 +19,9 @@ pebkac() { echo " -q Clean up chroot environment" echo "" echo "Available make targets:" - for target in ${make_tgts} + for make_tgt in ${make_tgts} do - echo " ${target}" + echo " ${make_tgt}" done exit 1 } @@ -72,7 +57,7 @@ prepare() { if [ -d "${world}/config" ] then meh "Installing build-time configuration" - [ -f "${world}/config/${CONFIG}" ] && cp "${world}/config/${CONFIG}" "/usr/src/sys/${TARGET}/conf/" + [ -f "${world}/config/${CONF}" ] && cp "${world}/config/${CONF}" "/usr/src/sys/${ARCH}/conf/" [ -f "${world}/config/make.conf" ] && cp "${world}/config/make.conf" "${build}/etc/" [ -f "${world}/config/src.conf" ] && cp "${world}/config/src.conf" "${build}/etc/" fi @@ -87,7 +72,7 @@ cleanup() { umount -f "${build}/usr/obj" umount -f "${build}/usr/src" umount -f "${build}/dev" - mount | grep -q "${build}" && wtf "Stuff is still mounted under ${build}; not removing" + mount | grep -q "${build}/" && wtf "Stuff is still mounted under ${build}; not removing" chflags -R noschg "${build}" rm -Rf "${build}" trap "" exit hup int term kill @@ -103,16 +88,16 @@ make_jobs="$(( ${make_cpus} * 2 ))" make_tgts="buildworld buildkernel distrib-dirs installworld installkernel distribution" # Defaults -TARGET="$(uname -m)" -CONFIG="GENERIC" +ARCH="$(uname -m)" +CONF="GENERIC" MAKEOPTS="-j${make_jobs}" -while getopts "m:t:c:hpdq" opt +while getopts "m:a:c:hpdq" opt do case "${opt}" in m) MAKEOPTS="${MAKEOPTS} ${OPTARG}" ;; - t) TARGET="${OPTARG}" ;; - c) CONFIG="${OPTARG}" ;; + a) ARCH="${OPTARG}" ;; + c) CONF="${OPTARG}" ;; p) CHROOT_PREPARE="TRUE" ;; d) CHROOT_DIRTY="TRUE" ;; q) CHROOT_CLEAN="TRUE" ;; @@ -129,9 +114,9 @@ want root sequence="${*:-${make_tgts}}" # Target world directory -world="${ROOT}/${TARGET}/${CONFIG}" +world="${ROOT}/${ARCH}/${CONF}" # Source chroot seed directory -seed="${ROOT}/seed/base/$(uname -m)" +seed="${ROOT}/seed/$(uname -m)/base" # Root directory for chroot build="${world}/chroot" @@ -146,7 +131,7 @@ SHELL=/bin/sh date="$(date +%Y%m%d)" # Check if target config exists -[ -d "${world}" ] || wtf "${TARGET}/${CONFIG} doesn't exist" +[ -d "${world}" ] || wtf "${ARCH}/${CONF} doesn't exist" if [ "${CHROOT_PREPARE}" ] then @@ -163,24 +148,24 @@ then exit fi -meh "Making world for ${TARGET}/${CONFIG}" +meh "Making world for ${ARCH}/${CONF}" prepare meh "Seed: ${seed}" -meh "Config: ${TARGET}/${CONFIG}" +meh "Config: ${ARCH}/${CONF}" meh "Builddir: ${build}" meh "make ${MAKEOPTS}" meh "DESTDIR=${world}/root" for step in ${sequence} do - meh "==> Phase: ${step}" + meh "==> Step: ${step}" script "${world}/${date}-${step}.log" env -i ${env} chroot "${build}" sh -c \ - "cd /usr/src; time make ${MAKEOPTS} ${step} TARGET=${TARGET} KERNCONF=${CONFIG} DESTDIR=/mnt" || wtf "chroot-cmd ${phase}" + "cd /usr/src; time make ${MAKEOPTS} ${step} TARGET=${ARCH} KERNCONF=${CONF} DESTDIR=/mnt" || wtf "chroot-cmd ${step}" done # Copy the config files into the target, to keep a record of the build options -[ -f "${world}/config/${CONFIG}" ] && cp "${world}/config/${CONFIG}" "${build}/boot/kernel/" +[ -f "${world}/config/${CONF}" ] && cp "${world}/config/${CONF}" "${build}/boot/kernel/" [ -f "${world}/config/make.conf" ] && cp "${world}/config/make.conf" "${build}/etc/" [ -f "${world}/config/src.conf" ] && cp "${world}/config/src.conf" "${build}/etc/" -- 2.42.0