new package: chroot

Actually it just a "standalone" chroot utility from the coreutils.
This commit is contained in:
Leonid Plyushch 2019-02-27 15:30:40 +02:00 committed by Yaksh Bariya
parent e45ef8ab9d
commit 573da57f1e
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
7 changed files with 145 additions and 0 deletions

View File

@ -0,0 +1,45 @@
TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/coreutils/
TERMUX_PKG_DESCRIPTION="Chroot utility from the Coreutils"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_VERSION=8.30
TERMUX_PKG_SHA256=e831b3a86091496cdba720411f9748de81507798f6130adeaef872d206e1b057
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/coreutils/coreutils-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
gl_cv_host_operating_system=Android
--disable-xattr
--without-gmp
"
termux_step_pre_configure() {
CPPFLAGS+=" -DDEFAULT_TMPDIR=\\\"$TERMUX_PREFIX/tmp\\\""
}
termux_step_make() {
# deps for chroot.
make lib/configmake.h
make src/version.h
make lib/fcntl.h
make lib/time.h
make lib/sys/stat.h
make lib/selinux/context.h
make lib/selinux/selinux.h
make lib/unitypes.h
make lib/unistr.h
make lib/uniwidth.h
make lib/stdint.h
make lib/stdio.h
make lib/fnmatch.h
make lib/getopt.h
make lib/getopt-cdefs.h
# build standalone chroot utility.
make src/chroot
}
termux_step_make_install() {
install -Dm700 $TERMUX_PKG_BUILDDIR/src/chroot \
$TERMUX_PREFIX/bin/
install -Dm600 $TERMUX_PKG_SRCDIR/man/chroot.1 \
$TERMUX_PREFIX/share/man/man1/
}

View File

@ -0,0 +1,25 @@
diff -r -u ../coreutils-8.22/configure ./configure
--- ../coreutils-8.22/configure 2013-12-13 16:05:30.000000000 +0100
+++ ./configure 2014-02-12 18:21:28.000000000 +0100
@@ -39537,7 +39537,7 @@
# Determine how to get the list of mounted file systems.
-ac_list_mounted_fs=
+ac_list_mounted_fs=found
# If the getmntent function is available but not in the standard library,
# make sure LIBS contains the appropriate -l option.
@@ -40077,12 +40077,6 @@
esac
fi
-if test -z "$ac_list_mounted_fs"; then
- as_fn_error $? "could not determine how to read list of mounted file systems" "$LINENO" 5
- # FIXME -- no need to abort building the whole package
- # Can't build mountlist.c or anything that needs its functions
-fi
-
if test $ac_list_mounted_fs = found; then :
gl_cv_list_mounted_fs=yes
else

View File

@ -0,0 +1,12 @@
diff -u -r ../coreutils-8.30/lib/stdio-impl.h ./lib/stdio-impl.h
--- ../coreutils-8.30/lib/stdio-impl.h 2018-06-24 06:52:06.000000000 +0200
+++ ./lib/stdio-impl.h 2018-07-03 11:05:27.353619181 +0200
@@ -60,7 +60,7 @@
# define _flags pub._flags
# define _r pub._r
# define _w pub._w
-# elif defined __ANDROID__ /* Android */
+# elif defined __ANDROID_BUT_THIS_IS_BROKEN__ /* Android */
/* Up to this commit from 2015-10-12
<https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a>
the innards of FILE were public, and fp_ub could be defined like for OpenBSD,

View File

@ -0,0 +1,21 @@
diff -u -r ../coreutils-8.22/src/mktemp.c ./src/mktemp.c
--- ../coreutils-8.22/src/mktemp.c 2013-12-04 15:48:30.000000000 +0100
+++ ./src/mktemp.c 2014-06-03 11:31:58.351787119 +0200
@@ -269,7 +269,7 @@
else if (dest_dir_arg && *dest_dir_arg)
dest_dir = dest_dir_arg;
else
- dest_dir = "/tmp";
+ dest_dir = "@TERMUX_PREFIX@/tmp";
if (last_component (template) != template)
error (EXIT_FAILURE, 0,
@@ -283,7 +283,7 @@
else
{
char *env = getenv ("TMPDIR");
- dest_dir = (env && *env ? env : "/tmp");
+ dest_dir = (env && *env ? env : "@TERMUX_PREFIX@/tmp");
}
if (IS_ABSOLUTE_FILE_NAME (template))
error (EXIT_FAILURE, 0,

View File

@ -0,0 +1,17 @@
Fix
error: call to '__umask_invalid_mode' declared with
attribute error: umask called with invalid mode
on android-21
diff -u -r ../coreutils-8.23/src/nohup.c ./src/nohup.c
--- ../coreutils-8.23/src/nohup.c 2014-07-11 07:00:07.000000000 -0400
+++ ./src/nohup.c 2014-12-14 15:22:47.939242789 -0500
@@ -141,7 +141,7 @@
char const *file = "nohup.out";
int flags = O_CREAT | O_WRONLY | O_APPEND;
mode_t mode = S_IRUSR | S_IWUSR;
- mode_t umask_value = umask (~mode);
+ mode_t umask_value = umask (0777 & ~mode);
out_fd = (redirecting_stdout
? fd_reopen (STDOUT_FILENO, file, flags, mode)
: open (file, flags, mode));

View File

@ -0,0 +1,12 @@
diff -u -r ../coreutils-8.23/src/pwd.c ./src/pwd.c
--- ../coreutils-8.23/src/pwd.c 2014-07-13 18:09:52.000000000 -0400
+++ ./src/pwd.c 2015-05-17 19:58:20.692454980 -0400
@@ -366,7 +366,7 @@
if (optind < argc)
error (0, 0, _("ignoring non-option arguments"));
- if (logical)
+ if (true) /* Termux: Always try logical, to avoid permission denied on /data/data */
{
wd = logical_getcwd ();
if (wd)

View File

@ -0,0 +1,13 @@
diff -u -r ../coreutils-8.26/src/ls.c ./src/ls.c
--- ../coreutils-8.26/src/ls.c 2016-11-22 15:04:32.000000000 -0500
+++ ./src/ls.c 2016-11-30 20:27:28.910732105 -0500
@@ -1749,6 +1749,9 @@
}
}
+ /* Termux patch: Default to colors if terminal. The --color option may override this. */
+ print_with_color = isatty(STDOUT_FILENO);
+
while (true)
{
int oi = -1;