feat: add fakeroot with patch limit
This commit is contained in:
parent
d1705756c8
commit
9c93d40800
4 changed files with 144 additions and 0 deletions
22
fakeroot/.SRCINFO
Normal file
22
fakeroot/.SRCINFO
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
pkgbase = fakeroot
|
||||||
|
pkgdesc = Tool for simulating superuser privileges
|
||||||
|
pkgver = 1.31
|
||||||
|
pkgrel = 3
|
||||||
|
url = https://tracker.debian.org/pkg/fakeroot
|
||||||
|
install = fakeroot.install
|
||||||
|
arch = x86_64
|
||||||
|
license = GPL
|
||||||
|
checkdepends = sharutils
|
||||||
|
makedepends = systemd
|
||||||
|
makedepends = po4a
|
||||||
|
depends = glibc
|
||||||
|
depends = filesystem
|
||||||
|
depends = sed
|
||||||
|
depends = util-linux
|
||||||
|
depends = sh
|
||||||
|
source = https://deb.debian.org/debian/pool/main/f/fakeroot/fakeroot_1.31.orig.tar.gz
|
||||||
|
source = optimize-fd-closing.patch
|
||||||
|
sha256sums = 63886d41e11c56c7170b9d9331cca086421b350d257338ef14daad98f77e202f
|
||||||
|
sha256sums = 848d4157c6332c387df229beb5645223b5adce11d9ba9002e70322564447465a
|
||||||
|
|
||||||
|
pkgname = fakeroot
|
54
fakeroot/PKGBUILD
Normal file
54
fakeroot/PKGBUILD
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# Maintainer: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
|
||||||
|
# Contributor: Allan McRae <allan@archlinux.org>
|
||||||
|
# Contributor: Jochem Kossen <j.kossen@home.nl>
|
||||||
|
|
||||||
|
pkgname=fakeroot
|
||||||
|
pkgver=1.31
|
||||||
|
pkgrel=3
|
||||||
|
pkgdesc='Tool for simulating superuser privileges'
|
||||||
|
arch=('x86_64')
|
||||||
|
license=('GPL')
|
||||||
|
url='https://tracker.debian.org/pkg/fakeroot'
|
||||||
|
install=fakeroot.install
|
||||||
|
depends=('glibc' 'filesystem' 'sed' 'util-linux' 'sh')
|
||||||
|
makedepends=('systemd' 'po4a')
|
||||||
|
checkdepends=('sharutils')
|
||||||
|
source=("https://deb.debian.org/debian/pool/main/f/$pkgname/${pkgname}_${pkgver}.orig.tar.gz"
|
||||||
|
optimize-fd-closing.patch)
|
||||||
|
sha256sums=('63886d41e11c56c7170b9d9331cca086421b350d257338ef14daad98f77e202f'
|
||||||
|
'848d4157c6332c387df229beb5645223b5adce11d9ba9002e70322564447465a')
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
cd $pkgname-$pkgver
|
||||||
|
patch -Np1 < ../optimize-fd-closing.patch
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd $pkgname-$pkgver
|
||||||
|
|
||||||
|
./configure --prefix=/usr \
|
||||||
|
--libdir=/usr/lib/libfakeroot \
|
||||||
|
--disable-static \
|
||||||
|
--with-ipc=sysv
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
cd doc
|
||||||
|
po4a -k 0 --rm-backups --variable 'srcdir=../doc/' po4a/po4a.cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cd $pkgname-$pkgver
|
||||||
|
make check
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd $pkgname-$pkgver
|
||||||
|
make DESTDIR="$pkgdir" install
|
||||||
|
|
||||||
|
install -dm0755 "$pkgdir/etc/ld.so.conf.d/"
|
||||||
|
echo '/usr/lib/libfakeroot' > "$pkgdir/etc/ld.so.conf.d/fakeroot.conf"
|
||||||
|
|
||||||
|
# install README for sysv/tcp usage
|
||||||
|
install -Dm0644 README "$pkgdir/usr/share/doc/$pkgname/README"
|
||||||
|
}
|
13
fakeroot/fakeroot.install
Normal file
13
fakeroot/fakeroot.install
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
post_install() {
|
||||||
|
usr/bin/ldconfig -r .
|
||||||
|
}
|
||||||
|
|
||||||
|
post_upgrade() {
|
||||||
|
usr/bin/ldconfig -r .
|
||||||
|
}
|
||||||
|
|
||||||
|
pre_remove() {
|
||||||
|
usr/bin/ldconfig -r .
|
||||||
|
}
|
55
fakeroot/optimize-fd-closing.patch
Normal file
55
fakeroot/optimize-fd-closing.patch
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
Description: Optimize file descriptor closing
|
||||||
|
Closing all the fds is a severe performance issue in containers when
|
||||||
|
ulimit is high. We fixed that in APT a long time ago, time to apply
|
||||||
|
the same fix here.
|
||||||
|
Author: Julian Andres Klode <juliank@ubuntu.com>
|
||||||
|
|
||||||
|
--- a/faked.c
|
||||||
|
+++ b/faked.c
|
||||||
|
@@ -107,6 +107,7 @@
|
||||||
|
#ifdef HAVE_SYS_XATTR_H
|
||||||
|
#include <sys/xattr.h>
|
||||||
|
#endif
|
||||||
|
+#include <dirent.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
@@ -1502,16 +1503,32 @@ int main(int argc, char **argv){
|
||||||
|
/* literally copied from the linux klogd code, go to background */
|
||||||
|
if ((pid=fork()) == 0){
|
||||||
|
int fl;
|
||||||
|
- int num_fds = getdtablesize();
|
||||||
|
+ DIR *dir;
|
||||||
|
|
||||||
|
- fflush(stdout);
|
||||||
|
+ dir = opendir("/proc/self/fd");
|
||||||
|
+ if (dir != NULL) {
|
||||||
|
+ struct dirent *ent;
|
||||||
|
+ int dfd = dirfd(dir);
|
||||||
|
+ while (ent = readdir(dir)) {
|
||||||
|
+ fl = atoi(ent->d_name);
|
||||||
|
+ if (fl >= 0 && fl != dfd)
|
||||||
|
+#ifdef FAKEROOT_FAKENET
|
||||||
|
+ if (fl != sd)
|
||||||
|
+#endif /* FAKEROOT_FAKENET */
|
||||||
|
+ close(fl);
|
||||||
|
+ }
|
||||||
|
+ closedir(dir);
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ int num_fds = getdtablesize();
|
||||||
|
|
||||||
|
- /* This is the child closing its file descriptors. */
|
||||||
|
- for (fl= 0; fl <= num_fds; ++fl)
|
||||||
|
+ /* This is the child closing its file descriptors. */
|
||||||
|
+ for (fl= 0; fl <= num_fds; ++fl)
|
||||||
|
#ifdef FAKEROOT_FAKENET
|
||||||
|
- if (fl != sd)
|
||||||
|
+ if (fl != sd)
|
||||||
|
#endif /* FAKEROOT_FAKENET */
|
||||||
|
- close(fl);
|
||||||
|
+ close(fl);
|
||||||
|
+ }
|
||||||
|
setsid();
|
||||||
|
} else {
|
||||||
|
printf("%li:%i\n",(long)FAKE_KEY,pid);
|
Loading…
Add table
Add a link
Reference in a new issue