From cc66dc63ed8de638d6909c7aac35d57b998e73e3 Mon Sep 17 00:00:00 2001 From: Vasiliy Stelmachenok <92667539+ventureoo@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:35:34 +0000 Subject: [PATCH] Fix config saving when building inside tmpfs (#285) When building inside tmpfs, ``$srcdir`` and ``$pkgdir``, their parent directory will not be the directory with PKGBUILD, but /tmp. So we need to read symlink of one of the files in ``$srcdir`` to figure out where the directory with PKGBUILD actually is. --- linux-cachyos-bore/PKGBUILD | 3 ++- linux-cachyos-deckify/PKGBUILD | 3 ++- linux-cachyos-echo/PKGBUILD | 3 ++- linux-cachyos-eevdf/PKGBUILD | 3 ++- linux-cachyos-hardened/PKGBUILD | 3 ++- linux-cachyos-lts/PKGBUILD | 3 ++- linux-cachyos-rc/PKGBUILD | 3 ++- linux-cachyos-rt-bore/PKGBUILD | 3 ++- linux-cachyos-sched-ext/PKGBUILD | 3 ++- linux-cachyos-server/PKGBUILD | 3 ++- linux-cachyos/PKGBUILD | 3 ++- 11 files changed, 22 insertions(+), 11 deletions(-) diff --git a/linux-cachyos-bore/PKGBUILD b/linux-cachyos-bore/PKGBUILD index 4d4a297b..35c75dd7 100644 --- a/linux-cachyos-bore/PKGBUILD +++ b/linux-cachyos-bore/PKGBUILD @@ -523,7 +523,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}" diff --git a/linux-cachyos-deckify/PKGBUILD b/linux-cachyos-deckify/PKGBUILD index dc290ffb..31d8aeb6 100644 --- a/linux-cachyos-deckify/PKGBUILD +++ b/linux-cachyos-deckify/PKGBUILD @@ -526,7 +526,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}" diff --git a/linux-cachyos-echo/PKGBUILD b/linux-cachyos-echo/PKGBUILD index 0b74e844..881ad95c 100644 --- a/linux-cachyos-echo/PKGBUILD +++ b/linux-cachyos-echo/PKGBUILD @@ -523,7 +523,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}" diff --git a/linux-cachyos-eevdf/PKGBUILD b/linux-cachyos-eevdf/PKGBUILD index 0cf8dea8..23a87970 100644 --- a/linux-cachyos-eevdf/PKGBUILD +++ b/linux-cachyos-eevdf/PKGBUILD @@ -523,7 +523,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}" diff --git a/linux-cachyos-hardened/PKGBUILD b/linux-cachyos-hardened/PKGBUILD index 2cc0ec30..a56b8c53 100644 --- a/linux-cachyos-hardened/PKGBUILD +++ b/linux-cachyos-hardened/PKGBUILD @@ -523,7 +523,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}" diff --git a/linux-cachyos-lts/PKGBUILD b/linux-cachyos-lts/PKGBUILD index ac6138f7..e16872d3 100644 --- a/linux-cachyos-lts/PKGBUILD +++ b/linux-cachyos-lts/PKGBUILD @@ -591,7 +591,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}" diff --git a/linux-cachyos-rc/PKGBUILD b/linux-cachyos-rc/PKGBUILD index 66c1807d..5b7641e6 100644 --- a/linux-cachyos-rc/PKGBUILD +++ b/linux-cachyos-rc/PKGBUILD @@ -525,7 +525,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}" diff --git a/linux-cachyos-rt-bore/PKGBUILD b/linux-cachyos-rt-bore/PKGBUILD index aa435f29..d58bf6d1 100644 --- a/linux-cachyos-rt-bore/PKGBUILD +++ b/linux-cachyos-rt-bore/PKGBUILD @@ -523,7 +523,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}" diff --git a/linux-cachyos-sched-ext/PKGBUILD b/linux-cachyos-sched-ext/PKGBUILD index 985c0f11..58ff5db0 100644 --- a/linux-cachyos-sched-ext/PKGBUILD +++ b/linux-cachyos-sched-ext/PKGBUILD @@ -523,7 +523,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}" diff --git a/linux-cachyos-server/PKGBUILD b/linux-cachyos-server/PKGBUILD index 42d416e4..7f89b0ba 100644 --- a/linux-cachyos-server/PKGBUILD +++ b/linux-cachyos-server/PKGBUILD @@ -523,7 +523,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}" diff --git a/linux-cachyos/PKGBUILD b/linux-cachyos/PKGBUILD index 7afb270c..484aa07a 100644 --- a/linux-cachyos/PKGBUILD +++ b/linux-cachyos/PKGBUILD @@ -523,7 +523,8 @@ prepare() { ### Save configuration for later reuse echo "Save configuration for later reuse..." - cat .config > "${srcdir}/../config-${pkgver}-${pkgrel}${pkgbase#linux}" + local basedir="$(dirname "$(readlink "${srcdir}/config")")" + cat .config > "${basedir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" if [ -n "$_build_nvidia" ]; then cd "${srcdir}"