ISO/configs/baseline/build.sh
Gerardo Exequiel Pozzi ad2385c082 [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>
2011-08-29 01:45:49 -03:00

100 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
set -e -u
iso_name=archlinux
iso_label="ARCH_$(date +%Y%m)"
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} -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)
make_setup_mkinitcpio() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
cp /lib/initcpio/hooks/archiso ${work_dir}/root-image/lib/initcpio/hooks
cp /lib/initcpio/install/archiso ${work_dir}/root-image/lib/initcpio/install
: > ${work_dir}/build.${FUNCNAME}
fi
}
# Prepare ${install_dir}/boot/
make_boot() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch}
mkinitcpio \
-c ${script_path}/mkinitcpio.conf \
-b ${work_dir}/root-image \
-k /boot/vmlinuz-linux \
-g ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img
cp ${work_dir}/root-image/boot/vmlinuz-linux ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz
: > ${work_dir}/build.${FUNCNAME}
fi
}
# Prepare /${install_dir}/boot/syslinux
make_syslinux() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
s|%INSTALL_DIR%|${install_dir}|g;
s|%ARCH%|${arch}|g" ${script_path}/syslinux/syslinux.cfg > ${work_dir}/iso/${install_dir}/boot/syslinux/syslinux.cfg
cp ${work_dir}/root-image/usr/lib/syslinux/menu.c32 ${work_dir}/iso/${install_dir}/boot/syslinux/
: > ${work_dir}/build.${FUNCNAME}
fi
}
# Prepare /isolinux
make_isolinux() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
mkdir -p ${work_dir}/iso/isolinux
sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg
cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/
: > ${work_dir}/build.${FUNCNAME}
fi
}
# Process aitab
make_aitab() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
sed "s|%ARCH%|${arch}|g" ${script_path}/aitab > ${work_dir}/iso/${install_dir}/aitab
: > ${work_dir}/build.${FUNCNAME}
fi
}
# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs)
make_prepare() {
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare
}
# Build ISO
make_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
verbose="-v"
else
verbose=""
fi
make_basefs
make_setup_mkinitcpio
make_boot
make_syslinux
make_isolinux
make_aitab
make_prepare
make_iso