for_module load_config "${module_dir}/{}/config.any" "${module_dir}/{}/config.${arch}"
msg_debug "Loaded modules: ${modules[*]}"
! printf "%s\n" "${modules[@]}" | grep -x "share" >/dev/null 2>&1 && msg_warn "The share module is not loaded."
+ ! printf "%s\n" "${modules[@]}" | grep -x "base" >/dev/null 2>&1 && msg_error "The base module is not loaded." 1
# Set kernel
[[ "${customized_kernel}" = false ]] && kernel="${defaultkernel}"
pkglist_args+=("${modules[@]}")
# Set argument of aur.sh and pkgbuild.sh
- makepkg_script_args+=("-a" "${aur_helper}" "-p" "$(printf "%s\n" "${aur_helper_depends[@]}" | tr "\n" ",")" )
[[ "${bash_debug}" = true ]] && makepkg_script_args+=("-x")
- [[ "${pacman_debug}" = true ]] && makepkg_script_args+=("-d")
+ [[ "${pacman_debug}" = true ]] && makepkg_script_args+=("-c")
return 0
}
make_packages_aur() {
readarray -t _pkglist_aur < <("${tools_dir}/pkglist.sh" --aur "${pkglist_args[@]}")
_pkglist_aur=("${_pkglist_aur[@]}" "${norepopkg[@]}")
+ _aursh_args=(
+ "-a" "${aur_helper_command}" -e "${aur_helper_package}"
+ "-d" "$(printf "%s\n" "${aur_helper_depends[@]}" | tr "\n" ",")"
+ "-p" "$(printf "%s\n" "${_pkglist_aur[@]}" | tr "\n" ",")"
+ "${makepkg_script_args[@]}" -- "${aur_helper_args[@]}"
+ )
# Create a list of packages to be finally installed as packages.list directly under the working directory.
echo -e "\n# AUR packages.\n#\n" >> "${build_dir}/packages.list"
_pacstrap --asdeps --needed "${aur_helper_depend[@]}"
# Run aur script
- _run_with_pacmanconf _chroot_run "bash" "/root/aur.sh" -a "${aur_helper}" "${makepkg_script_args[@]}" "${_pkglist_aur[@]}"
+ _run_with_pacmanconf _chroot_run "bash" "/root/aur.sh" "${_aursh_args[@]}"
# Remove script
remove "${airootfs_dir}/root/aur.sh"
failedpkg=()
remove_list=()
aur_helper_depends=("go")
-aur_helper="yay"
+aur_helper_command="yay"
+aur_helper_package="yay"
+aur_helper_args=()
+pkglist=()
trap 'exit 1' 1 2 3 15
_help() {
- echo "usage ${0} [option] [package1] [package2] ..."
+ echo "usage ${0} [option] [aur helper args] ..."
echo
- echo "Install aur packages with ${aur_helper}"
+ echo "Install aur packages with ${aur_helper_command}"
echo
echo " General options:"
echo " -a [command] Set the command of aur helper"
- echo " -p [pkg1,pkg2...] Set the oackage of the depends of aur helper"
- echo " -d Enable pacman debug message"
+ echo " -c Enable pacman debug message"
+ echo " -e [pkg] Set the package name of aur helper"
+ echo " -d [pkg1,pkg2...] Set the oackage of the depends of aur helper"
+ echo " -p [pkg1,pkg2...] Set the AUR package to install"
echo " -u [user] Set the user name to build packages"
echo " -x Enable bash debug message"
echo " -h This help message"
}
-while getopts "a:p:du:xh" arg; do
+while getopts "a:cd:e:p:u:xh" arg; do
case "${arg}" in
a) aur_helper="${OPTARG}" ;;
- d) pacman_debug=true ;;
+ c) pacman_debug=true ;;
+ e) aur_helper_command="${OPTARG}" ;;
+ p) readarray -t pkglist < <(tr "," "\n" <<< "${OPTARG}") ;;
+ d) readarray -t aur_helper_depends < <(tr "," "\n" <<< "${OPTARG}") ;;
u) aur_username="${OPTARG}" ;;
x) set -xv ;;
- p) readarray -t aur_helper_depends < <(tr "," "\n" <<< "${OPTARG}") ;;
h)
_help
exit 0
done
shift "$((OPTIND - 1))"
+aur_helper_args=("${@}")
+eval set -- "${pkglist[@]}"
# Show message when file is removed
# remove <file> <file> ...
fi
# Install
-if ! pacman -Qq "${aur_helper}" 1> /dev/null 2>&1; then
+if ! pacman -Qq "${aur_helper_package}" 1> /dev/null 2>&1; then
# Update database
_oldpwd="$(pwd)"
pacman -Syy "${pacman_args[@]}"
if ! pacman -Qq "${_pkg}" > /dev/null 2>&1 | grep -q "${_pkg}"; then
# --asdepsをつけているのでaur.shで削除される --neededをつけているので明示的にインストールされている場合削除されない
pacman -S --asdeps --needed "${pacman_args[@]}" "${_pkg}"
- remove_list+=("${_pkg}")
+ #remove_list+=("${_pkg}")
fi
done
# Build
- sudo -u "${aur_username}" git clone "https://aur.archlinux.org/${aur_helper}.git" "/tmp/${aur_helper}"
- cd "/tmp/${aur_helper}"
+ sudo -u "${aur_username}" git clone "https://aur.archlinux.org/${aur_helper_package}.git" "/tmp/${aur_helper_package}"
+ cd "/tmp/${aur_helper_package}"
sudo -u "${aur_username}" makepkg --ignorearch --clean --cleanbuild --force --skippgpcheck --noconfirm
# Install
# Remove debtis
cd ..
- remove "/tmp/${aur_helper}"
+ remove "/tmp/${aur_helper_package}"
cd "${_oldpwd}"
fi
-if ! type -p "${aur_helper}" > /dev/null; then
- echo "Failed to install ${aur_helper}"
+if ! type -p "${aur_helper_command}" > /dev/null; then
+ echo "Failed to install ${aur_helper_package}"
exit 1
fi
installpkg(){
yes | sudo -u "${aur_username}" \
- "${aur_helper}" -Sy \
- --mflags "-AcC" \
- --aur \
- --nocleanmenu \
- --nodiffmenu \
- --noeditmenu \
- --noupgrademenu \
- --noprovides \
- --removemake \
- --useask \
+ "${aur_helper_command}" -Sy \
--color always \
- --mflags "--skippgpcheck" \
- "${pacman_args[@]}" \
--cachedir "/var/cache/pacman/pkg/" \
+ "${pacman_args[@]}" \
+ "${aur_helper_args[@]}" \
"${@}" || true
}
(( "${#remove_list[@]}" != 0 )) && pacman -Rsnc "${remove_list[@]}" "${pacman_args[@]}"
# Clean up
-"${aur_helper}" -Sccc "${pacman_args[@]}"
+"${aur_helper_command}" -Sccc "${pacman_args[@]}"
# remove user and file
userdel "${aur_username}"