summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pcr/chroot-nspawn/0001-Create-mount-points-if-mountpoint-exit-code-is-diffe.patch167
-rw-r--r--pcr/chroot-nspawn/PKGBUILD19
2 files changed, 180 insertions, 6 deletions
diff --git a/pcr/chroot-nspawn/0001-Create-mount-points-if-mountpoint-exit-code-is-diffe.patch b/pcr/chroot-nspawn/0001-Create-mount-points-if-mountpoint-exit-code-is-diffe.patch
new file mode 100644
index 000000000..12da0f2c1
--- /dev/null
+++ b/pcr/chroot-nspawn/0001-Create-mount-points-if-mountpoint-exit-code-is-diffe.patch
@@ -0,0 +1,167 @@
+From 319ac79c47f191e8c0aa2db4ea0eb248b8011bf3 Mon Sep 17 00:00:00 2001
+From: David P <megver83@parabola.nu>
+Date: Fri, 2 Jul 2021 22:51:20 -0400
+Subject: [PATCH] Create mount points if mountpoint exit code is different to
+ zero
+
+This is better than checking if the exit code equals to 1, as mountpoint will
+exit with code 32 if the directory exists but it's not a mount point.
+
+Plus, in the manpage says:
+EXIT STATUS
+ Zero if the directory or file is a mountpoint, non-zero if not.
+
+Signed-off-by: David P <megver83@parabola.nu>
+---
+ chroot-nspawn | 50 +++++++++++++++++++++++++-------------------------
+ 1 file changed, 25 insertions(+), 25 deletions(-)
+
+diff --git a/chroot-nspawn b/chroot-nspawn
+index 2e1fd8b..d4bc896 100755
+--- a/chroot-nspawn
++++ b/chroot-nspawn
+@@ -1126,7 +1126,7 @@ unset _SET_PRIVATE_NETWORK
+
+ # Mount a fake "/" file system
+ mountpoint -q $_SET_DIRECTORY
+-[ $? = 1 ] && mount -B $_SET_DIRECTORY $_SET_DIRECTORY
++[ $? != 0 ] && mount -B $_SET_DIRECTORY $_SET_DIRECTORY
+ mount --make-slave $_SET_DIRECTORY
+
+ # Bind directories
+@@ -1156,24 +1156,24 @@ unshare -Cfimpu $_UNSHARE_NETWORK --mount-proc --setgroups allow -- chroot $_SET
+
+ # Mount "/dev", "/proc", "/run", "/sys" and "/tmp" file systems
+ mountpoint -q /dev
+- [ $? = 1 ] && mount -t tmpfs tmpfs \
++ [ $? != 0 ] && mount -t tmpfs tmpfs \
+ -o rw,nosuid,mode=755 \
+ /dev
+ mountpoint -q /proc
+- [ $? = 1 ] && mount -t proc proc \
++ [ $? != 0 ] && mount -t proc proc \
+ -o rw,nosuid,nodev,noexec,relatime \
+ /proc
+ mountpoint -q /run
+- [ $? = 1 ] && mount -t tmpfs tmpfs \
++ [ $? != 0 ] && mount -t tmpfs tmpfs \
+ -o rw,nosuid,nodev,mode=755 \
+ /run
+ mountpoint -q /sys
+- [ $? = 1 ] && mount -t sysfs sysfs \
++ [ $? != 0 ] && mount -t sysfs sysfs \
+ -o ro,nosuid,nodev,noexec,relatime \
+ /sys
+
+ mountpoint -q /tmp
+- [ $? = 1 ] && mount -t tmpfs tmpfs \
++ [ $? != 0 ] && mount -t tmpfs tmpfs \
+ -o rw \
+ /tmp
+
+@@ -1225,43 +1225,43 @@ unshare -Cfimpu $_UNSHARE_NETWORK --mount-proc --setgroups allow -- chroot $_SET
+
+ # Mount needed file systems
+ # mountpoint -q /dev/console
+-# [ $? = 1 ] && mount -t devpts devpts \
++# [ $? != 0 ] && mount -t devpts devpts \
+ # -o rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 \
+ # /dev/console
+ mountpoint -q /dev/pts
+- [ $? = 1 ] && mount -t devpts devpts \
++ [ $? != 0 ] && mount -t devpts devpts \
+ -o rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666 \
+ /dev/pts
+ mountpoint -q /dev/shm
+- [ $? = 1 ] && mount -t tmpfs tmpfs \
++ [ $? != 0 ] && mount -t tmpfs tmpfs \
+ -o rw,nosuid,nodev \
+ /dev/shm
+ # mountpoint -q /proc/kmsg
+-# [ $? = 1 ] && mount -t tmpfs tmpfs \
++# [ $? != 0 ] && mount -t tmpfs tmpfs \
+ # -o rw,nosuid,nodev,mode=755 \
+ # /proc/kmsg
+ # mountpoint -q /proc/sys
+-# [ $? = 1 ] && mount -t proc proc \
++# [ $? != 0 ] && mount -t proc proc \
+ # -o ro,nosuid,nodev,noexec,relatime \
+ # /proc/sys
+ # mountpoint -q /proc/sys/kernel/random/boot_id
+-# [ $? = 1 ] && mount -t tmpfs tmpfs \
++# [ $? != 0 ] && mount -t tmpfs tmpfs \
+ # -o ro,nosuid,nodev,mode=755 \
+ # /proc/sys/kernel/random/boot_id
+ # mountpoint -q /proc/sys/kernel/random/boot_id
+-# [ $? = 1 ] && mount -t tmpfs tmpfs \
++# [ $? != 0 ] && mount -t tmpfs tmpfs \
+ # -o rw,nosuid,nodev,mode=755 \
+ # /proc/sys/kernel/random/boot_id
+ # mountpoint -q /proc/sysrq-trigger
+-# [ $? = 1 ] && mount -t proc proc \
++# [ $? != 0 ] && mount -t proc proc \
+ # -o ro,nosuid,nodev,noexec,relatime \
+ # /proc/sysrq-trigger
+ mountpoint -q /run/systemd/nspawn/incoming
+- [ $? = 1 ] && mount -t tmpfs tmpfs \
++ [ $? != 0 ] && mount -t tmpfs tmpfs \
+ -o ro,relatime,mode=755 \
+ /run/systemd/nspawn/incoming
+ mountpoint -q /sys/fs/cgroup
+- [ $? = 1 ] && mount -t tmpfs tmpfs \
++ [ $? != 0 ] && mount -t tmpfs tmpfs \
+ -o rw,nosuid,nodev,noexec,mode=755 \
+ /sys/fs/cgroup
+
+@@ -1299,39 +1299,39 @@ unshare -Cfimpu $_UNSHARE_NETWORK --mount-proc --setgroups allow -- chroot $_SET
+ -o remount,ro \
+ /sys/fs/cgroup
+ mountpoint -q /sys/fs/cgroup/blkio
+- [ $? = 1 ] && mount -t cgroup cgroup \
++ [ $? != 0 ] && mount -t cgroup cgroup \
+ -o ro,nosuid,nodev,noexec,relatime,blkio \
+ /sys/fs/cgroup/blkio
+ # mountpoint -q /sys/fs/cgroup/cpu,cpuacct
+-# [ $? = 1 ] && mount -t cgroup cgroup \
++# [ $? != 0 ] && mount -t cgroup cgroup \
+ # -o ro,nosuid,nodev,noexec,relatime,cpu,cpuacct \
+ # /sys/fs/cgroup/cpu,cpuacct
+ mountpoint -q /sys/fs/cgroup/cpuset
+- [ $? = 1 ] && mount -t cgroup cgroup \
++ [ $? != 0 ] && mount -t cgroup cgroup \
+ -o ro,nosuid,nodev,noexec,relatime,cpuset \
+ /sys/fs/cgroup/cpuset
+ mountpoint -q /sys/fs/cgroup/devices
+- [ $? = 1 ] && mount -t cgroup cgroup \
++ [ $? != 0 ] && mount -t cgroup cgroup \
+ -o ro,nosuid,nodev,noexec,relatime,devices \
+ /sys/fs/cgroup/devices
+ mountpoint -q /sys/fs/cgroup/freezer
+- [ $? = 1 ] && mount -t cgroup cgroup \
++ [ $? != 0 ] && mount -t cgroup cgroup \
+ -o ro,nosuid,nodev,noexec,relatime,freezer \
+ /sys/fs/cgroup/freezer
+ mountpoint -q /sys/fs/cgroup/memory
+- [ $? = 1 ] && mount -t cgroup cgroup \
++ [ $? != 0 ] && mount -t cgroup cgroup \
+ -o ro,nosuid,nodev,noexec,relatime,memory \
+ /sys/fs/cgroup/memory
+ # mountpoint -q /sys/fs/cgroup/net_cls,net_prio
+-# [ $? = 1 ] && mount -t cgroup cgroup \
++# [ $? != 0 ] && mount -t cgroup cgroup \
+ # -o ro,nosuid,nodev,noexec,relatime,net_cls,net_prio \
+ # /sys/fs/cgroup/net_cls,net_prio
+ mountpoint -q /sys/fs/cgroup/pids
+- [ $? = 1 ] && mount -t cgroup cgroup \
++ [ $? != 0 ] && mount -t cgroup cgroup \
+ -o ro,nosuid,nodev,noexec,relatime,pids \
+ /sys/fs/cgroup/pids
+ # mountpoint -q /sys/fs/cgroup/systemd
+-# [ $? = 1 ] && mount -t cgroup cgroup \
++# [ $? != 0 ] && mount -t cgroup cgroup \
+ # -o rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd \
+ # /sys/fs/cgroup/systemd
+
+--
+2.32.0
+
diff --git a/pcr/chroot-nspawn/PKGBUILD b/pcr/chroot-nspawn/PKGBUILD
index 249a53327..80aed02ce 100644
--- a/pcr/chroot-nspawn/PKGBUILD
+++ b/pcr/chroot-nspawn/PKGBUILD
@@ -1,27 +1,34 @@
# Maintainer (Hyperbola): André Silva <emulatorman@hyperbola.info>
# Maintainer (Hyperbola): Márcio Silva <coadde@hyperbola.info>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
+# Maintainer: David P. <megver83@parabola.nu>
-_pkgname=systemd-nspawn
pkgname=chroot-nspawn
pkgver=0.2.4
-pkgrel=1
+pkgrel=2
pkgdesc="A $_pkgname wrapper for chroot"
arch=(any)
url="https://git.hyperbola.info:50100/software/$pkgname.git"
license=(GPL3)
-#conflicts=(systemd)
-source=("https://repo.hyperbola.info:50000/sources/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})
+source=("https://repo.hyperbola.info:50000/sources/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig}
+ 0001-Create-mount-points-if-mountpoint-exit-code-is-diffe.patch)
sha512sums=('155ee3418056e883d28f2e2dfd4165a78d147fc94b31ea287cf032e1b3ff6a5212fb4ddeeacfb69dc4e69f9c25c321693429f5814e65005ae4b6fd50d3c5f08a'
- 'SKIP')
+ 'SKIP'
+ 'f5746d8e5e317dc5084137158ab620a0caad15204a359f7626ee9c0ab9610b3c91eae64cddea8124932cc2d215792f8eec7bf14041942b3dfbc9a56477315e6f')
validpgpkeys=('684D54A189305A9CC95446D36B888913DDB59515') # Márcio Silva
+prepare() {
+ cd $pkgname-$pkgver
+
+ # https://issues.hyperbola.info/index.php?do=details&task_id=1567
+ patch -Np1 -i ../0001-Create-mount-points-if-mountpoint-exit-code-is-diffe.patch
+}
+
package() {
cd $pkgname-$pkgver
install -d -m755 $pkgdir/usr/bin
install -m755 $pkgname $pkgdir/usr/bin/$pkgname
-# ln -s $pkgname $pkgdir/usr/bin/$_pkgname
install -d -m755 "$pkgdir"/usr/share/licenses/$pkgname
install -m644 COPYING "$pkgdir"/usr/share/licenses/$pkgname