#!/bin/bash # # SPDX-License-Identifier: GPL-3.0-or-later set -e -u # Control the environment umask 0022 export LANG="C" export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-"$(date +%s)"}" # mkparabolaiso defaults app_name="${0##*/}" pkg_list=() run_cmd="" quiet="y" work_dir="work" out_dir="out" img_name="${app_name}.iso" sfs_mode="sfs" sfs_comp="xz" gpg_key="" override_gpg_key="" # profile defaults profile="" iso_name="${app_name}" iso_label="${app_name^^}" override_iso_label="" iso_publisher="${app_name}" override_iso_publisher="" iso_application="${app_name} iso" override_iso_application="" iso_version="" install_dir="${app_name}" override_install_dir="" arch="${arch:-$(uname -m)}" # leave $(uname -m) only in parabolaiso v49+ pacman_conf="/etc/pacman.conf" override_pacman_conf="" bootmodes=() # Show an INFO message # $1: message string _msg_info() { local _msg="${1}" [[ "${quiet}" == "y" ]] || printf '[%s] INFO: %s\n' "${app_name}" "${_msg}" } # Show a WARNING message # $1: message string _msg_warning() { local _msg="${1}" printf '[%s] WARNING: %s\n' "${app_name}" "${_msg}" >&2 } # Show an ERROR message then exit with status # $1: message string # $2: exit code number (with 0 does not exit) _msg_error() { local _msg="${1}" local _error=${2} printf '[%s] ERROR: %s\n' "${app_name}" "${_msg}" >&2 if (( _error > 0 )); then exit "${_error}" fi } _chroot_init() { install -d -m 0755 -o 0 -g 0 -- "${airootfs_dir}" _pacman base syslinux } _chroot_run() { eval -- arch-chroot "${airootfs_dir}" "${run_cmd}" } _mount_airootfs() { trap "_umount_airootfs" EXIT HUP INT TERM install -d -m 0755 -- "${work_dir}/mnt/airootfs" _msg_info "Mounting '${airootfs_dir}.img' on '${work_dir}/mnt/airootfs'..." mount -- "${airootfs_dir}.img" "${work_dir}/mnt/airootfs" _msg_info "Done!" } _umount_airootfs() { _msg_info "Unmounting '${work_dir}/mnt/airootfs'..." umount -d -- "${work_dir}/mnt/airootfs" _msg_info "Done!" rmdir -- "${work_dir}/mnt/airootfs" trap - EXIT HUP INT TERM } # Show help usage, with an exit status. # $1: exit status number. _usage() { IFS='' read -r -d '' usagetext < options: -A Set an application name for the ISO Default: '${iso_application}' -C pacman configuration file. Default: '${pacman_conf}' -D Set an install_dir. All files will by located here. Default: '${install_dir}' NOTE: Max 8 characters, use only [a-z0-9] -L