OSDN Git Service

[update] : Build yay for pkgbuild
authorhayao <hayao@fascode.net>
Sat, 20 Mar 2021 15:23:26 +0000 (00:23 +0900)
committerhayao <hayao@fascode.net>
Sat, 20 Mar 2021 15:23:26 +0000 (00:23 +0900)
build.sh
system/aur.sh
system/pkgbuild.sh

index 011aa6b..feebb7f 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -588,7 +588,7 @@ make_packages_aur() {
     _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() {
@@ -604,14 +604,13 @@ 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)
index 738d101..386ef8c 100755 (executable)
@@ -58,9 +58,7 @@ ls "/usr/share/pacman/keyrings/"*".gpg" | sed "s|.gpg||g" | xargs | pacman-key -
 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"
index a3a616f..a63b55c 100755 (executable)
@@ -81,6 +81,30 @@ pacman-key --init
 #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}"