for list in ${script_path}/system/kernel_list-* ; do
echo " ${list#${script_path}/system/kernel_list-}:"
echo -n " "
- for kernel in $(grep -h -v ^'#' ${list}); do
+ for kernel in $(grep -h -v ^'#' ${list} | sed ':a;N;$!ba;s/\n/ /g'); do
echo -n "${kernel} "
done
echo
# Read the file and remove comments starting with # and add it to the list of packages to install.
for _file in ${_loadfilelist[@]}; do
_msg_debug "Loaded package file ${_file}"
- pkglist=( ${pkglist[@]} "$(grep -h -v ^'#' ${_file})" )
+ pkglist=( ${pkglist[@]} "$(grep -h -v ^'#' ${_file} | sed ':a;N;$!ba;s/\n/ /g')" )
done
if [[ ${debug} = true ]]; then
sleep 3
# Exclude packages from the share exclusion list
excludefile="${script_path}/channels/share/packages.${arch}/exclude"
if [[ -f "${excludefile}" ]]; then
- excludelist=( $(grep -h -v ^'#' "${excludefile}") )
+ excludelist=( $(grep -h -v ^'#' "${excludefile}" | sed ':a;N;$!ba;s/\n/ /g') )
# 現在のpkglistをコピーする
_pkglist=(${pkglist[@]})
# Exclude packages from the exclusion list for each channel
excludefile="${script_path}/channels/${channel_name}/packages.${arch}/exclude"
if [[ -f "${excludefile}" ]]; then
- excludelist=( $(grep -h -v ^'#' "${excludefile}") )
+ excludelist=( $(grep -h -v ^'#' "${excludefile}" | sed ':a;N;$!ba;s/\n/ /g') )
# 現在のpkglistをコピーする
_pkglist=(${pkglist[@]})
shift 1
;;
-k | --kernel)
- if [[ -n $(cat ${script_path}/system/kernel_list-${arch} | grep -h -v ^'#' | grep -x "${2}") ]]; then
+ if [[ -n $(cat ${script_path}/system/kernel_list-${arch} | grep -h -v ^'#' | sed ':a;N;$!ba;s/\n/ /g' | grep -x "${2}") ]]; then
kernel="${2}"
else
_msg_error "Invalid kernel ${2}" "1"
# Check architecture and kernel for each channel
if [[ ! "${channel_name}" = "rebuild" ]] && [[ ! "${channel_name}" = "clean" ]]; then
# architecture
- if [[ -z $(cat "${script_path}/channels/${channel_name}/architecture" | grep -h -v ^'#' | grep -x "${arch}") ]]; then
+ if [[ -z $(cat "${script_path}/channels/${channel_name}/architecture" | grep -h -v ^'#' | sed ':a;N;$!ba;s/\n/ /g' | grep -x "${arch}") ]]; then
_msg_error "${channel_name} channel does not support current architecture (${arch})." "1"
fi
# kernel
if [[ -f "${script_path}/channels/${channel_name}/kernel_list-${arch}" ]]; then
- if [[ -z $(cat "${script_path}/channels/${channel_name}/kernel_list-${arch}" | grep -h -v ^'#' | grep -x "${kernel}") ]]; then
+ if [[ -z $(cat "${script_path}/channels/${channel_name}/kernel_list-${arch}" | grep -h -v ^'#' | sed ':a;N;$!ba;s/\n/ /g' | grep -x "${kernel}") ]]; then
_msg_error "This kernel is currently not supported on this channel." "1"
fi
fi
_chroot_init() {
mkdir -p ${work_dir}/airootfs
-
- #_pacman "base base-devel syslinux" <- old code
- _pacman "base syslinux"
+ _pacman base syslinux
}
_chroot_run() {
# Create an ISO9660 filesystem from "iso" directory.
command_iso () {
- local _iso_efi_boot_args=""
+ local _iso_efi_boot_args=()
if [[ ! -f "${work_dir}/iso/isolinux/isolinux.bin" ]]; then
_msg_error "The file '${work_dir}/iso/isolinux/isolinux.bin' does not exist." 1
# If exists, add an EFI "El Torito" boot image (FAT filesystem) to ISO-9660 image.
if [[ -f "${work_dir}/iso/EFI/archiso/efiboot.img" ]]; then
- _iso_efi_boot_args="-eltorito-alt-boot
- -e EFI/archiso/efiboot.img
- -no-emul-boot
- -isohybrid-gpt-basdat"
+ _iso_efi_boot_args+=(
+ '-eltorito-alt-boot'
+ '-e' 'EFI/archiso/efiboot.img'
+ '-no-emul-boot'
+ '-isohybrid-gpt-basdat'
+ )
fi
_show_config iso
mkdir -p "${out_dir}"
_msg_info "Creating ISO image..."
local _qflag=""
- if [[ ${quiet} == "y" ]]; then
- _qflag="-quiet"
+ if [[ "${quiet}" == "y" ]]; then
+ xorriso -as mkisofs -quiet \
+ -iso-level 3 \
+ -full-iso9660-filenames \
+ -volid "${iso_label}" \
+ -appid "${iso_application}" \
+ -publisher "${iso_publisher}" \
+ -preparer "prepared by mkarchiso" \
+ -eltorito-boot isolinux/isolinux.bin \
+ -eltorito-catalog isolinux/boot.cat \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ -isohybrid-mbr "${work_dir}/iso/isolinux/isohdpfx.bin" \
+ "${_iso_efi_boot_args[@]}" \
+ -output "${out_dir}/${img_name}" \
+ "${work_dir}/iso/"
+ else
+ xorriso -as mkisofs \
+ -iso-level 3 \
+ -full-iso9660-filenames \
+ -volid "${iso_label}" \
+ -appid "${iso_application}" \
+ -publisher "${iso_publisher}" \
+ -preparer "prepared by mkarchiso" \
+ -eltorito-boot isolinux/isolinux.bin \
+ -eltorito-catalog isolinux/boot.cat \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ -isohybrid-mbr "${work_dir}/iso/isolinux/isohdpfx.bin" \
+ "${_iso_efi_boot_args[@]}" \
+ -output "${out_dir}/${img_name}" \
+ "${work_dir}/iso/"
fi
- xorriso -as mkisofs ${_qflag} \
- -iso-level 3 \
- -full-iso9660-filenames \
- -volid "${iso_label}" \
- -appid "${iso_application}" \
- -publisher "${iso_publisher}" \
- -preparer "prepared by mkalteriso" \
- -eltorito-boot isolinux/isolinux.bin \
- -eltorito-catalog isolinux/boot.cat \
- -no-emul-boot -boot-load-size 4 -boot-info-table \
- -isohybrid-mbr ${work_dir}/iso/isolinux/isohdpfx.bin \
- ${_iso_efi_boot_args} \
- -output "${out_dir}/${img_name}" \
- "${work_dir}/iso/"
+
+
_mkisochecksum
_msg_info "Done! | $(ls -sh ${out_dir}/${img_name})"
}
_msg_error "Pacman config file '${pacman_conf}' does not exist" 1
fi
- #trim spaces
- pkg_list="$(echo ${pkg_list})"
-
- if [[ -z ${pkg_list} ]]; then
+ if [[ "${#pkg_list[@]}" -eq 0 ]]; then
_msg_error "Packages must be specified" 0
_usage 1
fi
_show_config install
- _pacman "${pkg_list}"
+ _pacman "${pkg_list[@]}"
}
command_init() {
while getopts 'a:p:r:C:L:P:A:D:w:o:s:c:g:t:vhx' arg; do
case "${arg}" in
a) arch="${OPTARG}" ;;
+ p)
+ read -r -a opt_pkg_list <<< "${OPTARG}"
+ pkg_list+=("${opt_pkg_list[@]}")
+ ;;
p) pkg_list="${pkg_list} ${OPTARG}" ;;
r) run_cmd="${OPTARG}" ;;
C) pacman_conf="${OPTARG}" ;;