summaryrefslogtreecommitdiff
path: root/configs/profile/build.sh
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2017-10-16 23:40:09 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2017-11-19 21:46:10 -0500
commitaffa6e70a9da9b4538f85141e604e2189a175e0a (patch)
tree84f10d17cba8754d0a51e87238f4ed6c7684c587 /configs/profile/build.sh
parent67b8fed42a077ac1e7025d742230b9083c4b12a9 (diff)
enable offline install
Diffstat (limited to 'configs/profile/build.sh')
-rwxr-xr-xconfigs/profile/build.sh39
1 files changed, 27 insertions, 12 deletions
diff --git a/configs/profile/build.sh b/configs/profile/build.sh
index 959c9eb..fe2bdfb 100755
--- a/configs/profile/build.sh
+++ b/configs/profile/build.sh
@@ -12,6 +12,7 @@ iso_arch='dual'
iso_version=$(date +%Y.%m.%d)
iso_label="PARA_$(date +%Y%m)"
iso_dirname='parabola'
+enable_offline_install='false'
work_dir=./work
out_dir=./out
target=''
@@ -40,6 +41,8 @@ _usage ()
echo " Default: ${iso_label}"
echo " -D <iso_dirname> Set the name of the directory inside the ISO"
echo " Default: ${iso_dirname}"
+ echo " -O Enable offline install."
+ echo " Default: '${enable_offline_install}'"
echo " -w <work_dir> Set the working directory"
echo " Default: ${work_dir}"
echo " -o <out_dir> Set the output directory"
@@ -60,9 +63,7 @@ run_once() {
# Setup custom pacman.conf with current cache directories.
make_pacman_conf() {
- local _cache_dirs
- _cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
- sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${_cache_dirs[@]})|g" ${releng_dir}/pacman.conf > ${pacman_conf}
+ sed -r "s|^#?\\s*CacheDir.+|CacheDir = ${work_dir}/${arch}/root-image/isorepo/|g" ${releng_dir}/pacman.conf > ${pacman_conf}
}
# Base installation, plus needed packages (root-image)
@@ -74,6 +75,13 @@ make_basefs() {
# Additional packages (root-image)
make_packages() {
setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir}/${arch} -C ${pacman_conf} -D ${iso_dirname} -p "$(grep -h -v ^# ${releng_dir}/packages.{both,${arch}})" install
+
+ # create live environment local repo
+ if [[ "$enable_offline_install" == 'true' ]]; then
+ local iso_repo_dir=${work_dir}/${arch}/root-image/isorepo
+
+ setarch ${arch} repo-add ${iso_repo_dir}/isorepo.db.tar.gz ${iso_repo_dir}/*
+ fi
}
# Copy mkinitcpio parabolaiso hooks and build initramfs (root-image)
@@ -91,13 +99,17 @@ make_setup_mkinitcpio() {
# Customize installation (root-image)
make_customize_root_image() {
+ [[ "$enable_offline_install" == 'true' ]] && offline='-O' || offline=''
+
cp -af ${releng_dir}/root-image ${work_dir}/${arch}
echo "Customizing root image"
iso_title="${iso_title}" \
+ enable_offline_install="${enable_offline_install}" \
setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir}/${arch} \
-C ${pacman_conf} \
-D ${iso_dirname} \
+ ${offline} \
-r ${chroot_customization_script} run
rm ${work_dir}/${arch}/root-image${chroot_customization_script}
}
@@ -225,9 +237,11 @@ make_aitab() {
# Build all filesystem images specified in aitab (.fs.sfs .sfs)
make_prepare() {
+ [[ "$enable_offline_install" == 'true' ]] && offline='-O' || offline=''
+
cp -a -l -f ${work_dir}/${arch}/root-image ${work_dir}
setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir} -D ${iso_dirname} pkglist
- setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir} -D ${iso_dirname} prepare
+ setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir} -D ${iso_dirname} ${offline} prepare
rm -rf ${work_dir}/root-image
# rm -rf ${work_dir}/${arch}/root-image (if low space, this helps)
@@ -245,13 +259,13 @@ make_iso() {
## prepare state ##
# set CLI options
-
-while getopts 'T:V:L:D:w:o:vh' arg; do
+while getopts 'T:V:L:D:Ow:o:vh' arg; do
case "${arg}" in
T) target="${OPTARG}" ;;
V) iso_version="${OPTARG}" ;;
L) iso_label="${OPTARG}" ;;
D) iso_dirname="${OPTARG}" ;;
+ O) enable_offline_install='true' ;;
w) work_dir="${OPTARG}" ;;
o) out_dir="${OPTARG}" ;;
v) verbose="-v" ;;
@@ -268,17 +282,18 @@ case "${target}" in
'i686'|'x86_64')
archs=${target}
iso_arch=${target}
- launch_msg="Building single-architecture ${iso_edition} ISO for ${target}"
+ launch_msg="Building single-architecture ${iso_edition} ISO for ${archs}"
;;
*)
- launch_msg="Building dual-architecture ${iso_edition} ISO for i686 and x86_64"
+ launch_msg="Building multi-architecture ${iso_edition} ISO for ${archs}"
;;
esac
-if [ "$enable_offline_install" == 'true' ]; then
+if [[ "$enable_offline_install" == 'true' ]]; then
iso_arch="${iso_arch}-complete"
- launch_msg="${launch_msg} with offline install enabled"
+ launch_msg="${launch_msg} (net-install or offline install)"
else
iso_arch="${iso_arch}-netinstall"
+ launch_msg="${launch_msg} (net-install only)"
fi
[ "${archs}" == 'i686' ] && arch='i686' || arch='x86_64'
iso_filename="parabola-${iso_edition}-${iso_arch}-${iso_version}.iso"
@@ -327,13 +342,13 @@ if ! (($is_done)); then echo ${launch_msg}; else echo "Nothing to do"; exit; fi;
## build ISO ##
+# prepare environment
chown -R 0:0 "${releng_dir}/root-image/"
mkdir -p ${work_dir}
-run_once make_pacman_conf
-
# prepare target filesystems
for arch in ${archs}; do
+ run_once make_pacman_conf
run_once make_basefs
run_once make_packages
run_once make_setup_mkinitcpio