From 222793697ba6c8c7e2703c1a25d2bf9a9095eae1 Mon Sep 17 00:00:00 2001 From: udeved Date: Mon, 6 Jun 2016 20:08:09 +0200 Subject: [PATCH] prepare #197 rename arch & branch vars -> target_arch & target_branch better not to use $arch -> already in use in PKGBUILDs --- README.md | 6 ++-- bin/buildiso.in | 18 ++++++------ bin/buildpkg.in | 32 +++++++++++----------- bin/deployiso.in | 6 ++-- data/manjaro-tools.conf | 8 +++--- docbook/manjaro-tools.conf.xml | 4 +-- lib/util-iso-boot.sh | 50 +++++++++++++++++----------------- lib/util-iso-calamares.sh | 8 +++--- lib/util-iso-image.sh | 8 +++--- lib/util-iso.sh | 30 ++++++++++---------- lib/util-mount.sh | 4 +-- lib/util-pkg.sh | 14 ++++------ lib/util-publish.sh | 6 ++-- lib/util.sh | 4 +-- 14 files changed, 98 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 4a474e4..6ab15b1 100644 --- a/README.md +++ b/README.md @@ -51,10 +51,10 @@ overriding ################ manjaro-tools.conf ################## ###################################################### -# default branch -# branch=stable +# default target branch +# target_branch=stable -# default arch: auto detect +# default target arch: auto detect # arch=$(uname -m) # cache dir where buildpkg, buildtree cache packages/pkgbuild, builiso iso files diff --git a/bin/buildiso.in b/bin/buildiso.in index d17967a..0b2f393 100755 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -32,7 +32,7 @@ show_profile(){ msg2 "plymouth_boot: %s" "${plymouth_boot}" ${plymouth_boot} && msg2 "plymouth_theme: %s" "${plymouth_theme}" - [[ ${arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}" + [[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}" msg2 "efi_boot_loader: %s" "${efi_boot_loader}" msg2 "efi_part_size: %s" "${efi_part_size}" @@ -70,8 +70,8 @@ display_settings(){ msg2 "pacman_conf: %s" "${pacman_conf}" msg "OPTIONS:" - msg2 "arch: %s" "${arch}" - msg2 "branch: %s" "${branch}" + msg2 "arch: %s" "${target_arch}" + msg2 "branch: %s" "${target_branch}" msg2 "chroots_iso: %s" "${chroots_iso}" msg2 "initsys: %s" "${initsys}" msg2 "kernel: %s" "${kernel}" @@ -122,8 +122,8 @@ pacman_conf_arch='default' usage() { echo "Usage: ${0##*/} [options]" echo " -p Buildset or profile [default: ${buildset_iso}]" - echo " -a Arch [default: ${arch}]" - echo " -b Branch [default: ${branch}]" + echo " -a Arch [default: ${target_arch}]" + echo " -b Branch [default: ${target_branch}]" echo ' -r Chroots directory' echo " [default: ${chroots_iso}]" echo ' -t Target directory' @@ -152,8 +152,8 @@ opts='p:a:b:r:t:k:i:czxsvqh' while getopts "${opts}" arg; do case "${arg}" in p) buildset_iso="$OPTARG" ;; - a) arch="$OPTARG" ;; - b) branch="$OPTARG" ;; + a) target_arch="$OPTARG" ;; + b) target_branch="$OPTARG" ;; r) chroots_iso="$OPTARG" ;; t) cache_dir_iso="$OPTARG" ;; k) kernel="$OPTARG" ;; @@ -173,9 +173,9 @@ shift $(($OPTIND - 1)) timer_start=$(get_timer) -[[ "${arch}" == 'x86_64' ]] && pacman_conf_arch='multilib' +[[ "${target_arch}" == 'x86_64' ]] && pacman_conf_arch='multilib' -mirrors_conf="${DATADIR}/pacman-mirrors-${branch}.conf" +mirrors_conf="${DATADIR}/pacman-mirrors-${target_branch}.conf" check_root "$0" "${orig_argv[@]}" diff --git a/bin/buildpkg.in b/bin/buildpkg.in index b1970f8..bb0ccf4 100644 --- a/bin/buildpkg.in +++ b/bin/buildpkg.in @@ -42,8 +42,8 @@ display_settings(){ msg2 "is_buildset: %s" "${is_buildset}" msg "OPTIONS:" - msg2 "arch: %s" "${arch}" - msg2 "branch: %s" "${branch}" + msg2 "arch: %s" "${target_arch}" + msg2 "branch: %s" "${target_branch}" msg2 "chroots_pkg: %s" "${chroots_pkg}" msg "ARGS:" @@ -57,7 +57,7 @@ display_settings(){ msg "PATHS:" msg2 "work_dir: %s" "${work_dir}" msg2 "pkg_dir: %s" "${pkg_dir}" - msg2 "build_mirror: %s" "${build_mirror}/${branch}" + msg2 "build_mirror: %s" "${build_mirror}/${target_branch}" if ${clean_first};then msg "PKG:" @@ -89,8 +89,8 @@ udev_root=false usage() { echo "Usage: ${0##*/} [options]" echo " -p Buildset or pkg [default: ${buildset_pkg}]" - echo " -a Arch [default: ${arch}]" - echo " -b Branch [default: ${branch}]" + echo " -a Arch [default: ${target_arch}]" + echo " -b Branch [default: ${target_branch}]" echo ' -r Chroots directory' echo " [default: ${chroots_pkg}]" echo ' -i Install a package into the working copy of the chroot' @@ -113,8 +113,8 @@ opts='p:a:b:r:i:cwnsuqh' while getopts "${opts}" arg; do case "${arg}" in p) buildset_pkg="$OPTARG" ;; - a) arch="$OPTARG" ;; - b) branch="$OPTARG" ;; + a) target_arch="$OPTARG" ;; + b) target_branch="$OPTARG" ;; r) chroots_pkg="$OPTARG" ;; i) install_pkgs+="$OPTARG"; mkchrootpkg_args+=(-I ${install_pkgs[*]}) ;; c) clean_first=true; mkchroot_args+=(-L) ;; @@ -128,24 +128,24 @@ while getopts "${opts}" arg; do esac done -if [[ "${arch}" == 'multilib' ]]; then - pacman_conf_arch=${arch} - work_dir=${chroots_pkg}/${branch}/${arch} - pkg_dir=${cache_dir_pkg}/${branch}/${arch} +if [[ "${target_arch}" == 'multilib' ]]; then + pacman_conf_arch=${target_arch} + work_dir=${chroots_pkg}/${target_branch}/${target_arch} + pkg_dir=${cache_dir_pkg}/${target_branch}/${target_arch} arch='x86_64' is_multilib=true else pacman_conf_arch='default' - work_dir=${chroots_pkg}/${branch}/${arch} - pkg_dir=${cache_dir_pkg}/${branch}/${arch} + work_dir=${chroots_pkg}/${target_branch}/${target_arch} + pkg_dir=${cache_dir_pkg}/${target_branch}/${target_arch} is_multilib=false fi pacman_conf="${DATADIR}/pacman-${pacman_conf_arch}.conf" -makepkg_conf="${DATADIR}/makepkg-${arch}.conf" -mirrors_conf="${DATADIR}/pacman-mirrors-${branch}.conf" +makepkg_conf="${DATADIR}/makepkg-${target_arch}.conf" +mirrors_conf="${DATADIR}/pacman-mirrors-${target_branch}.conf" -mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${branch}") +mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${target_branch}") mkchrootpkg_args+=(-r ${work_dir}) diff --git a/bin/deployiso.in b/bin/deployiso.in index 5397cd5..53b6cf6 100644 --- a/bin/deployiso.in +++ b/bin/deployiso.in @@ -37,7 +37,7 @@ display_settings(){ msg2 "is_buildset: %s" "${is_buildset}" msg "OPTIONS:" - msg2 "arch: %s" "${arch}" + msg2 "arch: %s" "${target_arch}" msg2 "initsys: %s" "${initsys}" msg2 "limit: %s kB/s" "${limit}" @@ -84,7 +84,7 @@ mktorrent_args=(-v -p) usage() { echo "Usage: ${0##*/} [options]" echo " -p Source folder to upload [default:${buildset_iso}]" - echo " -a Arch to upload [default:${arch}]" + echo " -a Arch to upload [default:${target_arch}]" echo " -i The iso's init system [default:${initsys}]" echo " -l Limit bandwidth in kB/s [default:${limit}]" echo ' -c Create new remote edition_type with subtree' @@ -103,7 +103,7 @@ opts='p:a:l:i:ctuvqh' while getopts "${opts}" arg; do case "${arg}" in p) buildset_iso="$OPTARG" ;; - a) arch="$OPTARG" ;; + a) target_arch="$OPTARG" ;; i) initsys="$OPTARG" ;; l) limit="$OPTARG" ;; c) remote_create=true ;; diff --git a/data/manjaro-tools.conf b/data/manjaro-tools.conf index 524945c..04371a9 100644 --- a/data/manjaro-tools.conf +++ b/data/manjaro-tools.conf @@ -2,11 +2,11 @@ ################ manjaro-tools.conf ################## ###################################################### -# default branch -# branch=stable +# default target branch +# target_branch=stable -# default arch: auto detect -# arch=$(uname -m) +# default taget arch: auto detect +# target_arch=$(uname -m) # cache dir where buildpkg, buildtree cache packages/pkgbuild, builiso iso files # cache_dir=/var/cache/manjaro-tools diff --git a/docbook/manjaro-tools.conf.xml b/docbook/manjaro-tools.conf.xml index cc34807..3654977 100644 --- a/docbook/manjaro-tools.conf.xml +++ b/docbook/manjaro-tools.conf.xml @@ -68,7 +68,7 @@ - branch= + target_branch= Takes (the default), or . It defines @@ -78,7 +78,7 @@ - arch= + target_arch= Takes or . By default it will try to autodetect the current architecture. diff --git a/lib/util-iso-boot.sh b/lib/util-iso-boot.sh index 8532936..df66aa5 100644 --- a/lib/util-iso-boot.sh +++ b/lib/util-iso-boot.sh @@ -84,30 +84,30 @@ write_loader_conf(){ local conf=$1/${fn} msg2 "Writing %s ..." "${fn}" echo 'timeout 3' > ${conf} - echo "default ${iso_name}-${arch}" >> ${conf} + echo "default ${iso_name}-${target_arch}" >> ${conf} } write_efi_shellv1_conf(){ - local fn=uefi-shell-v1-${arch}.conf + local fn=uefi-shell-v1-${target_arch}.conf local conf=$1/${fn} msg2 "Writing %s ..." "${fn}" - echo "title UEFI Shell ${arch} v1" > ${conf} + echo "title UEFI Shell ${target_arch} v1" > ${conf} echo "efi /EFI/shellx64_v1.efi" >> ${conf} } write_efi_shellv2_conf(){ - local fn=uefi-shell-v2-${arch}.conf + local fn=uefi-shell-v2-${target_arch}.conf local conf=$1/${fn} msg2 "Writing %s ..." "${fn}" - echo "title UEFI Shell ${arch} v2" > ${conf} + echo "title UEFI Shell ${target_arch} v2" > ${conf} echo "efi /EFI/shellx64_v2.efi" >> ${conf} } write_dvd_conf(){ - local fn=${iso_name}-${arch}.conf + local fn=${iso_name}-${target_arch}.conf local conf=$1/${fn} path=$2 msg2 "Writing %s ..." "${fn}" - echo "title ${dist_name} Linux ${arch} UEFI DVD (default)" > ${conf} + echo "title ${dist_name} Linux ${target_arch} UEFI DVD (default)" > ${conf} echo "linux /EFI/miso/${iso_name}.efi" >> ${conf} if [[ -f ${path}/${iso_name}/boot/intel_ucode.img ]] ; then msg2 "Using intel_ucode.img ..." @@ -118,10 +118,10 @@ write_dvd_conf(){ } write_dvd_nonfree_conf(){ - local fn=${iso_name}-${arch}-nonfree.conf + local fn=${iso_name}-${target_arch}-nonfree.conf local conf=$1/${fn} path=$2 msg2 "Writing %s ..." "${fn}" - echo "title ${dist_name} Linux ${arch} UEFI DVD (nonfree)" > ${conf} + echo "title ${dist_name} Linux ${target_arch} UEFI DVD (nonfree)" > ${conf} echo "linux /EFI/miso/${iso_name}.efi" >> ${conf} if [[ -f ${path}/${iso_name}/boot/intel_ucode.img ]] ; then msg2 "Using intel_ucode.img ..." @@ -132,30 +132,30 @@ write_dvd_nonfree_conf(){ } write_usb_conf(){ - local fn=${iso_name}-${arch}.conf + local fn=${iso_name}-${target_arch}.conf local conf=$1/${fn} path=$2 msg2 "Writing %s ..." "${fn}" - echo "title ${dist_name} Linux ${arch} UEFI USB (default)" > ${conf} - echo "linux /${iso_name}/boot/${arch}/${iso_name}" >> ${conf} + echo "title ${dist_name} Linux ${target_arch} UEFI USB (default)" > ${conf} + echo "linux /${iso_name}/boot/${target_arch}/${iso_name}" >> ${conf} if [[ -f ${path}/${iso_name}/boot/intel_ucode.img ]] ; then msg2 "Using intel_ucode.img ..." echo "initrd /${iso_name}/boot/intel_ucode.img" >> ${conf} fi - echo "initrd /${iso_name}/boot/${arch}/${iso_name}.img" >> ${conf} + echo "initrd /${iso_name}/boot/${target_arch}/${iso_name}.img" >> ${conf} echo "options misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 logo.nologo overlay=free" >> ${conf} } write_usb_nonfree_conf(){ - local fn=${iso_name}-${arch}-nonfree.conf + local fn=${iso_name}-${target_arch}-nonfree.conf local conf=$1/${fn} path=$2 msg2 "Writing %s ..." "${fn}" - echo "title ${dist_name} Linux ${arch} UEFI USB (nonfree)" > ${conf} - echo "linux /${iso_name}/boot/${arch}/${iso_name}" >> ${conf} + echo "title ${dist_name} Linux ${target_arch} UEFI USB (nonfree)" > ${conf} + echo "linux /${iso_name}/boot/${target_arch}/${iso_name}" >> ${conf} if [[ -f ${path}/${iso_name}/boot/intel_ucode.img ]] ; then msg2 "Using intel_ucode.img ..." echo "initrd /${iso_name}/boot/intel_ucode.img" >> ${conf} fi - echo "initrd /${iso_name}/boot/${arch}/${iso_name}.img" >> ${conf} + echo "initrd /${iso_name}/boot/${target_arch}/${iso_name}.img" >> ${conf} echo "options misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=1 i915.modeset=1 radeon.modeset=1 logo.nologo overlay=nonfree nonfree=yes" >> ${conf} } @@ -195,7 +195,7 @@ gen_boot_args(){ } gen_initrd_arg(){ - local path="/${iso_name}/boot/${arch}/${iso_name}.img" + local path="/${iso_name}/boot/${target_arch}/${iso_name}.img" local arg="initrd=${path}" if [[ -f $1/${iso_name}/boot/intel_ucode.img ]] ; then arg="initrd=/${iso_name}/boot/intel_ucode.img,${path}" @@ -215,7 +215,7 @@ write_isolinux_cfg(){ echo "timeout 200" >> ${conf} echo '' >> ${conf} echo "label start" >> ${conf} - echo " kernel /${iso_name}/boot/${arch}/${iso_name}" >> ${conf} + echo " kernel /${iso_name}/boot/${target_arch}/${iso_name}" >> ${conf} local boot_args=($(gen_boot_args)) local initrd_arg=$(gen_initrd_arg $path) @@ -225,7 +225,7 @@ write_isolinux_cfg(){ echo '' >> ${conf} if ${nonfree_xorg};then echo "label nonfree" >> ${conf} - echo " kernel /${iso_name}/boot/${arch}/${iso_name}" >> ${conf} + echo " kernel /${iso_name}/boot/${target_arch}/${iso_name}" >> ${conf} echo " append ${initrd_arg} misobasedir=${iso_name} misolabel=${iso_label} nouveau.modeset=0 i915.modeset=1 radeon.modeset=0 nonfree=yes logo.nologo overlay=nonfree ${boot_args[@]} showopts" >> ${conf} echo '' >> ${conf} fi @@ -264,7 +264,7 @@ update_isolinux_cfg(){ msg2 "Updating %s ..." "${fn}" sed -i "s|%ISO_LABEL%|${iso_label}|g; s|%ISO_NAME%|${iso_name}|g; - s|%ARCH%|${arch}|g" $2/${fn} + s|%ARCH%|${target_arch}|g" $2/${fn} } update_isolinux_msg(){ @@ -279,15 +279,15 @@ write_isomounts(){ echo '# Sample kernel argument in syslinux: overlay=extra,extra2' >> ${file} echo '' >> ${file} msg2 "Writing live entry ..." - echo "${arch}/live-image.sqfs ${arch} / squashfs" >> ${file} + echo "${target_arch}/live-image.sqfs ${target_arch} / squashfs" >> ${file} if [[ -f ${packages_mhwd} ]] ; then msg2 "Writing mhwd entry ..." - echo "${arch}/mhwd-image.sqfs ${arch} / squashfs" >> ${file} + echo "${target_arch}/mhwd-image.sqfs ${target_arch} / squashfs" >> ${file} fi if [[ -f "${packages_custom}" ]] ; then msg2 "Writing %s entry ..." "${profile}" - echo "${arch}/${profile}-image.sqfs ${arch} / squashfs" >> ${file} + echo "${target_arch}/${profile}-image.sqfs ${target_arch} / squashfs" >> ${file} fi msg2 "Writing root entry ..." - echo "${arch}/root-image.sqfs ${arch} / squashfs" >> ${file} + echo "${target_arch}/root-image.sqfs ${target_arch} / squashfs" >> ${file} } diff --git a/lib/util-iso-calamares.sh b/lib/util-iso-calamares.sh index cf80f5e..d893dac 100644 --- a/lib/util-iso-calamares.sh +++ b/lib/util-iso-calamares.sh @@ -136,10 +136,10 @@ write_calamares_unpack_conf(){ local conf="$1/etc/calamares/modules/unpackfs.conf" echo "---" > "$conf" echo "unpack:" >> "$conf" - echo " - source: \"/bootmnt/${iso_name}/${arch}/root-image.sqfs\"" >> "$conf" + echo " - source: \"/bootmnt/${iso_name}/${target_arch}/root-image.sqfs\"" >> "$conf" echo " sourcefs: \"squashfs\"" >> "$conf" echo " destination: \"\"" >> "$conf" - echo " - source: \"/bootmnt/${iso_name}/${arch}/${profile}-image.sqfs\"" >> "$conf" + echo " - source: \"/bootmnt/${iso_name}/${target_arch}/${profile}-image.sqfs\"" >> "$conf" echo " sourcefs: \"squashfs\"" >> "$conf" echo " destination: \"\"" >> "$conf" } @@ -225,8 +225,8 @@ configure_thus(){ echo "DISTRIBUTION_VERSION = \"${dist_release}\"" >> "$conf" echo "SHORT_NAME = \"${dist_name}\"" >> "$conf" echo "[install]" >> "$conf" - echo "LIVE_MEDIA_SOURCE = \"/bootmnt/${iso_name}/${arch}/root-image.sqfs\"" >> "$conf" - echo "LIVE_MEDIA_DESKTOP = \"/bootmnt/${iso_name}/${arch}/${profile}-image.sqfs\"" >> "$conf" + echo "LIVE_MEDIA_SOURCE = \"/bootmnt/${iso_name}/${target_arch}/root-image.sqfs\"" >> "$conf" + echo "LIVE_MEDIA_DESKTOP = \"/bootmnt/${iso_name}/${target_arch}/${profile}-image.sqfs\"" >> "$conf" echo "LIVE_MEDIA_TYPE = \"squashfs\"" >> "$conf" echo "LIVE_USER_NAME = \"${username}\"" >> "$conf" echo "KERNEL = \"${kernel}\"" >> "$conf" diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index 6247a4b..2f9bcaf 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -265,7 +265,7 @@ configure_lsb(){ } configure_mhwd(){ - if [[ ${arch} == "x86_64" ]];then + if [[ ${target_arch} == "x86_64" ]];then if ! ${multilib};then msg2 "Disable mhwd lib32 support" echo 'MHWD64_IS_LIB32="false"' > $1/etc/mhwd-x86_64.conf @@ -425,13 +425,13 @@ download_to_cache(){ chroot-run \ -r "${mountargs_ro}" \ -w "${mountargs_rw}" \ - -B "${build_mirror}/${branch}" \ + -B "${build_mirror}/${target_branch}" \ "$1" \ pacman -v -Syw $2 --noconfirm || return 1 chroot-run \ -r "${mountargs_ro}" \ -w "${mountargs_rw}" \ - -B "${build_mirror}/${branch}" \ + -B "${build_mirror}/${target_branch}" \ "$1" \ pacman -v -Sp $2 --noconfirm > "$1"/cache-packages.txt sed -ni '/.pkg.tar.xz/p' "$1"/cache-packages.txt @@ -442,7 +442,7 @@ download_to_cache(){ # $2: packages chroot_create(){ [[ "$1" == "${work_dir}/root-image" ]] && local flag="-L" - setarch "${arch}" \ + setarch "${target_arch}" \ mkchroot ${mkchroot_args[*]} ${flag} $@ } diff --git a/lib/util-iso.sh b/lib/util-iso.sh index 0e636c1..012cde0 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -65,7 +65,7 @@ make_sqfs() { error "$1 is not a directory" return 1 fi - local timer=$(get_timer) path=${work_dir}/iso/${iso_name}/${arch} + local timer=$(get_timer) path=${work_dir}/iso/${iso_name}/${target_arch} local name=${1##*/} local sq_img="${path}/$name.sqfs" mkdir -p ${path} @@ -178,7 +178,7 @@ gen_iso_fn(){ [[ ${edition} == 'community' ]] && vars+=("${edition}") [[ ${initsys} == 'openrc' ]] && vars+=("${initsys}") vars+=("${dist_release}") - vars+=("${arch}") + vars+=("${target_arch}") for n in ${vars[@]};do name=${name:-}${name:+-}${n} done @@ -305,9 +305,9 @@ make_image_boot() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then msg "Prepare [%s/boot]" "${iso_name}" local path_iso="${work_dir}/iso/${iso_name}/boot" - mkdir -p ${path_iso}/${arch} - cp ${work_dir}/root-image/boot/memtest86+/memtest.bin ${path_iso}/${arch}/memtest - cp ${work_dir}/root-image/boot/vmlinuz* ${path_iso}/${arch}/${iso_name} + mkdir -p ${path_iso}/${target_arch} + cp ${work_dir}/root-image/boot/memtest86+/memtest.bin ${path_iso}/${target_arch}/memtest + cp ${work_dir}/root-image/boot/vmlinuz* ${path_iso}/${target_arch}/${iso_name} local path="${work_dir}/boot-image" mkdir -p ${path} @@ -317,7 +317,7 @@ make_image_boot() { gen_boot_image "${path}" - mv ${path}/boot/${iso_name}.img ${path_iso}/${arch}/${iso_name}.img + mv ${path}/boot/${iso_name}.img ${path_iso}/${target_arch}/${iso_name}.img [[ -f ${path}/boot/intel-ucode.img ]] && copy_ucode "${path}" "${path_iso}" umount_image @@ -428,7 +428,7 @@ load_pkgs(){ _init="s|>systemd||g" _init_rm="s|>openrc.*||g" fi - if [[ "${arch}" == "i686" ]]; then + if [[ "${target_arch}" == "i686" ]]; then _arch="s|>i686||g" _arch_rm="s|>x86_64.*||g" _multi="s|>multilib.*||g" @@ -560,11 +560,11 @@ check_profile(){ check_requirements(){ [[ -f ${run_dir}/.buildiso ]] || die "%s is not a valid iso profiles directory!" "${run_dir}" - if ! $(is_valid_arch_iso ${arch});then - die "%s is not a valid arch!" "${arch}" + if ! $(is_valid_arch_iso ${target_arch});then + die "%s is not a valid arch!" "${target_arch}" fi - if ! $(is_valid_branch ${branch});then - die "%s is not a valid branch!" "${branch}" + if ! $(is_valid_branch ${target_branch});then + die "%s is not a valid branch!" "${target_branch}" fi if ! is_valid_init "${initsys}";then @@ -614,7 +614,7 @@ prepare_images(){ run_safe "make_image_mhwd" fi run_safe "make_image_boot" - if [[ "${arch}" == "x86_64" ]]; then + if [[ "${target_arch}" == "x86_64" ]]; then run_safe "make_efi" run_safe "make_efiboot" fi @@ -670,10 +670,10 @@ load_profile(){ iso_file=$(gen_iso_fn).iso - mkchroot_args+=(-C ${pacman_conf} -S ${mirrors_conf} -B "${build_mirror}/${branch}" -K) - work_dir=${chroots_iso}/${profile}/${arch} + mkchroot_args+=(-C ${pacman_conf} -S ${mirrors_conf} -B "${build_mirror}/${target_branch}" -K) + work_dir=${chroots_iso}/${profile}/${target_arch} - iso_dir="${cache_dir_iso}/${edition}/${profile}/${dist_release}/${arch}" + iso_dir="${cache_dir_iso}/${edition}/${profile}/${dist_release}/${target_arch}" prepare_dir "${iso_dir}" prepare_dir "${log_dir}" diff --git a/lib/util-mount.sh b/lib/util-mount.sh index 8f56668..e08ea16 100644 --- a/lib/util-mount.sh +++ b/lib/util-mount.sh @@ -97,10 +97,10 @@ chroot_mount_partitions(){ local chroot_arch=$(get_chroot_arch $1) [[ ${chroot_arch} == x86-64 ]] && chroot_arch=${chroot_arch/-/_} - case ${arch} in + case ${target_arch} in i686) if [[ ${chroot_arch} == x86_64 ]];then - die "You can't chroot from %s host into %s!" "${arch}" "${chroot_arch}" + die "You can't chroot from %s host into %s!" "${target_arch}" "${chroot_arch}" fi ;; esac diff --git a/lib/util-pkg.sh b/lib/util-pkg.sh index a2be591..076a51e 100644 --- a/lib/util-pkg.sh +++ b/lib/util-pkg.sh @@ -144,16 +144,16 @@ init_base_devel(){ } chroot_create(){ - msg "Creating chroot for [%s] (%s)..." "${branch}" "${arch}" + msg "Creating chroot for [%s] (%s)..." "${target_branch}" "${target_arch}" mkdir -p "${work_dir}" - setarch "${arch}" \ + setarch "${target_arch}" \ mkchroot ${mkchroot_args[*]} \ "${work_dir}/root" \ ${base_packages[*]} || abort } chroot_clean(){ - msg "Cleaning chroot for [%s] (%s)..." "${branch}" "${arch}" + msg "Cleaning chroot for [%s] (%s)..." "${target_branch}" "${target_arch}" for copy in "${work_dir}"/*; do [[ -d ${copy} ]] || continue msg2 "Deleting chroot copy %s ..." "$(basename "${copy}")" @@ -171,7 +171,7 @@ chroot_clean(){ } chroot_update(){ - msg "Updating chroot for [%s] (%s)..." "${branch}" "${arch}" + msg "Updating chroot for [%s] (%s)..." "${target_branch}" "${target_arch}" chroot-run ${mkchroot_args[*]} \ "${work_dir}/${OWNER}" \ pacman -Syu --noconfirm || abort @@ -193,13 +193,12 @@ sign_pkg(){ } post_build(){ - local _arch=${arch} source PKGBUILD local ext='pkg.tar.xz' pinfo loglist=() lname if [[ ${arch} == "any" ]]; then pinfo=${pkgver}-${pkgrel}-any else - pinfo=${pkgver}-${pkgrel}-${_arch} + pinfo=${pkgver}-${pkgrel}-${arch} fi if [[ -n $PKGDEST ]];then if [[ -n ${pkgbase} ]];then @@ -226,7 +225,6 @@ post_build(){ tar -cJf ${lname}-${pinfo}.log.tar.xz ${loglist[@]} find . -maxdepth 1 -name '*.log' -delete #&> /dev/null fi - arch=$_arch } chroot_init(){ @@ -243,7 +241,7 @@ chroot_init(){ } build_pkg(){ - setarch "${arch}" \ + setarch "${target_arch}" \ mkchrootpkg ${mkchrootpkg_args[*]} } diff --git a/lib/util-publish.sh b/lib/util-publish.sh index 706712c..bc055b2 100644 --- a/lib/util-publish.sh +++ b/lib/util-publish.sh @@ -25,7 +25,7 @@ create_subtree(){ prepare_transfer(){ edition=$(get_edition $1) - remote_dir="${edition}/$1/${dist_release}/${arch}" + remote_dir="${edition}/$1/${dist_release}/${target_arch}" src_dir="${run_dir}/${remote_dir}" } @@ -36,7 +36,7 @@ gen_iso_fn(){ [[ ${edition} == 'community' ]] && vars+=("${edition}") [[ ${initsys} == 'openrc' ]] && vars+=("${initsys}") vars+=("${dist_release}") - vars+=("${arch}") + vars+=("${target_arch}") for n in ${vars[@]};do name=${name:-}${name:+-}${n} done @@ -59,7 +59,7 @@ sync_dir(){ prepare_transfer "$1" ${torrent_create} && create_torrent "$1" ${remote_create} && create_subtree "$1" - msg "Start upload [%s] (%s) ..." "$1" "${arch}" + msg "Start upload [%s] (%s) ..." "$1" "${target_arch}" rsync ${rsync_args[*]} ${src_dir}/ ${sf_url}/${remote_dir}/ msg "Done upload [%s]" "$1" show_elapsed_time "${FUNCNAME}" "${timer_start}" diff --git a/lib/util.sh b/lib/util.sh index 7f5a51f..fca2acc 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -201,9 +201,9 @@ set_branch(){ } init_common(){ - [[ -z ${branch} ]] && branch='stable' + [[ -z ${target_branch} ]] && target_branch='stable' - [[ -z ${arch} ]] && arch=$(uname -m) + [[ -z ${target_arch} ]] && target_arch=$(uname -m) [[ -z ${cache_dir} ]] && cache_dir='/var/cache/manjaro-tools'