diff --git a/usr/lib/archboot/common.sh b/usr/lib/archboot/common.sh index a46f742bb..517738b3b 100644 --- a/usr/lib/archboot/common.sh +++ b/usr/lib/archboot/common.sh @@ -62,9 +62,9 @@ _riscv64_check() { ### check architecture _architecture_check() { - echo "${0}" | grep -qw aarch64 && _aarch64_check - echo "${0}" | grep -qw riscv64 && _riscv64_check - echo "${0}" | grep -qw x86_64 && _x86_64_check + echo "${_BASENAME}" | grep -qw aarch64 && _aarch64_check + echo "${_BASENAME}" | grep -qw riscv64 && _riscv64_check + echo "${_BASENAME}" | grep -qw x86_64 && _x86_64_check } ### check if running in container diff --git a/usr/lib/archboot/run/chroot-tarball.sh b/usr/lib/archboot/run/chroot-tarball.sh index 12260cff6..24a25fa65 100755 --- a/usr/lib/archboot/run/chroot-tarball.sh +++ b/usr/lib/archboot/run/chroot-tarball.sh @@ -3,7 +3,7 @@ . /etc/archboot/defaults . /usr/lib/archboot/common.sh . /usr/lib/archboot/container.sh -if echo "${0}" | grep -qw aarch64; then +if echo "${_BASENAME}" | grep -qw aarch64; then _PACMAN_ARCH_CHROOT="${_PACMAN_AARCH64_CHROOT}" _PACMAN_ARCH="${_PACMAN_AARCH64}" _ARCH_VERSION="ArchLinuxARM-aarch64-latest.tar.gz" @@ -11,7 +11,7 @@ if echo "${0}" | grep -qw aarch64; then _LATEST_ARCH="http://os.archlinuxarm.org/os/${_ARCH_VERSION}" _CAP_ARCH="AARCH64" _ARCH="aarch64" -else +elif echo "${_BASENAME}" | grep -qw riscv64; then _PACMAN_ARCH_CHROOT="${_PACMAN_RISCV64_CHROOT}" _PACMAN_ARCH="${_PACMAN_RISCV64}" _ARCH_VERSION="archriscv-20220727.tar.zst" @@ -38,7 +38,7 @@ echo "Starting container creation ..." [[ -f ${_PACMAN_ARCH_CHROOT} ]] && rm ${_PACMAN_ARCH_CHROOT}{,.sig} 2>/dev/null echo "Create directory ${1} ..." mkdir -p "${1}"/"${_PACMAN_ARCH}" -echo "Downloading archlinux riscv64 ..." +echo "Downloading archlinux ${_ARCH} ..." ! [[ -f ${_ARCH_VERSION} ]] && wget "${_LATEST_ARCH}" >/dev/null 2>&1 bsdtar -xf ${_ARCH_VERSION} -C "${1}" echo "Removing installation tarball ..." diff --git a/usr/lib/archboot/run/container.sh b/usr/lib/archboot/run/container.sh index 1e96f618f..c1d6abe58 100755 --- a/usr/lib/archboot/run/container.sh +++ b/usr/lib/archboot/run/container.sh @@ -7,7 +7,7 @@ _parameters "$@" _root_check echo "Starting container creation ..." [[ -d "${1}" ]] || (echo "Create directory ${1} ..."; mkdir "${1}") -if echo "${0}" | grep -qw "${_RUNNING_ARCH}"; then +if echo "${_BASENAME}" | grep -qw "${_RUNNING_ARCH}"; then # running system = creating system _cachedir_check _create_pacman_conf "${1}" @@ -38,10 +38,10 @@ if echo "${0}" | grep -qw "${_RUNNING_ARCH}"; then else # running system != creating system if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then - if echo "${0}" | grep -qw aarch64; then + if echo "${_BASENAME}" | grep -qw aarch64; then _pacman_chroot "${1}" "${_ARCHBOOT_AARCH64_CHROOT_PUBLIC}" "${_PACMAN_AARCH64_CHROOT}" || exit 1 fi - if echo "${0}" | grep -qw riscv64; then + if echo "${_BASENAME}" | grep -qw riscv64; then _pacman_chroot "${1}" "${_ARCHBOOT_RISCV64_CHROOT_PUBLIC}" "${_PACMAN_RISCV64_CHROOT}" || exit 1 fi _create_pacman_conf "${1}" "use_binfmt" diff --git a/usr/lib/archboot/run/iso.sh b/usr/lib/archboot/run/iso.sh index 6a38c77e2..a1d1df0bb 100755 --- a/usr/lib/archboot/run/iso.sh +++ b/usr/lib/archboot/run/iso.sh @@ -8,16 +8,16 @@ _parameters "$@" _root_check _architecture_check _config -if echo "${0}" | grep -qw aarch64 || echo "${0}" | grep -qw x86_64; then +if echo "${_BASENAME}" | grep -qw aarch64 || echo "${_BASENAME}" | grep -qw x86_64; then # running system = aarch64 or x86_64 echo "Starting ISO creation ..." _prepare_kernel_initramfs_files || exit 1 _prepare_ucode || exit 1 - if echo "${0}" | grep -qw aarch64; then + if echo "${_BASENAME}" | grep -qw aarch64; then _prepare_fedora_shim_bootloaders_aarch64 || exit 1 _prepare_uefi_AA64 || exit 1 fi - if echo "${0}" | grep -qw x86_64; then + if echo "${_BASENAME}" | grep -qw x86_64; then _prepare_fedora_shim_bootloaders_x86_64 || exit 1 _prepare_uefi_shell_tianocore || exit 1 _prepare_uefi_X64 || exit 1 @@ -40,7 +40,7 @@ else fi _create_cksum || exit 1 _cleanup_iso || exit 1 -if echo "${0}" | grep -qw aarch64 || echo "${0}" | grep -qw x86_64; then +if echo "${_BASENAME}" | grep -qw aarch64 || echo "${_BASENAME}" | grep -qw x86_64; then echo "Finished ISO creation." else echo "Finished Image creation." diff --git a/usr/lib/archboot/run/repository.sh b/usr/lib/archboot/run/repository.sh index 39fa3cfed..e3db0587e 100755 --- a/usr/lib/archboot/run/repository.sh +++ b/usr/lib/archboot/run/repository.sh @@ -3,13 +3,13 @@ . /usr/lib/archboot/common.sh . /usr/lib/archboot/container.sh . /usr/lib/archboot/repository.sh -[[ -d "${1}" ]] || (echo "Create directory ${1} ..."; mkdir "${1}") -_REPODIR="$(mktemp -d "${1}"/repository.XXX)" _CACHEDIR="${_REPODIR}/var/cache/pacman/pkg" [[ -z "${1}" ]] && _usage _root_check +[[ -d "${1}" ]] || (echo "Create directory ${1} ..."; mkdir "${1}") +_REPODIR="$(mktemp -d "${1}"/repository.XXX)" echo "Starting repository creation ..." -if echo "${0}" | grep -qw "${_RUNNING_ARCH}"; then +if echo "${_BASENAME}" | grep -qw "${_RUNNING_ARCH}"; then # running system = creating system [[ "${_RUNNING_ARCH}" == "x86_64" ]] && _x86_64_pacman_use_default || exit 1 _cachedir_check @@ -22,10 +22,10 @@ if echo "${0}" | grep -qw "${_RUNNING_ARCH}"; then else # running system != creating system if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then - if echo "${0}" | grep -qw aarch64; then + if echo "${_BASENAME}" | grep -qw aarch64; then _pacman_chroot "${_REPODIR}" "${_ARCHBOOT_AARCH64_CHROOT_PUBLIC}" "${_PACMAN_AARCH64_CHROOT}" || exit 1 fi - if echo "${0}" | grep -qw riscv64; then + if echo "${_BASENAME}" | grep -qw riscv64; then _pacman_chroot "${_REPODIR}" "${_ARCHBOOT_RISCV64_CHROOT_PUBLIC}" "${_PACMAN_RISCV64_CHROOT}" || exit 1 fi _create_pacman_conf "${_REPODIR}" "use_binfmt" diff --git a/usr/lib/archboot/run/server-release.sh b/usr/lib/archboot/run/server-release.sh index a2a404303..2eaa70aa0 100755 --- a/usr/lib/archboot/run/server-release.sh +++ b/usr/lib/archboot/run/server-release.sh @@ -2,14 +2,14 @@ . /usr/lib/archboot/common.sh . /usr/lib/archboot/server.sh _root_check -if echo "${0}" | grep -qw riscv64 || echo "${0}" | grep -qw aarch64; then +if echo "${_BASENAME}" | grep -qw riscv64 || echo "${_BASENAME}" | grep -qw aarch64; then _update_pacman_chroot || exit 1 fi _update_source -if echo "${0}" | grep -qw x86_64; then +if echo "${_BASENAME}" | grep -qw x86_64; then _x86_64_pacman_use_default || exit 1 fi _server_release || exit 1 -if echo "${0}" | grep -qw x86_64; then +if echo "${_BASENAME}" | grep -qw x86_64; then _x86_64_pacman_restore || exit 1 fi