From 50fd96a70e9e73d3a927396cd30f46c8cea5b1af Mon Sep 17 00:00:00 2001
From: Recolic <git@me.recolic.net>
Date: Mon, 6 Jan 2025 18:42:02 -0800
Subject: [PATCH] .

---
 docker-aurutils/Dockerfile        | 17 +++++++++++++++++
 docker-aurutils/install-pikaur.sh | 17 +++++++++++++++++
 docker-yay/Dockerfile             | 17 +++++++++++++++++
 docker-yay/install-pikaur.sh      | 19 +++++++++++++++++++
 docker-yay/noinstall.patch        | 30 ++++++++++++++++++++++++++++++
 5 files changed, 100 insertions(+)
 create mode 100644 docker-aurutils/Dockerfile
 create mode 100755 docker-aurutils/install-pikaur.sh
 create mode 100644 docker-yay/Dockerfile
 create mode 100755 docker-yay/install-pikaur.sh
 create mode 100644 docker-yay/noinstall.patch

diff --git a/docker-aurutils/Dockerfile b/docker-aurutils/Dockerfile
new file mode 100644
index 0000000..8a69250
--- /dev/null
+++ b/docker-aurutils/Dockerfile
@@ -0,0 +1,17 @@
+# docker run -ti -v (pwd)/recolic-aur:/home/builder/.cache/pikaur/pkg recolic/pikaur      bash -c 'chown builder -R /home/builder/.cache/pikaur/pkg && sudo -u builder pikaur -Sw --noconfirm $pkgs'
+# You can reuse the container (commit it as new image) after running first build. There may be tons of dependencies to be downloaded. 
+
+FROM archlinux:base-devel
+
+COPY install-pikaur.sh /
+RUN bash /install-pikaur.sh
+RUN pacman -S --noconfirm go
+RUN useradd -m builder && echo 'builder ALL=(ALL) NOPASSWD: ALL' | EDITOR='tee -a' visudo
+# To prevent docker from creating a root-only dir
+RUN sudo -u builder mkdir -p /home/builder/.cache/pikaur/build && \
+    sed -i 's/check_pgpsigs() {/check_pgpsigs() { return 0/g' /usr/share/makepkg/integrity/verify_signature.sh && \
+    sed -i 's/SigLevel.*$/SigLevel = Never/' /etc/pacman.conf
+# makepkg auto-key-retrieve is not working. This is my only solution. 
+# pacman will complain about expired GPG keys if the image is not updated. Disable the SigLevel verify to avoid these error. 
+
+
diff --git a/docker-aurutils/install-pikaur.sh b/docker-aurutils/install-pikaur.sh
new file mode 100755
index 0000000..892004f
--- /dev/null
+++ b/docker-aurutils/install-pikaur.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# pacman -Sy --noconfirm git pyalpm python-commonmark python-pip python-build python-installer python-setuptools python-markdown-it-py python-hatchling &&
+pacman -Sy --noconfirm git pacutils perl-json-xs &&
+git clone https://aur.archlinux.org/aurutils.git &&
+chmod 777 -R aurutils &&
+cd aurutils &&
+sudo -u nobody makepkg &&
+pacman -U --noconfirm *.pkg.*
+exit $?
+
+#mkdir -p /repo
+#cd /repo ; repo-add recolic-aur.db.tar.gz
+#AUR_ASROOT=1 aur sync -d recolic-aur --root=/repo teamviewer
+#
+#chmod 777 -R /root
+#AUR_ASROOT=1 aur build -d recolic-aur --root=/repo teamviewer
+
diff --git a/docker-yay/Dockerfile b/docker-yay/Dockerfile
new file mode 100644
index 0000000..8a69250
--- /dev/null
+++ b/docker-yay/Dockerfile
@@ -0,0 +1,17 @@
+# docker run -ti -v (pwd)/recolic-aur:/home/builder/.cache/pikaur/pkg recolic/pikaur      bash -c 'chown builder -R /home/builder/.cache/pikaur/pkg && sudo -u builder pikaur -Sw --noconfirm $pkgs'
+# You can reuse the container (commit it as new image) after running first build. There may be tons of dependencies to be downloaded. 
+
+FROM archlinux:base-devel
+
+COPY install-pikaur.sh /
+RUN bash /install-pikaur.sh
+RUN pacman -S --noconfirm go
+RUN useradd -m builder && echo 'builder ALL=(ALL) NOPASSWD: ALL' | EDITOR='tee -a' visudo
+# To prevent docker from creating a root-only dir
+RUN sudo -u builder mkdir -p /home/builder/.cache/pikaur/build && \
+    sed -i 's/check_pgpsigs() {/check_pgpsigs() { return 0/g' /usr/share/makepkg/integrity/verify_signature.sh && \
+    sed -i 's/SigLevel.*$/SigLevel = Never/' /etc/pacman.conf
+# makepkg auto-key-retrieve is not working. This is my only solution. 
+# pacman will complain about expired GPG keys if the image is not updated. Disable the SigLevel verify to avoid these error. 
+
+
diff --git a/docker-yay/install-pikaur.sh b/docker-yay/install-pikaur.sh
new file mode 100755
index 0000000..0ac9e0e
--- /dev/null
+++ b/docker-yay/install-pikaur.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+pacman -Sy --noconfirm git wget sudo &&
+    wget https://recolic.net/tmp/yay -O /yay &&
+    chmod +x /yay
+# yay with noinstall patch
+
+#&&
+#  mkdir /home/nobody &&
+#  chown nobody:nobody /home/nobody/ &&
+#
+#git clone https://aur.archlinux.org/yay.git &&
+#chmod 777 -R yay &&
+#cd yay &&
+#sudo -u nobody makepkg &&
+#pacman -U --noconfirm *.pkg.*
+#exit $?
+
+# usage
+#
diff --git a/docker-yay/noinstall.patch b/docker-yay/noinstall.patch
new file mode 100644
index 0000000..f9f4886
--- /dev/null
+++ b/docker-yay/noinstall.patch
@@ -0,0 +1,30 @@
+diff --git a/pkg/sync/build/installer.go b/pkg/sync/build/installer.go
+index a01815d..764162d 100644
+--- a/pkg/sync/build/installer.go
++++ b/pkg/sync/build/installer.go
+@@ -276,14 +276,17 @@ func (installer *Installer) installAURPackages(ctx context.Context,
+                }
+        }
+ 
+-       if err := installPkgArchive(ctx, installer.exeCmd, installer.targetMode,
+-               installer.vcsStore, cmdArgs, pkgArchives, noConfirm); err != nil {
+-               return fmt.Errorf("%s - %w", fmt.Sprintf(gotext.Get("error installing:")+" %v", pkgArchives), err)
+-       }
++       // TODO: package has been built. DO NOT install.
++       println("DEBUG: built pkg: ", installer.exeCmd)
+ 
+-       if err := setInstallReason(ctx, installer.exeCmd, installer.targetMode, cmdArgs, deps, exps); err != nil {
+-               return fmt.Errorf("%s - %w", fmt.Sprintf(gotext.Get("error installing:")+" %v", pkgArchives), err)
+-       }
++       // if err := installPkgArchive(ctx, installer.exeCmd, installer.targetMode,
++       //      installer.vcsStore, cmdArgs, pkgArchives, noConfirm); err != nil {
++       //      return fmt.Errorf("%s - %w", fmt.Sprintf(gotext.Get("error installing:")+" %v", pkgArchives), err)
++       // }
++
++       // if err := setInstallReason(ctx, installer.exeCmd, installer.targetMode, cmdArgs, deps, exps); err != nil {
++       //      return fmt.Errorf("%s - %w", fmt.Sprintf(gotext.Get("error installing:")+" %v", pkgArchives), err)
++       // }
+ 
+        return nil
+ }
+
-- 
GitLab