[archiso] Use -w <work_dir> instead of cmd <work>, add -o <out_dir>
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>
This commit is contained in:
parent
14903dfc45
commit
ad2385c082
@ -11,6 +11,8 @@ export iso_label="ARCH_$(date +%Y%m)"
|
|||||||
iso_publisher="Arch Linux <http://www.archlinux.org>"
|
iso_publisher="Arch Linux <http://www.archlinux.org>"
|
||||||
iso_application="Arch Linux Live/Rescue CD"
|
iso_application="Arch Linux Live/Rescue CD"
|
||||||
install_dir="arch"
|
install_dir="arch"
|
||||||
|
work_dir="work"
|
||||||
|
out_dir="out"
|
||||||
|
|
||||||
# Show an INFO message
|
# Show an INFO message
|
||||||
# $1: message string
|
# $1: message string
|
||||||
@ -104,17 +106,21 @@ _usage ()
|
|||||||
echo " -D <install_dir> Set an install_dir. All files will by located here."
|
echo " -D <install_dir> Set an install_dir. All files will by located here."
|
||||||
echo " Default ${install_dir}"
|
echo " Default ${install_dir}"
|
||||||
echo " NOTE: Max 8 characters, use only [a-z0-9]"
|
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 " -v Enable verbose output"
|
||||||
echo " -h This message"
|
echo " -h This message"
|
||||||
echo " commands:"
|
echo " commands:"
|
||||||
echo " create <dir>"
|
echo " create"
|
||||||
echo " create a base directory layout to work with"
|
echo " create a base directory layout to work with"
|
||||||
echo " includes all specified packages"
|
echo " includes all specified packages"
|
||||||
echo " prepare <dir>"
|
echo " prepare"
|
||||||
echo " build all images"
|
echo " build all images"
|
||||||
echo " checksum <dir>"
|
echo " checksum"
|
||||||
echo " make a checksum.md5 for self-test"
|
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"
|
echo " build an iso image from the working dir"
|
||||||
exit ${1}
|
exit ${1}
|
||||||
}
|
}
|
||||||
@ -310,7 +316,8 @@ command_iso () {
|
|||||||
|
|
||||||
_show_config iso
|
_show_config iso
|
||||||
|
|
||||||
if _is_directory_changed "${work_dir}/iso" "${img_name}"; then
|
if _is_directory_changed "${work_dir}/iso" "${out_dir}/${img_name}"; then
|
||||||
|
mkdir -p ${out_dir}
|
||||||
_msg_info "Creating ISO image..."
|
_msg_info "Creating ISO image..."
|
||||||
local _qflag=""
|
local _qflag=""
|
||||||
if [[ ${quiet} == "y" ]]; then
|
if [[ ${quiet} == "y" ]]; then
|
||||||
@ -325,9 +332,9 @@ command_iso () {
|
|||||||
-publisher "${iso_publisher}" \
|
-publisher "${iso_publisher}" \
|
||||||
-A "${iso_application}" \
|
-A "${iso_application}" \
|
||||||
-V "${iso_label}" \
|
-V "${iso_label}" \
|
||||||
-o "${img_name}" "${work_dir}/iso/"
|
-o "${out_dir}/${img_name}" "${work_dir}/iso/"
|
||||||
isohybrid "${img_name}"
|
isohybrid "${out_dir}/${img_name}"
|
||||||
_msg_info "Done! | $(ls -sh ${img_name})"
|
_msg_info "Done! | $(ls -sh ${out_dir}/${img_name})"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,7 +413,7 @@ if [[ ${EUID} -ne 0 ]]; then
|
|||||||
_msg_error "This script must be run as root." 1
|
_msg_error "This script must be run as root." 1
|
||||||
fi
|
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
|
case "${arg}" in
|
||||||
p) pkg_list="${pkg_list} ${OPTARG}" ;;
|
p) pkg_list="${pkg_list} ${OPTARG}" ;;
|
||||||
C) pacman_conf="${OPTARG}" ;;
|
C) pacman_conf="${OPTARG}" ;;
|
||||||
@ -414,6 +421,8 @@ while getopts 'p:C:L:P:A:D:fvh' arg; do
|
|||||||
P) iso_publisher="${OPTARG}" ;;
|
P) iso_publisher="${OPTARG}" ;;
|
||||||
A) iso_application="${OPTARG}" ;;
|
A) iso_application="${OPTARG}" ;;
|
||||||
D) install_dir="${OPTARG}" ;;
|
D) install_dir="${OPTARG}" ;;
|
||||||
|
w) work_dir="${OPTARG}" ;;
|
||||||
|
o) out_dir="${OPTARG}" ;;
|
||||||
v) quiet="n" ;;
|
v) quiet="n" ;;
|
||||||
h|?) _usage 0 ;;
|
h|?) _usage 0 ;;
|
||||||
*)
|
*)
|
||||||
@ -431,12 +440,6 @@ if [[ $# -lt 1 ]]; then
|
|||||||
fi
|
fi
|
||||||
command_name="${1}"
|
command_name="${1}"
|
||||||
|
|
||||||
if [[ $# -lt 2 ]]; then
|
|
||||||
_msg_error "No working directory specified" 0
|
|
||||||
_usage 1
|
|
||||||
fi
|
|
||||||
work_dir="${2}"
|
|
||||||
|
|
||||||
case "${command_name}" in
|
case "${command_name}" in
|
||||||
create)
|
create)
|
||||||
command_create
|
command_create
|
||||||
@ -448,11 +451,11 @@ case "${command_name}" in
|
|||||||
command_checksum
|
command_checksum
|
||||||
;;
|
;;
|
||||||
iso)
|
iso)
|
||||||
if [[ $# -lt 3 ]]; then
|
if [[ $# -lt 2 ]]; then
|
||||||
_msg_error "No image specified" 0
|
_msg_error "No image specified" 0
|
||||||
_usage 1
|
_usage 1
|
||||||
fi
|
fi
|
||||||
img_name="${3}"
|
img_name="${2}"
|
||||||
command_iso
|
command_iso
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -8,14 +8,15 @@ iso_version=$(date +%Y.%m.%d)
|
|||||||
install_dir=arch
|
install_dir=arch
|
||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
work_dir=work
|
work_dir=work
|
||||||
|
out_dir=out
|
||||||
verbose="n"
|
verbose="n"
|
||||||
|
|
||||||
script_path=$(readlink -f ${0%/*})
|
script_path=$(readlink -f ${0%/*})
|
||||||
|
|
||||||
# Base installation (root-image)
|
# Base installation (root-image)
|
||||||
make_basefs() {
|
make_basefs() {
|
||||||
mkarchiso ${verbose} -D "${install_dir}" -p "base" create "${work_dir}"
|
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "base" create
|
||||||
mkarchiso ${verbose} -D "${install_dir}" -p "syslinux" create "${work_dir}"
|
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "syslinux" create
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copy mkinitcpio archiso hooks (root-image)
|
# Copy mkinitcpio archiso hooks (root-image)
|
||||||
@ -73,13 +74,13 @@ make_aitab() {
|
|||||||
|
|
||||||
# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs)
|
# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs)
|
||||||
make_prepare() {
|
make_prepare() {
|
||||||
mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}"
|
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build ISO
|
# Build ISO
|
||||||
make_iso() {
|
make_iso() {
|
||||||
mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}"
|
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum
|
||||||
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}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${arch}.iso"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $verbose == "y" ]]; then
|
if [[ $verbose == "y" ]]; then
|
||||||
|
@ -8,19 +8,20 @@ iso_version=$(date +%Y.%m.%d)
|
|||||||
install_dir=arch
|
install_dir=arch
|
||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
work_dir=work
|
work_dir=work
|
||||||
|
out_dir=out
|
||||||
verbose="n"
|
verbose="n"
|
||||||
|
|
||||||
script_path=$(readlink -f ${0%/*})
|
script_path=$(readlink -f ${0%/*})
|
||||||
|
|
||||||
# Base installation (root-image)
|
# Base installation (root-image)
|
||||||
make_basefs() {
|
make_basefs() {
|
||||||
mkarchiso ${verbose} -D "${install_dir}" -p "base" create "${work_dir}"
|
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "base" create
|
||||||
mkarchiso ${verbose} -D "${install_dir}" -p "memtest86+ syslinux mkinitcpio-nfs-utils nbd" create "${work_dir}"
|
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "memtest86+ syslinux mkinitcpio-nfs-utils nbd" create
|
||||||
}
|
}
|
||||||
|
|
||||||
# Additional packages (root-image)
|
# Additional packages (root-image)
|
||||||
make_packages() {
|
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)
|
# Customize installation (root-image)
|
||||||
@ -156,15 +157,15 @@ make_aitab() {
|
|||||||
|
|
||||||
# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs)
|
# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs)
|
||||||
make_prepare() {
|
make_prepare() {
|
||||||
mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}"
|
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build ISO
|
# Build ISO
|
||||||
# args: $1 (core | netinstall)
|
# args: $1 (core | netinstall)
|
||||||
make_iso() {
|
make_iso() {
|
||||||
local _iso_type=${1}
|
local _iso_type=${1}
|
||||||
mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}"
|
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum
|
||||||
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}" -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
|
# Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso
|
||||||
@ -207,8 +208,8 @@ make_dual() {
|
|||||||
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
||||||
s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/}
|
s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/}
|
||||||
done
|
done
|
||||||
mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}/dual"
|
mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" checksum
|
||||||
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}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${_iso_type}-dual.iso"
|
||||||
: > ${work_dir}/dual/build.${FUNCNAME}_${_iso_type}
|
: > ${work_dir}/dual/build.${FUNCNAME}_${_iso_type}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -298,11 +299,11 @@ case "${command_name}" in
|
|||||||
;;
|
;;
|
||||||
clean_single)
|
clean_single)
|
||||||
rm -rf ${work_dir}
|
rm -rf ${work_dir}
|
||||||
rm -f ${iso_name}-${iso_version}-*-${arch}.iso
|
rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso
|
||||||
;;
|
;;
|
||||||
clean_dual)
|
clean_dual)
|
||||||
rm -rf ${work_dir}/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}'"
|
echo "Invalid command name '${command_name}'"
|
||||||
|
Loading…
Reference in New Issue
Block a user