Default (if not specified) -w work -o out. -o <out_dir> is only used by 'iso' command. Adjust build.sh of releng and baseline profile to reflect this change. <project> - work <- $work_dir - out <- $out_dir Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- archiso/mkarchiso | 35 +++++++++++++++++++---------------- configs/baseline/build.sh | 11 ++++++----- configs/releng/build.sh | 22 ++++++++++++---------- 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 6826441..885c9c2 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -11,6 +11,8 @@ export iso_label="ARCH_$(date +%Y%m)" iso_publisher="Arch Linux <http://www.archlinux.org>" iso_application="Arch Linux Live/Rescue CD" install_dir="arch" +work_dir="work" +out_dir="out" # Show an INFO message # $1: message string @@ -104,17 +106,21 @@ _usage () echo " -D <install_dir> Set an install_dir. All files will by located here." echo " Default ${install_dir}" echo " NOTE: Max 8 characters, use only [a-z0-9]" + echo " -w <work_dir> Set the working directory" + echo " Default ${work_dir}" + echo " -o <out_dir> Set the output directory" + echo " Default ${out_dir}" echo " -v Enable verbose output" echo " -h This message" echo " commands:" - echo " create <dir>" + echo " create" echo " create a base directory layout to work with" echo " includes all specified packages" - echo " prepare <dir>" + echo " prepare" echo " build all images" - echo " checksum <dir>" + echo " checksum" echo " make a checksum.md5 for self-test" - echo " iso <dir> <image name>" + echo " iso <image name>" echo " build an iso image from the working dir" exit ${1} } @@ -310,6 +316,7 @@ command_iso () { _is_directory_changed "${work_dir}/iso" "${img_name}" + mkdir -p ${out_dir} _msg_info "Creating ISO image..." local _qflag="" if [[ ${quiet} == "y" ]]; then @@ -324,9 +331,9 @@ command_iso () { -publisher "${iso_publisher}" \ -A "${iso_application}" \ -V "${iso_label}" \ - -o "${img_name}" "${work_dir}/iso/" - isohybrid "${img_name}" - _msg_info "Done! | $(ls -sh ${img_name})" + -o "${out_dir}/${img_name}" "${work_dir}/iso/" + isohybrid "${out_dir}/${img_name}" + _msg_info "Done! | $(ls -sh ${out_dir}/${img_name})" } # Parse aitab and create each filesystem specified on that, and push it in "iso" directory. @@ -404,7 +411,7 @@ if [[ ${EUID} -ne 0 ]]; then _msg_error "This script must be run as root." 1 fi -while getopts 'p:C:L:P:A:D:fvh' arg; do +while getopts 'p:C:L:P:A:D:w:o:vh' arg; do case "${arg}" in p) pkg_list="${pkg_list} ${OPTARG}" ;; C) pacman_conf="${OPTARG}" ;; @@ -412,6 +419,8 @@ while getopts 'p:C:L:P:A:D:fvh' arg; do P) iso_publisher="${OPTARG}" ;; A) iso_application="${OPTARG}" ;; D) install_dir="${OPTARG}" ;; + w) work_dir="${OPTARG}" ;; + o) out_dir="${OPTARG}" ;; v) quiet="n" ;; h|?) _usage 0 ;; *) @@ -429,12 +438,6 @@ if [[ $# -lt 1 ]]; then fi command_name="${1}" -if [[ $# -lt 2 ]]; then - _msg_error "No working directory specified" 0 - _usage 1 -fi -work_dir="${2}" - case "${command_name}" in create) command_create @@ -446,11 +449,11 @@ case "${command_name}" in command_checksum ;; iso) - if [[ $# -lt 3 ]]; then + if [[ $# -lt 2 ]]; then _msg_error "No image specified" 0 _usage 1 fi - img_name="${3}" + img_name="${2}" command_iso ;; *) diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index 24f301b..f3e8676 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -8,14 +8,15 @@ iso_version=$(date +%Y.%m.%d) install_dir=arch arch=$(uname -m) work_dir=work +out_dir=out verbose="n" script_path=$(readlink -f ${0%/*}) # Base installation (root-image) make_basefs() { - mkarchiso ${verbose} -D "${install_dir}" -p "base" create "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -p "syslinux" create "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "base" create + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "syslinux" create } # Copy mkinitcpio archiso hooks (root-image) @@ -73,13 +74,13 @@ make_aitab() { # Build all filesystem images specified in aitab (.fs .fs.sfs .sfs) make_prepare() { - mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare } # Build ISO make_iso() { - mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${arch}.iso" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${arch}.iso" } if [[ $verbose == "y" ]]; then diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 1f26408..cfcd2a1 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -8,19 +8,20 @@ iso_version=$(date +%Y.%m.%d) install_dir=arch arch=$(uname -m) work_dir=work +out_dir=out verbose="n" script_path=$(readlink -f ${0%/*}) # Base installation (root-image) make_basefs() { - mkarchiso ${verbose} -D "${install_dir}" -p "base" create "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -p "memtest86+ syslinux mkinitcpio-nfs-utils nbd" create "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "base" create + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "memtest86+ syslinux mkinitcpio-nfs-utils nbd" create } # Additional packages (root-image) make_packages() { - mkarchiso ${verbose} -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" create "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" create } # Customize installation (root-image) @@ -156,15 +157,15 @@ make_aitab() { # Build all filesystem images specified in aitab (.fs .fs.sfs .sfs) make_prepare() { - mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare } # Build ISO # args: $1 (core | netinstall) make_iso() { local _iso_type=${1} - mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" } # Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso @@ -207,8 +208,9 @@ make_dual() { sed "s|%ARCHISO_LABEL%|${iso_label}|g; s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/} done - mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}/dual" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${iso_name}-${iso_version}-${_iso_type}-dual.iso" + mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" checksum + mkdir -p ${out_dir} + mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${_iso_type}-dual.iso" : > ${work_dir}/dual/build.${FUNCNAME}_${_iso_type} fi } @@ -298,11 +300,11 @@ case "${command_name}" in ;; clean_single) rm -rf ${work_dir} - rm -f ${iso_name}-${iso_version}-*-${arch}.iso + rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso ;; clean_dual) rm -rf ${work_dir}/dual - rm -f ${iso_name}-${iso_version}-*-dual.iso + rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso ;; *) echo "Invalid command name '${command_name}'" -- 1.7.6