[arch-releng] archiso: also putting the hour in version string
Hi, I would like to run multiple builds per day. For this I would like to also put the hour of building in the iso filenames. something like: diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 1aa80fd..7fce685 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -4,7 +4,7 @@ set -e -u name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +version=$(date +%Y.%m.%d.%H) install_dir=arch arch=$(uname -m) work_dir=work Or, maybe this is too releng-specific (i.e. most people who run archiso probably prefer $(date +%Y.%m.%d), in which case: can you give archiso a flag so that I can control the version as a parameter? ./build.sh all_iso_single 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14-lets-try-some-new-code passing it as a flag would also be more robust. Things could go wrong (I think?) if the all_iso_single runs at 23:45 of one day and all_iso_dual runs at 00:15 the next morning. Dieter
On 08/14/2011 08:13 AM, Dieter Plaetinck wrote:
Hi, I would like to run multiple builds per day. For this I would like to also put the hour of building in the iso filenames.
something like:
diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 1aa80fd..7fce685 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -4,7 +4,7 @@ set -e -u
name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +version=$(date +%Y.%m.%d.%H) install_dir=arch arch=$(uname -m) work_dir=work
Or, maybe this is too releng-specific (i.e. most people who run archiso probably prefer $(date +%Y.%m.%d), in which case: can you give archiso a flag so that I can control the version as a parameter?
./build.sh all_iso_single 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14-lets-try-some-new-code
passing it as a flag would also be more robust. Things could go wrong (I think?) if the all_iso_single runs at 23:45 of one day and all_iso_dual runs at 00:15 the next morning. Do not worry about this. You guess about LABEL? Not an issue, LABEL for dual is also generated at build time (not read from "single" work). Also you can have a 201112 and 201201. :P
Dieter
what do you think about via env var? #!/bin/bash set -u -e version=${RELENG_BUILD_VERSION:-$(date +%Y.%m.%d)} echo ${version} Keeping it simply. $ ./build.sh 2011.08.15 $ RELENG_BUILD_VERSION=76543210 ./build.sh 76543210 -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On Mon, 15 Aug 2011 01:43:49 -0300 Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> wrote:
On 08/14/2011 08:13 AM, Dieter Plaetinck wrote:
Hi, I would like to run multiple builds per day. For this I would like to also put the hour of building in the iso filenames.
something like:
diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 1aa80fd..7fce685 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -4,7 +4,7 @@ set -e -u
name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +version=$(date +%Y.%m.%d.%H) install_dir=arch arch=$(uname -m) work_dir=work
Or, maybe this is too releng-specific (i.e. most people who run archiso probably prefer $(date +%Y.%m.%d), in which case: can you give archiso a flag so that I can control the version as a parameter?
./build.sh all_iso_single 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14-lets-try-some-new-code
passing it as a flag would also be more robust. Things could go wrong (I think?) if the all_iso_single runs at 23:45 of one day and all_iso_dual runs at 00:15 the next morning. Do not worry about this. You guess about LABEL? Not an issue, LABEL for dual is also generated at build time (not read from "single" work). Also you can have a 201112 and 201201. :P
That's the point. If I build multiple isos after each other (like first single isos, then duals) I want all of them to have the same version.
what do you think about via env var?
It's possible but I don't like it. If we already have option passing through cmdline args, I think we should pass new options that way too. Also it makes it very clear to the user what you can do (implenting ./build.sh -h which would show all flags with explanation) while you're at it, probably a good idea to use getopt and make verbosity also controllable with a flag. (now my code needs to call sed on your script..) Dieter
On 08/15/2011 02:14 PM, Dieter Plaetinck wrote:
On Mon, 15 Aug 2011 01:43:49 -0300 Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> wrote:
On 08/14/2011 08:13 AM, Dieter Plaetinck wrote:
Hi, I would like to run multiple builds per day. For this I would like to also put the hour of building in the iso filenames.
something like:
diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 1aa80fd..7fce685 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -4,7 +4,7 @@ set -e -u
name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +version=$(date +%Y.%m.%d.%H) install_dir=arch arch=$(uname -m) work_dir=work
Or, maybe this is too releng-specific (i.e. most people who run archiso probably prefer $(date +%Y.%m.%d), in which case: can you give archiso a flag so that I can control the version as a parameter?
./build.sh all_iso_single 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14-lets-try-some-new-code
passing it as a flag would also be more robust. Things could go wrong (I think?) if the all_iso_single runs at 23:45 of one day and all_iso_dual runs at 00:15 the next morning. Do not worry about this. You guess about LABEL? Not an issue, LABEL for dual is also generated at build time (not read from "single" work). Also you can have a 201112 and 201201. :P That's the point. If I build multiple isos after each other (like first single isos, then duals) I want all of them to have the same version.
what do you think about via env var? It's possible but I don't like it. If we already have option passing through cmdline args, I think we should pass new options that way too. Also it makes it very clear to the user what you can do (implenting ./build.sh -h which would show all flags with explanation) while you're at it, probably a good idea to use getopt and make verbosity also controllable with a flag. (now my code needs to call sed on your script..)
Dieter
How about this? usage ./build.sh [options] command <command options> General options: -N <iso_name> Set an iso filename (prefix) Default: archlinux -V <iso_version> Set an iso version (in filename) Default: 2011.08.17 -L <iso_label> Set an iso label (disk label) Default: ARCH_201108 -D <install_dir> Set an install_dir (directory inside iso) Default: arch -w <work_dir> Set the working directory Default: work -o <out_dir> Set the output directory Default out -v Enable verbose output -h This help message Commands: build <mode> <type> Build selected .iso by <mode> and <type> purge <mode> Clean working directory except iso/ directory of build <mode> clean <mode> Clean working directory and .iso file in output directory of build <mode> Command options: <mode> Valid values 'single' or 'dual' <type> Valid values 'net', 'core' or 'all' -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
PATCH 3/3 Untested, but should work(tm). Dieter, looks good this changes for you?
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- configs/baseline/build.sh | 6 +++--- configs/releng/build.sh | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index a3775c0..0795eda 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -2,9 +2,9 @@ set -e -u -name=archlinux +iso_name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +iso_version=$(date +%Y.%m.%d) install_dir=arch arch=$(uname -m) work_dir=work @@ -79,7 +79,7 @@ make_prepare() { # Build ISO make_iso() { mkarchiso ${verbose} checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${name}-${version}-${arch}.iso" + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${arch}.iso" } if [[ $verbose == "y" ]]; then diff --git a/configs/releng/build.sh b/configs/releng/build.sh index ab7aae7..e0d42ab 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -2,9 +2,9 @@ set -e -u -name=archlinux +iso_name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +iso_version=$(date +%Y.%m.%d) install_dir=arch arch=$(uname -m) work_dir=work @@ -164,7 +164,7 @@ make_prepare() { make_iso() { local _iso_type=${1} mkarchiso ${verbose} checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${name}-${version}-${_iso_type}-${arch}.iso" + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" } # Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso @@ -208,7 +208,7 @@ make_dual() { s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/} done mkarchiso ${verbose} checksum "${work_dir}/dual" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${name}-${version}-${_iso_type}-dual.iso" + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${iso_name}-${iso_version}-${_iso_type}-dual.iso" : > ${work_dir}/dual/build.${FUNCNAME}_${_iso_type} fi } @@ -298,11 +298,11 @@ case "${command_name}" in ;; clean_single) rm -rf ${work_dir} - rm -f ${name}-${version}-*-${arch}.iso + rm -f ${iso_name}-${iso_version}-*-${arch}.iso ;; clean_dual) rm -rf ${work_dir}/dual - rm -f ${name}-${version}-*-dual.iso + rm -f ${iso_name}-${iso_version}-*-dual.iso ;; *) echo "Invalid command name '${command_name}'" -- 1.7.6
<project> - work <- $work_dir - out <- $out_dir Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- configs/baseline/build.sh | 4 +++- configs/releng/build.sh | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index 0795eda..71024c4 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -8,6 +8,7 @@ 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%/*}) @@ -79,7 +80,8 @@ make_prepare() { # Build ISO make_iso() { mkarchiso ${verbose} checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${arch}.iso" + mkdir -p ${out_dir} + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${out_dir}/${iso_name}-${iso_version}-${arch}.iso" } if [[ $verbose == "y" ]]; then diff --git a/configs/releng/build.sh b/configs/releng/build.sh index e0d42ab..2b60a60 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -8,6 +8,7 @@ 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%/*}) @@ -164,7 +165,8 @@ make_prepare() { make_iso() { local _iso_type=${1} mkarchiso ${verbose} checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" + mkdir -p ${out_dir} + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${out_dir}/${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" } # Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso @@ -208,7 +210,8 @@ make_dual() { s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/} done mkarchiso ${verbose} checksum "${work_dir}/dual" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${iso_name}-${iso_version}-${_iso_type}-dual.iso" + mkdir -p ${out_dir} + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${out_dir}/${iso_name}-${iso_version}-${_iso_type}-dual.iso" : > ${work_dir}/dual/build.${FUNCNAME}_${_iso_type} fi } @@ -298,11 +301,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
On 08/18/2011 02:16 AM, Gerardo Exequiel Pozzi wrote:
<project> - work<- $work_dir - out<- $out_dir
Signed-off-by: Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> --- configs/baseline/build.sh | 4 +++- configs/releng/build.sh | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index 0795eda..71024c4 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -8,6 +8,7 @@ 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%/*}) @@ -79,7 +80,8 @@ make_prepare() { # Build ISO make_iso() { mkarchiso ${verbose} checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${arch}.iso" + mkdir -p ${out_dir} + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${out_dir}/${iso_name}-${iso_version}-${arch}.iso" }
if [[ $verbose == "y" ]]; then diff --git a/configs/releng/build.sh b/configs/releng/build.sh index e0d42ab..2b60a60 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -8,6 +8,7 @@ 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%/*}) @@ -164,7 +165,8 @@ make_prepare() { make_iso() { local _iso_type=${1} mkarchiso ${verbose} checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" + mkdir -p ${out_dir} + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${out_dir}/${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" }
# Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso @@ -208,7 +210,8 @@ make_dual() { s|%INSTALL_DIR%|${install_dir}|g" ${_cfg}> ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/} done mkarchiso ${verbose} checksum "${work_dir}/dual" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${iso_name}-${iso_version}-${_iso_type}-dual.iso" + mkdir -p ${out_dir} + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${out_dir}/${iso_name}-${iso_version}-${_iso_type}-dual.iso" :> ${work_dir}/dual/build.${FUNCNAME}_${_iso_type} fi } @@ -298,11 +301,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}'"
Ignore this. I reworked it. Implemented -o out_dir (default to "out") in mkarchiso, also -w work_dir (default to "work"). Both build.sh update to use this feature. I will do some tests before send again the [RFC] patches. -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
usage ./build.sh [options] command <command options> General options: -N <iso_name> Set an iso filename (prefix) Default: archlinux -V <iso_version> Set an iso version (in filename) Default: 2011.08.18 -L <iso_label> Set an iso label (disk label) Default: ARCH_201108 -D <install_dir> Set an install_dir (directory inside iso) Default: arch -w <work_dir> Set the working directory Default: work -o <out_dir> Set the output directory Default out -v Enable verbose output -h This help message Commands: build <mode> <type> Build selected .iso by <mode> and <type> purge <mode> Clean working directory except iso/ directory of build <mode> clean <mode> Clean working directory and .iso file in output directory of build <mode> Command options: <mode> Valid values 'single' or 'dual' <type> Valid values 'netinstall', 'core' or 'all' Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- README | 15 ++-- configs/releng/build.sh | 237 ++++++++++++++++++++++++++++++++++------------- 2 files changed, 181 insertions(+), 71 deletions(-) diff --git a/README b/README index 97b5f77..88b3243 100644 --- a/README +++ b/README @@ -240,23 +240,24 @@ Note: These steps should be done with 64 bits support. * Enter 32 bits chroot enviroment then build core and netinstall single images. [chroot32] # linux32 mkarchroot -r bash /tmp/chroot32 - [chroot32] # mknod /dev/loop1032 b 7 1032 #assumed loop.max_part=0 (by default) + [chroot32] # mknod /dev/loop1032 b 7 1032 # assumed loop.max_part=0 (by default) [chroot32] # cp -r /usr/share/archiso/configs/releng /tmp [chroot32] # cd /tmp/releng - [chroot32] # ./build.sh all_iso_single - [chroot32] # ./build.sh purge_single #optional + [chroot32] # ./build.sh build single all + [chroot32] # ./build.sh purge single # optional step * Enter 64 bits chroot enviroment then build core and netinstall single images. [chroot64] # mkarchroot -r bash /tmp/chroot64 - [chroot64] # mknod /dev/loop1064 b 7 1064 #assumed loop.max_part=0 (by default) + [chroot64] # mknod /dev/loop1064 b 7 1064 # assumed loop.max_part=0 (by default) [chroot64] # cp -r /usr/share/archiso/configs/releng /tmp [chroot64] # cd /tmp/releng - [chroot64] # ./build.sh all_iso_single - [chroot64] # ./build.sh purge_single #optional + [chroot64] # ./build.sh build single all + [chroot64] # ./build.sh purge single # optional step * Build core and netinstall dual images from any of the chroot enviroments. [host64] # mkarchroot -r bash /tmp/chroot64 [chroot64] # cd /tmp/releng - [chroot64] # ./build.sh all_iso_dual + [chroot64] # ./build.sh build dual all + [chroot64] # ./build.sh purge dual # optional step diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 2b60a60..9032629 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -9,7 +9,7 @@ install_dir=arch arch=$(uname -m) work_dir=work out_dir=out -verbose="n" +verbose="" script_path=$(readlink -f ${0%/*}) @@ -216,13 +216,82 @@ make_dual() { fi } +purge_single () +{ + if [[ -d ${work_dir} ]]; then + find ${work_dir} -mindepth 1 -maxdepth 1 \ + ! -path ${work_dir}/iso -prune \ + | xargs rm -rf + fi +} + +purge_dual () +{ + if [[ -d ${work_dir}/dual ]]; then + find ${work_dir}/dual -mindepth 1 -maxdepth 1 \ + ! -path ${work_dir}/dual/iso -prune \ + | xargs rm -rf + fi +} +clean_single () +{ + rm -rf ${work_dir} + rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso +} + +clean_dual () +{ + rm -rf ${work_dir}/dual + rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso +} + +make_common_single() { + make_basefs + make_packages + make_customize_root_image + make_setup_mkinitcpio + make_boot + make_syslinux + make_isolinux + make_lib_modules + make_usr_share + make_aitab $1 + make_prepare $1 + make_iso $1 +} _usage () { - echo "usage ${0##*/} net_iso_single | core_iso_single | all_iso_single | purge_single | clean_single" - echo " net_iso_dual | core_iso_dual | all_iso_dual | purge_dual | clean_dual" + echo "usage ${0} [options] command <command options>" echo + echo " General options:" + echo " -N <iso_name> Set an iso filename (prefix)" + echo " Default: ${iso_name}" + echo " -V <iso_version> Set an iso version (in filename)" + echo " Default: ${iso_version}" + echo " -L <iso_label> Set an iso label (disk label)" + echo " Default: ${iso_label}" + echo " -D <install_dir> Set an install_dir (directory inside iso)" + echo " Default: ${install_dir}" + 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 help message" + echo + echo " Commands:" + echo " build <mode> <type>" + echo " Build selected .iso by <mode> and <type>" + echo " purge <mode>" + echo " Clean working directory except iso/ directory of build <mode>" + echo " clean <mode>" + echo " Clean working directory and .iso file in output directory of build <mode>" + echo + echo " Command options:" + echo " <mode> Valid values 'single' or 'dual'" + echo " <type> Valid values 'netinstall', 'core' or 'all'" exit ${1} } @@ -231,81 +300,121 @@ if [[ ${EUID} -ne 0 ]]; then _usage 1 fi +while getopts 'N:V:L:D:w:o:vh' arg; do + case "${arg}" in + N) iso_name="${OPTARG}" ;; + V) iso_version="${OPTARG}" ;; + L) iso_label="${OPTARG}" ;; + D) install_dir="${OPTARG}" ;; + w) work_dir="${OPTARG}" ;; + o) out_dir="${OPTARG}" ;; + v) verbose="-v" ;; + h|?) _usage 0 ;; + *) + _msg_error "Invalid argument '${arg}'" 0 + _usage 1 + ;; + esac +done + +shift $((OPTIND - 1)) + if [[ $# -lt 1 ]]; then echo "No command specified" _usage 1 fi command_name="${1}" -if [[ ${verbose} == "y" ]]; then - verbose="-v" -else - verbose="" +if [[ $# -lt 2 ]]; then + echo "No command mode specified" + _usage 1 fi +command_mode="${2}" -if [[ ${command_name} =~ single ]]; then - work_dir=${work_dir}/${arch} +if [[ ${command_name} == "build" && $# -lt 3 ]]; then + echo "No build type specified" + _usage 1 fi +command_type="${3}" -make_common_single() { - make_basefs - make_packages - make_customize_root_image - make_setup_mkinitcpio - make_boot - make_syslinux - make_isolinux - make_lib_modules - make_usr_share - make_aitab $1 - make_prepare $1 - make_iso $1 -} +if [[ ${command_mode} == "single" ]]; then + work_dir=${work_dir}/${arch} +fi case "${command_name}" in - net_iso_single) - make_common_single netinstall - ;; - core_iso_single) - make_core_repo - make_common_single core - ;; - all_iso_single) - make_common_single netinstall - make_core_repo - make_common_single core - ;; - net_iso_dual) - make_dual netinstall - ;; - core_iso_dual) - make_dual core - ;; - all_iso_dual) - make_dual netinstall - make_dual core - ;; - purge_single) - if [[ -d ${work_dir} ]]; then - find ${work_dir} -mindepth 1 -maxdepth 1 \ - ! -path ${work_dir}/iso -prune \ - | xargs rm -rf - fi - ;; - purge_dual) - if [[ -d ${work_dir}/dual ]]; then - find ${work_dir}/dual -mindepth 1 -maxdepth 1 \ - ! -path ${work_dir}/dual/iso -prune \ - | xargs rm -rf - fi + build) + case "${command_mode}" in + single) + case "${command_type}" in + netinstall) + make_common_single netinstall + ;; + core) + make_core_repo + make_common_single core + ;; + all) + make_common_single netinstall + make_core_repo + make_common_single core + ;; + *) + echo "Invalid build type '${command_type}'" + _usage 1 + ;; + esac + ;; + dual) + case "${command_type}" in + netinstall) + make_dual netinstall + ;; + core) + make_dual core + ;; + all) + make_dual netinstall + make_dual core + ;; + *) + echo "Invalid build type '${command_type}'" + _usage 1 + ;; + esac + ;; + *) + echo "Invalid build mode '${command_mode}'" + _usage 1 + ;; + esac ;; - clean_single) - rm -rf ${work_dir} - rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso + purge) + case "${command_mode}" in + single) + purge_single + ;; + dual) + purge_dual + ;; + *) + echo "Invalid purge mode '${command_mode}'" + _usage 1 + ;; + esac ;; - clean_dual) - rm -rf ${work_dir}/dual - rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso + clean) + case "${command_mode}" in + single) + clean_single + ;; + dual) + clean_dual + ;; + *) + echo "Invalid clean mode '${command_mode}'" + _usage 1 + ;; + esac ;; *) echo "Invalid command name '${command_name}'" -- 1.7.6
- [chroot32] # mknod /dev/loop1032 b 7 1032 #assumed loop.max_part=0 (by default) + [chroot32] # mknod /dev/loop1032 b 7 1032 # assumed loop.max_part=0 (by default) [chroot32]
1 space too many? :P
-verbose="n" +verbose=""
same as: verbose= or even better: verbose=0 then you can set verbose=1 later (possibly) and check it with if ((verbose)); then looks good to me, but maybe test a bit first before you push. it would be benificial if the archiso currently in git stays stable for today and maybe tomorrow. after the official release is done, you can break archiso :) Dieter
On 08/18/2011 07:01 AM, Dieter Plaetinck wrote:
- [chroot32] # mknod /dev/loop1032 b 7 1032 #assumed loop.max_part=0 (by default) + [chroot32] # mknod /dev/loop1032 b 7 1032 # assumed loop.max_part=0 (by default) [chroot32] 1 space too many? :P Just style ;)
-verbose="n" +verbose="" same as: verbose= Yes, but looks better visually :P
or even better: verbose=0 then you can set verbose=1 later (possibly) and check it with if ((verbose)); then Maybe :)
looks good to me, but maybe test a bit first before you push. Thanks for the feedback. Sure I need to test it (was a working before going to sleep!).
it would be benificial if the archiso currently in git stays stable for today and maybe tomorrow. after the official release is done, you can break archiso :) OK. Yupiiii! :P
Dieter
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On 08/18/2011 11:10 AM, Gerardo Exequiel Pozzi wrote:
On 08/18/2011 07:01 AM, Dieter Plaetinck wrote:
- [chroot32] # mknod /dev/loop1032 b 7 1032 #assumed loop.max_part=0 (by default) + [chroot32] # mknod /dev/loop1032 b 7 1032 # assumed loop.max_part=0 (by default) [chroot32] 1 space too many? :P Just style ;)
-verbose="n" +verbose="" same as: verbose= Yes, but looks better visually :P
or even better: verbose=0 then you can set verbose=1 later (possibly) and check it with if ((verbose)); then Maybe :)
looks good to me, but maybe test a bit first before you push. Thanks for the feedback. Sure I need to test it (was a working before going to sleep!).
it would be benificial if the archiso currently in git stays stable for today and maybe tomorrow. after the official release is done, you can break archiso :)
OK. Yupiiii! :P
Dieter
Tested with some uncommon values /usr/share/archiso/configs/releng/build.sh -N tino -V garga -L muza -D y -w traba -o jo build single all and /usr/share/archiso/configs/releng/build.sh -N tino -V garga -L muza -D y -w traba -o jo build dual all Worked fine (build/boot) total 2.1G 674M tino-garga-core-dual.iso 370M tino-garga-core-i686.iso 376M tino-garga-core-x86_64.iso 307M tino-garga-netinstall-dual.iso 180M tino-garga-netinstall-i686.iso 183M tino-garga-netinstall-x86_64.iso Two fixes was needed: One for checksum, I was missing passing -D for install_dir (now in master) Other for not using trying to read $3 when not needed (for clean/purge commands) I do other tests, and I will merge in fews hours. -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On Wed, 17 Aug 2011 23:38:55 -0300 Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> wrote:
On 08/15/2011 02:14 PM, Dieter Plaetinck wrote:
On Mon, 15 Aug 2011 01:43:49 -0300 Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> wrote:
On 08/14/2011 08:13 AM, Dieter Plaetinck wrote:
Hi, I would like to run multiple builds per day. For this I would like to also put the hour of building in the iso filenames.
something like:
diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 1aa80fd..7fce685 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -4,7 +4,7 @@ set -e -u
name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +version=$(date +%Y.%m.%d.%H) install_dir=arch arch=$(uname -m) work_dir=work
Or, maybe this is too releng-specific (i.e. most people who run archiso probably prefer $(date +%Y.%m.%d), in which case: can you give archiso a flag so that I can control the version as a parameter?
./build.sh all_iso_single 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14-lets-try-some-new-code
passing it as a flag would also be more robust. Things could go wrong (I think?) if the all_iso_single runs at 23:45 of one day and all_iso_dual runs at 00:15 the next morning. Do not worry about this. You guess about LABEL? Not an issue, LABEL for dual is also generated at build time (not read from "single" work). Also you can have a 201112 and 201201. :P That's the point. If I build multiple isos after each other (like first single isos, then duals) I want all of them to have the same version.
what do you think about via env var? It's possible but I don't like it. If we already have option passing through cmdline args, I think we should pass new options that way too. Also it makes it very clear to the user what you can do (implenting ./build.sh -h which would show all flags with explanation) while you're at it, probably a good idea to use getopt and make verbosity also controllable with a flag. (now my code needs to call sed on your script..)
Dieter
How about this?
usage ./build.sh [options] command <command options>
General options: -N <iso_name> Set an iso filename (prefix) Default: archlinux -V <iso_version> Set an iso version (in filename) Default: 2011.08.17 -L <iso_label> Set an iso label (disk label) Default: ARCH_201108 -D <install_dir> Set an install_dir (directory inside iso) Default: arch -w <work_dir> Set the working directory Default: work -o <out_dir> Set the output directory Default out -v Enable verbose output -h This help message
Commands: build <mode> <type> Build selected .iso by <mode> and <type> purge <mode> Clean working directory except iso/ directory of build <mode> clean <mode> Clean working directory and .iso file in output directory of build <mode>
Command options: <mode> Valid values 'single' or 'dual' <type> Valid values 'net', 'core' or 'all'
looks perfect
On 08/18/2011 06:53 AM, Dieter Plaetinck wrote:
On Wed, 17 Aug 2011 23:38:55 -0300 Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> wrote:
On 08/15/2011 02:14 PM, Dieter Plaetinck wrote:
On Mon, 15 Aug 2011 01:43:49 -0300 Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> wrote:
On 08/14/2011 08:13 AM, Dieter Plaetinck wrote:
Hi, I would like to run multiple builds per day. For this I would like to also put the hour of building in the iso filenames.
something like:
diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 1aa80fd..7fce685 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -4,7 +4,7 @@ set -e -u
name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +version=$(date +%Y.%m.%d.%H) install_dir=arch arch=$(uname -m) work_dir=work
Or, maybe this is too releng-specific (i.e. most people who run archiso probably prefer $(date +%Y.%m.%d), in which case: can you give archiso a flag so that I can control the version as a parameter?
./build.sh all_iso_single 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14-lets-try-some-new-code
passing it as a flag would also be more robust. Things could go wrong (I think?) if the all_iso_single runs at 23:45 of one day and all_iso_dual runs at 00:15 the next morning. Do not worry about this. You guess about LABEL? Not an issue, LABEL for dual is also generated at build time (not read from "single" work). Also you can have a 201112 and 201201. :P That's the point. If I build multiple isos after each other (like first single isos, then duals) I want all of them to have the same version.
what do you think about via env var? It's possible but I don't like it. If we already have option passing through cmdline args, I think we should pass new options that way too. Also it makes it very clear to the user what you can do (implenting ./build.sh -h which would show all flags with explanation) while you're at it, probably a good idea to use getopt and make verbosity also controllable with a flag. (now my code needs to call sed on your script..)
Dieter
How about this?
usage ./build.sh [options] command<command options>
General options: -N<iso_name> Set an iso filename (prefix) Default: archlinux -V<iso_version> Set an iso version (in filename) Default: 2011.08.17 -L<iso_label> Set an iso label (disk label) Default: ARCH_201108 -D<install_dir> Set an install_dir (directory inside iso) Default: arch -w<work_dir> Set the working directory Default: work -o<out_dir> Set the output directory Default out -v Enable verbose output -h This help message
Commands: build<mode> <type> Build selected .iso by<mode> and<type> purge<mode> Clean working directory except iso/ directory of build<mode> clean<mode> Clean working directory and .iso file in output directory of build<mode>
Command options: <mode> Valid values 'single' or 'dual' <type> Valid values 'net', 'core' or 'all'
looks perfect
Do you want this merged before next official snapshot? Take care that this break current releng script, should be adapted to newer commands. ./build.sh all_iso_single -> ./build.sh build single all ./build.sh all_iso_dual -> ./build.sh build dual all ./build.sh clear_dual -> ./build.sh clear dual ./build.sh purge_single -> ./build.sh purge single etc... Also iso images are now placed in "out" by default (without -o) instead of ".", doing this more organized. You may want to use newer -L and -V ;) -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On Thu, 18 Aug 2011 19:14:22 -0300 Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> wrote:
On 08/18/2011 06:53 AM, Dieter Plaetinck wrote:
On Wed, 17 Aug 2011 23:38:55 -0300 Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> wrote:
On 08/15/2011 02:14 PM, Dieter Plaetinck wrote:
On Mon, 15 Aug 2011 01:43:49 -0300 Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> wrote:
On 08/14/2011 08:13 AM, Dieter Plaetinck wrote:
Hi, I would like to run multiple builds per day. For this I would like to also put the hour of building in the iso filenames.
something like:
diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 1aa80fd..7fce685 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -4,7 +4,7 @@ set -e -u
name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +version=$(date +%Y.%m.%d.%H) install_dir=arch arch=$(uname -m) work_dir=work
Or, maybe this is too releng-specific (i.e. most people who run archiso probably prefer $(date +%Y.%m.%d), in which case: can you give archiso a flag so that I can control the version as a parameter?
./build.sh all_iso_single 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14.12 ./build.sh all_iso_dual 2011.08.14-lets-try-some-new-code
passing it as a flag would also be more robust. Things could go wrong (I think?) if the all_iso_single runs at 23:45 of one day and all_iso_dual runs at 00:15 the next morning. Do not worry about this. You guess about LABEL? Not an issue, LABEL for dual is also generated at build time (not read from "single" work). Also you can have a 201112 and 201201. :P That's the point. If I build multiple isos after each other (like first single isos, then duals) I want all of them to have the same version.
what do you think about via env var? It's possible but I don't like it. If we already have option passing through cmdline args, I think we should pass new options that way too. Also it makes it very clear to the user what you can do (implenting ./build.sh -h which would show all flags with explanation) while you're at it, probably a good idea to use getopt and make verbosity also controllable with a flag. (now my code needs to call sed on your script..)
Dieter
How about this?
usage ./build.sh [options] command<command options>
General options: -N<iso_name> Set an iso filename (prefix) Default: archlinux -V<iso_version> Set an iso version (in filename) Default: 2011.08.17 -L<iso_label> Set an iso label (disk label) Default: ARCH_201108 -D<install_dir> Set an install_dir (directory inside iso) Default: arch -w<work_dir> Set the working directory Default: work -o<out_dir> Set the output directory Default out -v Enable verbose output -h This help message
Commands: build<mode> <type> Build selected .iso by<mode> and<type> purge<mode> Clean working directory except iso/ directory of build<mode> clean<mode> Clean working directory and .iso file in output directory of build<mode>
Command options: <mode> Valid values 'single' or 'dual' <type> Valid values 'net', 'core' or 'all'
looks perfect
Do you want this merged before next official snapshot?
Take care that this break current releng script, should be adapted to newer commands.
./build.sh all_iso_single -> ./build.sh build single all ./build.sh all_iso_dual -> ./build.sh build dual all ./build.sh clear_dual -> ./build.sh clear dual ./build.sh purge_single -> ./build.sh purge single etc...
Also iso images are now placed in "out" by default (without -o) instead of ".", doing this more organized.
You may want to use newer -L and -V ;)
if you're sure it works okay, then yes you can push it. otherwise i'ld rather stick with what works. Dieter
On Thu, 18 Aug 2011 19:14:22 -0300 Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> wrote:
On 08/18/2011 06:53 AM, Dieter Plaetinck wrote:
On Wed, 17 Aug 2011 23:38:55 -0300 Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> wrote:
On 08/15/2011 02:14 PM, Dieter Plaetinck wrote:
On Mon, 15 Aug 2011 01:43:49 -0300 Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> wrote:
On 08/14/2011 08:13 AM, Dieter Plaetinck wrote: > Hi, > I would like to run multiple builds per day. For this I would > like to also put the hour of building in the iso filenames. > > > something like: > > diff --git a/configs/releng/build.sh b/configs/releng/build.sh > index 1aa80fd..7fce685 100755 > --- a/configs/releng/build.sh > +++ b/configs/releng/build.sh > @@ -4,7 +4,7 @@ set -e -u > > name=archlinux > iso_label="ARCH_$(date +%Y%m)" > -version=$(date +%Y.%m.%d) > +version=$(date +%Y.%m.%d.%H) > install_dir=arch > arch=$(uname -m) > work_dir=work > > > > Or, maybe this is too releng-specific (i.e. most people who run > archiso probably prefer $(date +%Y.%m.%d), in which case: can > you give archiso a flag so that I can control the version as a > parameter? > > ./build.sh all_iso_single 2011.08.14.12 > ./build.sh all_iso_dual 2011.08.14.12 > ./build.sh all_iso_dual 2011.08.14-lets-try-some-new-code > > passing it as a flag would also be more robust. Things could go > wrong (I think?) if the all_iso_single runs at 23:45 of one day > and all_iso_dual runs at 00:15 the next morning. Do not worry about this. You guess about LABEL? Not an issue, LABEL for dual is also generated at build time (not read from "single" work). Also you can have a 201112 and 201201. :P That's the point. If I build multiple isos after each other (like first single isos, then duals) I want all of them to have the same version.
what do you think about via env var? It's possible but I don't like it. If we already have option passing through cmdline args, I think we should pass new options that way too. Also it makes it very clear to the user what you can do (implenting ./build.sh -h which would show all flags with explanation) while you're at it, probably a good idea to use getopt and make verbosity also controllable with a flag. (now my code needs to call sed on your script..)
Dieter
How about this?
usage ./build.sh [options] command<command options>
General options: -N<iso_name> Set an iso filename (prefix) Default: archlinux -V<iso_version> Set an iso version (in filename) Default: 2011.08.17 -L<iso_label> Set an iso label (disk label) Default: ARCH_201108 -D<install_dir> Set an install_dir (directory inside iso) Default: arch -w<work_dir> Set the working directory Default: work -o<out_dir> Set the output directory Default out -v Enable verbose output -h This help message
Commands: build<mode> <type> Build selected .iso by<mode> and<type> purge<mode> Clean working directory except iso/ directory of build<mode> clean<mode> Clean working directory and .iso file in output directory of build<mode>
Command options: <mode> Valid values 'single' or 'dual' <type> Valid values 'net', 'core' or 'all'
looks perfect
Do you want this merged before next official snapshot?
Take care that this break current releng script, should be adapted to newer commands.
./build.sh all_iso_single -> ./build.sh build single all ./build.sh all_iso_dual -> ./build.sh build dual all ./build.sh clear_dual -> ./build.sh clear dual ./build.sh purge_single -> ./build.sh purge single etc...
Also iso images are now placed in "out" by default (without -o) instead of ".", doing this more organized.
You may want to use newer -L and -V ;)
if you're sure it works okay, then yes you can push it. otherwise i'ld rather stick with what works. Yes its works, I done some other tests, using absolute paths for work
On 08/19/2011 04:35 AM, Dieter Plaetinck wrote: dir and out dir, builds and boot fine: "/usr/share/archiso/configs/releng/build.sh -N armin -V van -L buuren -D trance -w /tmp/laburo -o /tmp/salida build single all" Please prepare releng scripts for this change, I do not want to break it again. Send me an email when its ready ;)
Dieter
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
participants (2)
-
Dieter Plaetinck
-
Gerardo Exequiel Pozzi