summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2013-01-02 20:38:59 -0300
committerGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2013-01-02 20:38:59 -0300
commit845bf0f2d2b500389c74ff5ffbc030fe500a4413 (patch)
treede8c7cc0816b2ea659fa95fcf67454517d420648
parent58bcf480918e64458c7c58b2856aee79d43bbb4c (diff)
downloadarchiso32-845bf0f2d2b500389c74ff5ffbc030fe500a4413.tar.xz
[configs/baseline] Rework build.sh add run_once() like in releng profile and other misc things
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
-rwxr-xr-xconfigs/baseline/build.sh94
1 files changed, 39 insertions, 55 deletions
diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh
index f7f7abf..b8ad943 100755
--- a/configs/baseline/build.sh
+++ b/configs/baseline/build.sh
@@ -9,91 +9,75 @@ install_dir=arch
arch=$(uname -m)
work_dir=work
out_dir=out
-verbose="n"
script_path=$(readlink -f ${0%/*})
+# Helper function to run make_*() only one time per architecture.
+run_once() {
+ if [[ ! -e ${work_dir}/build.${1}_${arch} ]]; then
+ $1
+ touch ${work_dir}/build.${1}_${arch}
+ fi
+}
+
# Base installation (root-image)
make_basefs() {
- mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" init
+ mkarchiso -v -w "${work_dir}" -D "${install_dir}" init
}
-# Copy mkinitcpio archiso hooks (root-image)
+# Copy mkinitcpio archiso hooks and build initramfs (root-image)
make_setup_mkinitcpio() {
- if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
- cp /usr/lib/initcpio/hooks/archiso ${work_dir}/root-image/usr/lib/initcpio/hooks
- cp /usr/lib/initcpio/install/archiso ${work_dir}/root-image/usr/lib/initcpio/install
- cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf
- : > ${work_dir}/build.${FUNCNAME}
- fi
+ cp /usr/lib/initcpio/hooks/archiso ${work_dir}/root-image/usr/lib/initcpio/hooks
+ cp /usr/lib/initcpio/install/archiso ${work_dir}/root-image/usr/lib/initcpio/install
+ cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf
+ mkarchiso -v -w "${work_dir}" -D "${install_dir}" -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' run
}
# Prepare ${install_dir}/boot/
make_boot() {
- if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
- mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch}
- mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" \
- -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' \
- run
- cp ${work_dir}/root-image/boot/archiso.img ${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
+ mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch}
+ cp ${work_dir}/root-image/boot/archiso.img ${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
}
# 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
+ 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/
}
# 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/
- cp ${work_dir}/root-image/usr/lib/syslinux/isohdpfx.bin ${work_dir}/iso/isolinux/
- : > ${work_dir}/build.${FUNCNAME}
- fi
+ 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/
+ cp ${work_dir}/root-image/usr/lib/syslinux/isohdpfx.bin ${work_dir}/iso/isolinux/
}
# 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
+ sed "s|%ARCH%|${arch}|g" ${script_path}/aitab > ${work_dir}/iso/${install_dir}/aitab
}
-# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs)
+# Build all filesystem images specified in aitab (.fs.sfs .sfs)
make_prepare() {
- mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare
+ mkarchiso -v -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"
+ mkarchiso -v -w "${work_dir}" -D "${install_dir}" checksum
+ mkarchiso -v -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
+run_once make_basefs
+run_once make_setup_mkinitcpio
+run_once make_boot
+run_once make_syslinux
+run_once make_isolinux
+run_once make_aitab
+run_once make_prepare
+run_once make_iso