_chroot_run "bash $([[ "${bash_debug}" = true ]] && echo -n "-x") /root/aur.sh ${_pkglist_aur[*]}"
# Remove script
- remove "${airootfs_dir}/root/aur.sh" "${airootfs_dir}/usr/local/bin/yay"
+ remove "${airootfs_dir}/root/aur.sh"
}
make_pkgbuild() {
#-- ビルドスクリプトの実行 --#
cp -rf --preserve=mode "${script_path}/system/pkgbuild.sh" "${airootfs_dir}/root/pkgbuild.sh"
- cp -rf --preserve=mode "/usr/bin/yay" "${airootfs_dir}/usr/local/bin/yay"
sed "s|https|http|g" "${work_dir}/pacman-${arch}.conf" > "${airootfs_dir}/etc/alteriso-pacman.conf"
# Run build script
_chroot_run "bash $([[ "${bash_debug}" = true ]] && echo -n "-x") /root/pkgbuild.sh /pkgbuilds"
# Remove script
- remove "${airootfs_dir}/root/pkgbuild.sh" "${airootfs_dir}/usr/local/bin/yay"
+ remove "${airootfs_dir}/root/pkgbuild.sh"
}
# Customize installation (airootfs)
sed -i "s/#Server/Server/g" "/etc/pacman.d/mirrorlist"
# Install yay
-if pacman -Qq yay 1> /dev/null 2>&1; then
- remove_yay=false
-else
+if ! pacman -Qq yay 1> /dev/null 2>&1; then
(
_oldpwd="$(pwd)"
pacman -Syy --noconfirm --config "/etc/alteriso-pacman.conf"
#eval $(cat "/etc/systemd/system/pacman-init.service" | grep 'ExecStart' | sed "s|ExecStart=||g" )
ls "/usr/share/pacman/keyrings/"*".gpg" | sed "s|.gpg||g" | xargs | pacman-key --populate
+# Un comment the mirror list.
+sed -i "s/#Server/Server/g" "/etc/pacman.d/mirrorlist"
+
+# Install yay
+if ! pacman -Qq yay 1> /dev/null 2>&1; then
+ (
+ _oldpwd="$(pwd)"
+ pacman -Syy --noconfirm --config "/etc/alteriso-pacman.conf"
+ pacman --noconfirm -S --asdeps --needed go --config "/etc/alteriso-pacman.conf"
+ sudo -u aurbuild git clone "https://aur.archlinux.org/yay.git" "/tmp/yay"
+ cd "/tmp/yay"
+ sudo -u aurbuild makepkg --ignorearch --clean --cleanbuild --force --skippgpcheck --noconfirm
+ pacman --noconfirm --config "/etc/alteriso-pacman.conf" -U $(sudo -u aurbuild makepkg --packagelist)
+ cd ..
+ rm -rf "/tmp/yay"
+ cd "${_oldpwd}"
+ )
+fi
+
+if ! type -p yay > /dev/null; then
+ echo "Failed to install yay"
+ exit 1
+fi
+
# Parse SRCINFO
cd "${pkgbuild_dir}"