summaryrefslogtreecommitdiff
path: root/configs/profile
diff options
context:
space:
mode:
Diffstat (limited to 'configs/profile')
-rwxr-xr-xconfigs/profile/build.sh87
1 files changed, 69 insertions, 18 deletions
diff --git a/configs/profile/build.sh b/configs/profile/build.sh
index bffb518..959c9eb 100755
--- a/configs/profile/build.sh
+++ b/configs/profile/build.sh
@@ -7,12 +7,13 @@ iso_edition="SystemD/CLI"
iso_title="Parabola GNU/Linux-libre Live - ${iso_edition} Edition" # $iso_version appended
# CLI option defaults
+archs='i686 x86_64'
+iso_arch='dual'
iso_version=$(date +%Y.%m.%d)
iso_label="PARA_$(date +%Y%m)"
iso_dirname='parabola'
work_dir=./work
out_dir=./out
-arch=$(uname -m)
target=''
verbose=''
efi_img_kbytes=40000
@@ -31,6 +32,8 @@ _usage ()
echo "usage ${0} [options]"
echo
echo " General options:"
+ echo " -T <iso_arch> Target architecture (one of 'i686', 'x86_64', or 'dual')"
+ echo " Default: ${iso_arch}"
echo " -V <iso_version> Set the iso version in the filename"
echo " Default: ${iso_version}"
echo " -L <iso_label> Set the iso volume label"
@@ -129,6 +132,13 @@ make_syslinux() {
# inject edition title
sed -i "s|_EDITION_TITLE_|${iso_title}|" ${work_dir}/iso/${iso_dirname}/boot/syslinux/parabolaiso_head.cfg
+
+ # prune orphan boot entries for single-architecture ISO
+ if [[ "${archs}" == 'i686' ]]; then
+ rm ${work_dir}/iso/${iso_dirname}/boot/syslinux/parabolaiso_*64*.cfg
+ elif [[ "${archs}" == 'x86_64' ]]; then
+ rm ${work_dir}/iso/${iso_dirname}/boot/syslinux/parabolaiso_*32*.cfg
+ fi
}
# Prepare /isolinux
@@ -236,8 +246,9 @@ make_iso() {
# set CLI options
-while getopts 'V:L:D:w:o:vh' arg; do
+while getopts 'T:V:L:D:w:o:vh' arg; do
case "${arg}" in
+ T) target="${OPTARG}" ;;
V) iso_version="${OPTARG}" ;;
L) iso_label="${OPTARG}" ;;
D) iso_dirname="${OPTARG}" ;;
@@ -252,9 +263,37 @@ while getopts 'V:L:D:w:o:vh' arg; do
esac
done
+# set target arch, GRUB title, and ISO filename
+case "${target}" in
+ 'i686'|'x86_64')
+ archs=${target}
+ iso_arch=${target}
+ launch_msg="Building single-architecture ${iso_edition} ISO for ${target}"
+ ;;
+ *)
+ launch_msg="Building dual-architecture ${iso_edition} ISO for i686 and x86_64"
+ ;;
+esac
+if [ "$enable_offline_install" == 'true' ]; then
+ iso_arch="${iso_arch}-complete"
+ launch_msg="${launch_msg} with offline install enabled"
+else
+ iso_arch="${iso_arch}-netinstall"
+fi
+[ "${archs}" == 'i686' ] && arch='i686' || arch='x86_64'
+iso_filename="parabola-${iso_edition}-${iso_arch}-${iso_version}.iso"
+iso_title="${iso_title} ${iso_version}"
+
## sanity checks ##
+# sanitize paths
+iso_label=${iso_label// /}
+iso_dirname=${iso_dirname// /}
+work_dir=${work_dir// /}
+out_dir=${out_dir// /}
+pacman_conf=${pacman_conf// /}
+
# validate build environment
if [[ "$(uname -m)" != 'x86_64' ]] || ! grep 'ID_LIKE=.*archlinux' /usr/lib/os-release > /dev/null; then
echo "This script needs to be run on an x86_64 ArchLinux derrivative."
@@ -270,14 +309,20 @@ elif ! pacman -Qi parabolaiso-data > /dev/null; then
exit 1
fi
-# sanitize paths
-iso_label=${iso_label// /}
-iso_dirname=${iso_dirname// /}
-work_dir=${work_dir// /}
-out_dir=${out_dir// /}
-pacman_conf=${pacman_conf// /}
-iso_title="${iso_title} ${iso_version}"
-iso_filename="parabola-${iso_edition}-${iso_type}-${iso_version}.iso"
+# detect previously completed build
+prefix=${work_dir}/build.make_
+is_done=1
+[ ! -f ${prefix}pacman_conf_${arch} -o ! -f ${prefix}boot_extra_${arch} -o \
+ ! -f ${prefix}syslinux_${arch} -o ! -f ${prefix}isolinux_${arch} -o \
+ ! -f ${prefix}aitab_${arch} -o ! -f ${prefix}iso_${arch} ] && \
+ is_done=0
+for arch in ${archs}; do
+ [ ! -f ${prefix}basefs_${arch} -o ! -f ${prefix}packages_${arch} -o \
+ ! -f ${prefix}setup_mkinitcpio_${arch} -o ! -f ${prefix}customize_root_image_${arch} -o \
+ ! -f ${prefix}boot_${arch} -o ! -f ${prefix}prepare_${arch} ] && \
+ is_done=0
+done
+if ! (($is_done)); then echo ${launch_msg}; else echo "Nothing to do"; exit; fi;
## build ISO ##
@@ -287,29 +332,35 @@ mkdir -p ${work_dir}
run_once make_pacman_conf
-# Do all stuff for each root-image
-for arch in i686 x86_64; do
+# prepare target filesystems
+for arch in ${archs}; do
run_once make_basefs
run_once make_packages
run_once make_setup_mkinitcpio
run_once make_customize_root_image
done
-for arch in i686 x86_64; do
+# prepare kernels and initrds
+for arch in ${archs}; do
run_once make_boot
done
-# Do all stuff for "iso"
+# prepare ISO
run_once make_boot_extra
run_once make_syslinux
run_once make_isolinux
-run_once make_efi
-run_once make_efiboot
-run_once make_aitab
+# prepare EFI
+if [[ "`echo ${archs} | grep x86_64`" ]]; then
+ run_once make_efi
+ run_once make_efiboot
+fi
-for arch in i686 x86_64; do
+# prepare SFSs
+run_once make_aitab
+for arch in ${archs}; do
run_once make_prepare
done
+# build ISO
run_once make_iso