[configs/releng] Support configurable build options via command line
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>
This commit is contained in:
parent
ad2385c082
commit
48023e336b
15
README
15
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.
|
* Enter 32 bits chroot enviroment then build core and netinstall single images.
|
||||||
|
|
||||||
[chroot32] # linux32 mkarchroot -r bash /tmp/chroot32
|
[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] # cp -r /usr/share/archiso/configs/releng /tmp
|
||||||
[chroot32] # cd /tmp/releng
|
[chroot32] # cd /tmp/releng
|
||||||
[chroot32] # ./build.sh all_iso_single
|
[chroot32] # ./build.sh build single all
|
||||||
[chroot32] # ./build.sh purge_single #optional
|
[chroot32] # ./build.sh purge single # optional step
|
||||||
|
|
||||||
* Enter 64 bits chroot enviroment then build core and netinstall single images.
|
* Enter 64 bits chroot enviroment then build core and netinstall single images.
|
||||||
|
|
||||||
[chroot64] # mkarchroot -r bash /tmp/chroot64
|
[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] # cp -r /usr/share/archiso/configs/releng /tmp
|
||||||
[chroot64] # cd /tmp/releng
|
[chroot64] # cd /tmp/releng
|
||||||
[chroot64] # ./build.sh all_iso_single
|
[chroot64] # ./build.sh build single all
|
||||||
[chroot64] # ./build.sh purge_single #optional
|
[chroot64] # ./build.sh purge single # optional step
|
||||||
|
|
||||||
* Build core and netinstall dual images from any of the chroot enviroments.
|
* Build core and netinstall dual images from any of the chroot enviroments.
|
||||||
|
|
||||||
[host64] # mkarchroot -r bash /tmp/chroot64
|
[host64] # mkarchroot -r bash /tmp/chroot64
|
||||||
[chroot64] # cd /tmp/releng
|
[chroot64] # cd /tmp/releng
|
||||||
[chroot64] # ./build.sh all_iso_dual
|
[chroot64] # ./build.sh build dual all
|
||||||
|
[chroot64] # ./build.sh purge dual # optional step
|
||||||
|
@ -9,7 +9,7 @@ install_dir=arch
|
|||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
work_dir=work
|
work_dir=work
|
||||||
out_dir=out
|
out_dir=out
|
||||||
verbose="n"
|
verbose=""
|
||||||
|
|
||||||
script_path=$(readlink -f ${0%/*})
|
script_path=$(readlink -f ${0%/*})
|
||||||
|
|
||||||
@ -214,36 +214,35 @@ make_dual() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
purge_single ()
|
||||||
|
|
||||||
_usage ()
|
|
||||||
{
|
{
|
||||||
echo "usage ${0##*/} net_iso_single | core_iso_single | all_iso_single | purge_single | clean_single"
|
if [[ -d ${work_dir} ]]; then
|
||||||
echo " net_iso_dual | core_iso_dual | all_iso_dual | purge_dual | clean_dual"
|
find ${work_dir} -mindepth 1 -maxdepth 1 \
|
||||||
echo
|
! -path ${work_dir}/iso -prune \
|
||||||
exit ${1}
|
| xargs rm -rf
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ ${EUID} -ne 0 ]]; then
|
purge_dual ()
|
||||||
echo "This script must be run as root."
|
{
|
||||||
_usage 1
|
if [[ -d ${work_dir}/dual ]]; then
|
||||||
fi
|
find ${work_dir}/dual -mindepth 1 -maxdepth 1 \
|
||||||
|
! -path ${work_dir}/dual/iso -prune \
|
||||||
|
| xargs rm -rf
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $# -lt 1 ]]; then
|
clean_single ()
|
||||||
echo "No command specified"
|
{
|
||||||
_usage 1
|
rm -rf ${work_dir}
|
||||||
fi
|
rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso
|
||||||
command_name="${1}"
|
}
|
||||||
|
|
||||||
if [[ ${verbose} == "y" ]]; then
|
clean_dual ()
|
||||||
verbose="-v"
|
{
|
||||||
else
|
rm -rf ${work_dir}/dual
|
||||||
verbose=""
|
rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso
|
||||||
fi
|
}
|
||||||
|
|
||||||
if [[ ${command_name} =~ single ]]; then
|
|
||||||
work_dir=${work_dir}/${arch}
|
|
||||||
fi
|
|
||||||
|
|
||||||
make_common_single() {
|
make_common_single() {
|
||||||
make_basefs
|
make_basefs
|
||||||
@ -260,50 +259,162 @@ make_common_single() {
|
|||||||
make_iso $1
|
make_iso $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_usage ()
|
||||||
|
{
|
||||||
|
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}
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ ${EUID} -ne 0 ]]; then
|
||||||
|
echo "This script must be run as root."
|
||||||
|
_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 [[ $# -lt 2 ]]; then
|
||||||
|
echo "No command mode specified"
|
||||||
|
_usage 1
|
||||||
|
fi
|
||||||
|
command_mode="${2}"
|
||||||
|
|
||||||
|
if [[ ${command_name} == "build" ]]; then
|
||||||
|
if [[ $# -lt 3 ]]; then
|
||||||
|
echo "No build type specified"
|
||||||
|
_usage 1
|
||||||
|
fi
|
||||||
|
command_type="${3}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${command_mode} == "single" ]]; then
|
||||||
|
work_dir=${work_dir}/${arch}
|
||||||
|
fi
|
||||||
|
|
||||||
case "${command_name}" in
|
case "${command_name}" in
|
||||||
net_iso_single)
|
build)
|
||||||
make_common_single netinstall
|
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
|
||||||
;;
|
;;
|
||||||
core_iso_single)
|
purge)
|
||||||
make_core_repo
|
case "${command_mode}" in
|
||||||
make_common_single core
|
single)
|
||||||
|
purge_single
|
||||||
|
;;
|
||||||
|
dual)
|
||||||
|
purge_dual
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid purge mode '${command_mode}'"
|
||||||
|
_usage 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
all_iso_single)
|
clean)
|
||||||
make_common_single netinstall
|
case "${command_mode}" in
|
||||||
make_core_repo
|
single)
|
||||||
make_common_single core
|
clean_single
|
||||||
;;
|
;;
|
||||||
net_iso_dual)
|
dual)
|
||||||
make_dual netinstall
|
clean_dual
|
||||||
;;
|
;;
|
||||||
core_iso_dual)
|
*)
|
||||||
make_dual core
|
echo "Invalid clean mode '${command_mode}'"
|
||||||
;;
|
_usage 1
|
||||||
all_iso_dual)
|
;;
|
||||||
make_dual netinstall
|
esac
|
||||||
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
|
|
||||||
;;
|
|
||||||
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
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Invalid command name '${command_name}'"
|
echo "Invalid command name '${command_name}'"
|
||||||
|
Loading…
Reference in New Issue
Block a user