galeb

Једноставна статичка дистрибуција заснована на musl-у
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 3eab5ac093fde6c7064686ebae9e95f387e9a257
родитељ 8ccd5773d3d3a9604d8cc229b0832364b1dfd328
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Sun, 31 Jul 2022 17:16:54 +0200

Add PRoot

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
M03-packages.sh | 175++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
M04-finale.sh | 7+++++++
Mlib/fun.sh | 32+++++++++++++++++++++++---------
Mlib/pkgs.tsv | 3+++
Apat/proot-galeb/proot-makefile.patch | 41+++++++++++++++++++++++++++++++++++++++++
Apat/sbase-galeb/sbase-tar-n.patch | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
измењених датотека: 6, додавања: 326(+), брисања: 10(-)

diff --git a/03-packages.sh b/03-packages.sh @@ -3372,6 +3372,46 @@ mkpk_install() fi end_substep +# Needed for PRoot +begin_substep libarchive-3.6.1 +if [ -e /sucks/lib/libarchive.so.13.6.1 ]; then + msg info "%s exists, skipping %s" /sucks/lib/libarchive.so.13.6.1 ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz + ( + cd_or_fail ${G_SRC}/${pkg} + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + CFLAGS='-Os -pipe' + LDFLAGS='-s' + DESTDIR=/build + export CFLAGS LDFLAGS DESTDIR YACC + + ./configure --prefix=/sucks \\ + --disable-bsdcat \\ + --disable-bsdcpio \\ + --disable-bsdtar || exit 1 + + make ${JN} || exit 1 + make install || exit 1 +} +! + mkpk ${pkg} + remove_dir ${G_SRC}/${pkg} + unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep + begin_substep kbd-2.4.0 if [ -x /bin/loadkeys ]; then msg info "%s exists, skipping %s" /bin/loadkeys ${pkg} @@ -3638,7 +3678,7 @@ mkpk_install() ./autogen.sh - ./configure --prefix=/sucks || exit 1 + ./configure --prefix=/sucks --sysconfdir=/etc || exit 1 make ${JN} || exit 1 make install-strip @@ -3727,6 +3767,83 @@ mkpk_install() fi end_substep +# Needed for PRoot +begin_substep talloc-2.3.4 +if [ -e /sucks/lib/libtalloc.so.2.3.4 ]; then + msg info "%s exists, skipping %s" /sucks/lib/libtalloc.so.2.3.4 ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz + ( + cd_or_fail ${G_SRC}/${pkg} + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + CFLAGS='-Os -pipe' + LDFLAGS='-s' + DESTDIR=/build + export CFLAGS LDFLAGS DESTDIR YACC + + ./configure --prefix=/sucks \\ + --destdir="\${DESTDIR}" || exit 1 + + make ${JN} || exit 1 + make install || exit 1 +} +! + mkpk ${pkg} + remove_dir ${G_SRC}/${pkg} + unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep + +begin_substep proot-5.3.1 +if [ -e /sucks/bin/proot ]; then + msg info "%s exists, skipping %s" /sucks/lib/libtalloc.so.2.3.4 ${pkg} +elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then + unpack_pkg ${pkg} / +else + extract_pkg ${G_SRC} proot-v5.3.1 ${pkg}.tar.bz2 ${pkg} + ( + cd_or_fail ${G_SRC}/${pkg} + + apply_patch packages -Np0 -i \ + ${G_PAT}/proot-galeb/proot-makefile.patch + + cat <<! >MKPK +mkpk_name() +{ + printf "%s" "${pkg}" +} + +mkpk_install() +{ + CFLAGS='-Os -pipe' + LDFLAGS='-s' + DESTDIR=/build + export CFLAGS LDFLAGS DESTDIR YACC + + make -C src loader.elf loader-m32.elf build.h || exit 1 + make -C src proot || exit 1 + + install -Dm755 src/proot /build/sucks/bin/proot +} +! + mkpk ${pkg} + remove_dir ${G_SRC}/${pkg} + #unpack_pkg ${pkg} / + ) || exit 1 +fi +end_substep + begin_substep texinfo-6.8 if [ -x /sucks/bin/texi2dvi ]; then msg info "%s exists, skipping %s" /sucks/bin/texi2dvi ${pkg} @@ -4947,6 +5064,62 @@ mkpk_install() fi end_substep +# Didn't work; chown in fakeroot just showed regular user. +# I suspected this was due to the necessity of having dynamic executables, but +# I got the same result even after subsequently creating and using a separate +# set of dynamically-linked sbase/ubase/9base, Probably this went deeper to +# /lib/ld-musl* being a static-pie executable instead of dynamic, which was just +# too much hassle to tinker with for me. +# +# Replaced with PRoot. + +# https://deb.debian.org/debian/pool/main/f/fakeroot/fakeroot_1.29.orig.tar.gz fakeroot-1.29.tar.gz cab9604a7dc1d58346e0d15bb285bd0f + +# begin_substep fakeroot-1.29 +# if [ -x /sucks/bin/fakeroot ]; then +# msg info "%s exists, skipping %s" /sucks/bin/fakeroot ${pkg} +# elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then +# unpack_pkg ${pkg} / +# else +# extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz +# ( +# cd_or_fail ${G_SRC}/${pkg} +# +# apply_patch packages -Np1 -i \ +# ${G_PAT}/fakeroot-alpine/fakeroot-stdint.patch +# apply_patch packages -Np1 -i \ +# ${G_PAT}/fakeroot-openwrt/400-alpine-libc.musl-fix.patch +# +# cat <<! >MKPK +# mkpk_name() +# { +# printf "%s" "${pkg}" +# } +# +# mkpk_install() +# { +# CFLAGS='-Os -pipe' +# CFLAGS+=' -D_STAT_VER=0' +# LDFLAGS='-s' +# DESTDIR=/build +# export CFLAGS LDFLAGS DESTDIR +# +# ./configure --prefix=/sucks \\ +# --with-sysconfdir=/etc \\ +# --with-localstatedir=/var \\ +# --with-docdir=/sucks/share/doc/${pkg} \\ +# --enable-shared || exit 1 +# make ${JN} || exit 1 +# make install-strip || exit 1 +# } +# ! +# mkpk ${pkg} +# remove_dir ${G_SRC}/${pkg} +# unpack_pkg ${pkg} / +# ) || exit 1 +# fi +# end_substep + begin_substep farbfeld-20220722 if [ -e /bin/2ff ]; then msg info "%s exists, skipping %s" /bin/2ff ${pkg} diff --git a/04-finale.sh b/04-finale.sh @@ -130,6 +130,9 @@ else ( cd_or_fail ${G_SRC}/${pkg} + apply_patch finale -Np1 -i \ + ${G_PAT}/sbase-galeb/sbase-tar-n.patch + cat <<! >MKPK mkpk_name() { @@ -268,6 +271,10 @@ msg info "makewhatis /share/man" makewhatis /share/man msg info "makewhatis /sucks/share/man" makewhatis /sucks/share/man +msg info "libtool --finish /lib" +libtool --finish /lib +msg info "libtool --finish /sucks/lib" +libtool --finish /sucks/lib msg info "Generating /etc/galeb-release" cat <<! >/etc/galeb-release diff --git a/lib/fun.sh b/lib/fun.sh @@ -348,16 +348,30 @@ mkpk() cd .. mkdir -p bin build dev etc include share sucks tmp tools + + bm() + { + local dir=$1 + mount -B /${dir} ./${dir} + } + + rbm() + { + local dir=$1 + mount -B /${dir} ./${dir} + mount -o remount,bind,ro /${dir} ./${dir} + } + msg info "mkpk mounting..." - mount -B /bin ./bin -o ro - mount -B /dev ./dev - mount -B /etc ./etc - mount -B /include ./include -o ro - mount -B /lib ./lib -o ro - mount -B /share ./share -o ro - mount -B /sucks ./sucks -o ro - mount -B /tmp ./tmp -o ro - mount -B /tools ./tools -o ro + rbm bin + rbm dev + rbm etc + rbm include + rbm lib + rbm share + rbm sucks + bm tmp + rbm tools g_ln -s . usr cd ${pkg} :>../timestamp diff --git a/lib/pkgs.tsv b/lib/pkgs.tsv @@ -137,3 +137,6 @@ https://www.leonerd.org.uk/code/libtermkey/libtermkey-0.22.tar.gz 08bf514d59660 https://www.nico.schottelius.org/software/gpm/archives/gpm-1.20.7.tar.bz2 bf84143905a6a903dbd4d4b911a2a2b8 https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz 11d12076311563252a995201248d17e5 https://www.zlib.net/pigz/pigz-2.7.tar.gz 2d084221ba829d29f344305845a313f3 +https://github.com/libarchive/libarchive/releases/download/v3.6.1/libarchive-3.6.1.tar.xz 9465f7995649c9ea84854a7fd8c76f30 +https://www.samba.org/ftp/talloc/talloc-2.3.4.tar.gz ffdaf52a6572307cc3b6487b9e99cd61 +https://gitlab.com/proot/proot/-/archive/v5.3.1/proot-v5.3.1.tar.bz2 proot-5.3.1.tar.bz2 1000e9eb93c14688359dfd2e7a549d81 diff --git a/pat/proot-galeb/proot-makefile.patch b/pat/proot-galeb/proot-makefile.patch @@ -0,0 +1,41 @@ +--- src/GNUmakefile 2022-04-24 22:52:11.000000000 +0200 ++++ src/GNUmakefile 2022-07-31 13:32:15.897932149 +0200 +@@ -119,18 +119,32 @@ + ###################################################################### + # Auto-configuration + +-GIT_VERSION := $(shell git describe --tags `git rev-list --tags --max-count=1`) ++# Just badly written. - [SR] ++# - not taking into account people who build from tarball, when the directory ++# is not a git repository ++GIT_VERSION := $(shell git describe --tags \ ++ `git rev-list --tags --max-count=1 2>/dev/null` 2>/dev/null) + +-GIT_COMMIT := $(shell git rev-list --all --max-count=1 | cut -c 1-8) ++GIT_COMMIT := $(shell git rev-list --all --max-count=1 2>/dev/null | cut -c 1-8) + ++ifneq ($(strip $(GIT_VERSION)),) + VERSION = $(GIT_VERSION)-$(GIT_COMMIT) ++else ++# Fallback ++VERSION = 5.3.1 ++endif + +-CHECK_VERSION = if [ ! -z "$(VERSION)" ]; \ +- then /bin/echo -e "\#undef VERSION\n\#define VERSION \"$(VERSION)\""; \ +- fi; ++# - "if ... ; \", then "then" on the next line for no reason? ++# - using echo with non-standard parameter -e; that's printf(1)'s job! ++# echo should just be a simple output of args ++# - using "! -z" when there is "-n"... ++# - just set the fallback and drop the redundant test altogether! ++CHECK_VERSION = /bin/printf "\#undef VERSION\n\#define VERSION \"%s\"\n" \ ++ "$(VERSION)" + ++# Again with the nonstandard echo. + ifneq ($(and $(HAS_SWIG),$(HAS_PYTHON_CONFIG)),) +- CHECK_PYTHON_EXTENSION = /bin/echo -e "\#define HAVE_PYTHON_EXTENSION" ++ CHECK_PYTHON_EXTENSION = /bin/printf "\#define HAVE_PYTHON_EXTENSION\n" + endif + + CHECK_FEATURES = process_vm seccomp_filter diff --git a/pat/sbase-galeb/sbase-tar-n.patch b/pat/sbase-galeb/sbase-tar-n.patch @@ -0,0 +1,78 @@ +diff --git a/tar.1 b/tar.1 +index be2ebea..f7d27a0 100644 +--- a/tar.1 ++++ b/tar.1 +@@ -15,6 +15,7 @@ + .Op Fl C Ar dir + .Op Fl J | Fl Z | Fl a | Fl j | Fl z + .Op Fl h ++.Op Fl n + .Fl c Ar path ... + .Op Fl f Ar file + .Sh DESCRIPTION +@@ -36,6 +37,10 @@ as input | output archive instead of stdin | stdout. + If '-', stdin | stdout is used. + .It Fl m + Do not preserve modification time. ++.It Fl n ++Do not recurse into directories. This flag is an extension to standard, ++equivalent to GNU tar's ++.Fl -no-recursion . + .It Fl t + List all files in the archive. + .It Fl x +diff --git a/tar.c b/tar.c +index d3a9f3b..3f8daf9 100644 +--- a/tar.c ++++ b/tar.c +@@ -63,7 +63,7 @@ static int tarfd; + static ino_t tarinode; + static dev_t tardev; + +-static int mflag, vflag; ++static int mflag, nflag, vflag; + static int filtermode; + static const char *filtertool; + +@@ -374,7 +374,7 @@ c(int dirfd, const char *name, struct stat *st, void *data, struct recursor *r) + if (vflag) + puts(r->path); + +- if (S_ISDIR(st->st_mode)) ++ if (S_ISDIR(st->st_mode) && !nflag) + recurse(dirfd, name, NULL, r); + } + +@@ -507,7 +507,7 @@ usage(void) + { + eprintf("usage: %s [-C dir] [-J | -Z | -a | -j | -z] -x [-m | -t] " + "[-f file] [file ...]\n" +- " %s [-C dir] [-J | -Z | -a | -j | -z] [-h] -c path ... " ++ " %s [-C dir] [-J | -Z | -a | -j | -z] [-h] [-n] -c path ... " + "[-f file]\n", argv0, argv0); + } + +@@ -534,6 +534,9 @@ main(int argc, char *argv[]) + case 'm': + mflag = 1; + break; ++ case 'n': ++ nflag = 1; ++ break; + case 'J': + case 'Z': + case 'a': +@@ -577,7 +580,12 @@ main(int argc, char *argv[]) + if (chdir(dir) < 0) + eprintf("chdir %s:", dir); + for (; *argv; argc--, argv++) +- recurse(AT_FDCWD, *argv, NULL, &r); ++ { ++ if (!nflag) ++ recurse(AT_FDCWD, *argv, NULL, &r); ++ else ++ archive(*argv); ++ } + break; + case 't': + case 'x':