termux-packages/packages/util-linux/fix-paths.patch
Butta b6c702b46e protobuf: update from 3.12.4 to 3.13.0 and bump libgrpc, librotobuf-c, and mosh dependent packages
parted: update from 3.2 to 3.3

rhash: update from 1.3.9 to 1.4.0

seafile-client: update from 7.0.8 to 7.0.9

sensible-utils: update from 0.0.12 to 0.0.13

util-linux: update from 2.35.2 to 2.36
2020-08-21 15:45:26 +05:30

425 lines
14 KiB
Diff

diff -uNr util-linux-2.35.2/include/pathnames.h util-linux-2.35.2.mod/include/pathnames.h
--- util-linux-2.35.2/include/pathnames.h 2020-05-20 15:27:43.450013565 +0300
+++ util-linux-2.35.2.mod/include/pathnames.h 2020-07-09 01:54:37.539260814 +0300
@@ -202,4 +202,105 @@
#define _PATH_DEV_RFKILL "/dev/rfkill"
#define _PATH_SYS_RFKILL "/sys/class/rfkill"
+// On Android (Termux) paths are different.
+#if defined(__ANDROID__)
+# undef _PATH_DEFPATH
+# undef _PATH_DEFPATH_ROOT
+# undef _PATH_HUSHLOGINS
+# undef _PATH_NOLOGIN_TXT
+# undef _PATH_MAILDIR
+# undef _PATH_MOTDFILE
+# undef _PATH_NOLOGIN
+# undef _PATH_VAR_NOLOGIN
+# undef _PATH_LOGIN
+# undef _PATH_SHUTDOWN
+# undef _PATH_POWEROFF
+# undef _PATH_TERMCOLORS_DIR
+# undef _PATH_PASSWD
+# undef _PATH_GSHADOW
+# undef _PATH_GROUP
+# undef _PATH_SHADOW_PASSWD
+# undef _PATH_SHELLS
+# undef _PATH_BTMP
+# undef _PATH_ISSUE
+# undef _PATH_ISSUEDIR
+# undef _PATH_OS_RELEASE_ETC
+# undef _PATH_OS_RELEASE_USR
+# undef _PATH_LOGINDEFS
+# undef _PATH_WORDS
+# undef _PATH_WORDS_ALT
+# undef _PATH_FILESYSTEMS
+# undef _PATH_MOUNTED
+# undef _PATH_MNTTAB
+# undef _PATH_DEV_LOOP
+# undef _PATH_DEV_BYLABEL
+# undef _PATH_DEV_BYUUID
+# undef _PATH_DEV_BYID
+# undef _PATH_DEV_BYPATH
+# undef _PATH_DEV_BYPARTLABEL
+# undef _PATH_DEV_BYPARTUUID
+# undef _PATH_ADJTIME
+
+# define _PATH_DEFPATH "@TERMUX_PREFIX@/bin"
+# define _PATH_DEFPATH_ROOT _PATH_DEFPATH
+
+// Unused and not needed in Termux.
+# define _PATH_HUSHLOGINS "@TERMUX_PREFIX@/etc/hushlogins"
+# define _PATH_NOLOGIN_TXT "@TERMUX_PREFIX@/etc/nologin.txt"
+# define _PATH_NOLOGIN "@TERMUX_PREFIX@/etc/nologin"
+# define _PATH_VAR_NOLOGIN "@TERMUX_PREFIX@/var/run/nologin"
+
+# define _PATH_MAILDIR "@TERMUX_PREFIX@/var/spool/mail"
+# define _PATH_MOTDFILE "@TERMUX_PREFIX@/etc/motd"
+# define _PATH_LOGIN "@TERMUX_PREFIX@/bin/login"
+# define _PATH_SHUTDOWN "@TERMUX_PREFIX@/bin/shutdown"
+# define _PATH_POWEROFF "@TERMUX_PREFIX@/bin/poweroff"
+# define _PATH_TERMCOLORS_DIR "@TERMUX_PREFIX@/etc/" _PATH_TERMCOLORS_DIRNAME
+
+// Termux doesn't support multiuser environment.
+// Some Android versions support /etc/passwd and /etc/group but files
+// /etc/shadow and /etc/gshadow are not supported.
+# define _PATH_PASSWD "/system/etc/passwd"
+# define _PATH_GSHADOW "/system/etc/gshadow"
+# define _PATH_GROUP "/system/etc/group"
+# define _PATH_SHADOW_PASSWD "/system/etc/shadow"
+
+// Ignored in Termux.
+# define _PATH_SHELLS "@TERMUX_PREFIX@/etc/shells"
+
+// btmp, (and utmp/wtmp) files are unsupported.
+# define _PATH_BTMP "@TERMUX_PREFIX@/var/log/btmp"
+
+# define _PATH_ISSUE "@TERMUX_PREFIX@/etc/issue"
+# define _PATH_ISSUEDIR _PATH_ISSUE ".d"
+
+// os release definition is not available in Termux.
+# define _PATH_OS_RELEASE_ETC "@TERMUX_PREFIX@/etc/os-release"
+# define _PATH_OS_RELEASE_USR "@TERMUX_PREFIX@/lib/os-release"
+
+// login configuration is unsupported.
+# define _PATH_LOGINDEFS "@TERMUX_PREFIX@/etc/login.defs"
+
+# define _PATH_WORDS "@TERMUX_PREFIX@/share/dict/words"
+# define _PATH_WORDS_ALT "@TERMUX_PREFIX@/share/dict/web2"
+
+// Not available.
+# define _PATH_FILESYSTEMS "@TERMUX_PREFIX@/etc/filesystems"
+
+# define _PATH_MOUNTED "/proc/self/mounts"
+
+// Not available.
+# define _PATH_MNTTAB "@TERMUX_PREFIX@/etc/fstab"
+
+# define _PATH_DEV_LOOP "/dev/block/loop"
+# define _PATH_DEV_BYLABEL "/dev/block/by-label"
+# define _PATH_DEV_BYUUID "/dev/block/by-uuid"
+# define _PATH_DEV_BYID "/dev/block/by-id"
+# define _PATH_DEV_BYPATH "/dev/block/by-path"
+# define _PATH_DEV_BYPARTLABEL "/dev/block/by-name"
+# define _PATH_DEV_BYPARTUUID "/dev/block/by-partuuid"
+
+# define _PATH_ADJTIME "@TERMUX_PREFIX@/etc/adjtime"
+#endif
+
#endif /* PATHNAMES_H */
diff -uNr util-linux-2.35.2/lib/exec_shell.c util-linux-2.35.2.mod/lib/exec_shell.c
--- util-linux-2.35.2/lib/exec_shell.c 2020-02-27 11:26:34.563141252 +0200
+++ util-linux-2.35.2.mod/lib/exec_shell.c 2020-07-09 01:53:27.882946782 +0300
@@ -28,7 +28,7 @@
#include "exec_shell.h"
-#define DEFAULT_SHELL "/bin/sh"
+#define DEFAULT_SHELL "@TERMUX_PREFIX@/bin/sh"
void __attribute__((__noreturn__)) exec_shell(void)
{
diff -uNr util-linux-2.35.2/lib/loopdev.c util-linux-2.35.2.mod/lib/loopdev.c
--- util-linux-2.35.2/lib/loopdev.c 2020-05-20 15:27:43.451013558 +0300
+++ util-linux-2.35.2.mod/lib/loopdev.c 2020-07-09 01:53:27.886946800 +0300
@@ -105,13 +105,13 @@
/* set new */
if (device) {
if (*device != '/') {
- const char *dir = _PATH_DEV;
+ const char *dir = _PATH_DEV "block/";
/* compose device name for /dev/loop<n> or /dev/loop/<n> */
if (lc->flags & LOOPDEV_FL_DEVSUBDIR) {
- if (strlen(device) < 5)
+ if (strlen(device) < 11)
return -1;
- device += 4;
+ device += 10;
dir = _PATH_DEV_LOOP "/"; /* _PATH_DEV uses tailing slash */
}
snprintf(lc->device, sizeof(lc->device), "%s%s",
diff -uNr util-linux-2.35.2/libblkid/src/blkidP.h util-linux-2.35.2.mod/libblkid/src/blkidP.h
--- util-linux-2.35.2/libblkid/src/blkidP.h 2020-05-20 15:27:43.453013547 +0300
+++ util-linux-2.35.2.mod/libblkid/src/blkidP.h 2020-07-09 01:53:27.886946800 +0300
@@ -286,7 +286,7 @@
#define BLKID_BIC_FL_CHANGED 0x0004 /* Cache has changed from disk */
/* config file */
-#define BLKID_CONFIG_FILE "/etc/blkid.conf"
+#define BLKID_CONFIG_FILE "@TERMUX_PREFIX@/etc/blkid.conf"
/* cache file on systemds with /run */
#define BLKID_RUNTIME_TOPDIR "/run"
@@ -294,7 +294,7 @@
#define BLKID_CACHE_FILE BLKID_RUNTIME_DIR "/blkid.tab"
/* old systems */
-#define BLKID_CACHE_FILE_OLD "/etc/blkid.tab"
+#define BLKID_CACHE_FILE_OLD "@TERMUX_PREFIX@/etc/blkid.tab"
#define BLKID_PROBE_OK 0
#define BLKID_PROBE_NONE 1
diff -uNr util-linux-2.35.2/libblkid/src/topology/dm.c util-linux-2.35.2.mod/libblkid/src/topology/dm.c
--- util-linux-2.35.2/libblkid/src/topology/dm.c 2020-02-27 11:26:34.573141186 +0200
+++ util-linux-2.35.2.mod/libblkid/src/topology/dm.c 2020-07-09 01:53:27.886946800 +0300
@@ -30,9 +30,8 @@
const struct blkid_idmag *mag __attribute__((__unused__)))
{
const char *paths[] = {
- "/usr/local/sbin/dmsetup",
- "/usr/sbin/dmsetup",
- "/sbin/dmsetup"
+ "@TERMUX_PREFIX@/bin/dmsetup",
+ "@TERMUX_PREFIX@/sbin/dmsetup"
};
int dmpipe[] = { -1, -1 }, stripes, stripesize;
const char *cmd = NULL;
diff -uNr util-linux-2.35.2/libblkid/src/topology/lvm.c util-linux-2.35.2.mod/libblkid/src/topology/lvm.c
--- util-linux-2.35.2/libblkid/src/topology/lvm.c 2017-09-18 12:48:03.563891490 +0300
+++ util-linux-2.35.2.mod/libblkid/src/topology/lvm.c 2020-07-09 01:53:27.886946800 +0300
@@ -36,9 +36,8 @@
const struct blkid_idmag *mag __attribute__((__unused__)))
{
const char *paths[] = {
- "/usr/local/sbin/lvdisplay",
- "/usr/sbin/lvdisplay",
- "/sbin/lvdisplay"
+ "@TERMUX_PREFIX@/bin/lvdisplay",
+ "@TERMUX_PREFIX@/sbin/lvdisplay"
};
int lvpipe[] = { -1, -1 }, stripes = 0, stripesize = 0;
FILE *stream = NULL;
diff -uNr util-linux-2.35.2/libmount/src/cache.c util-linux-2.35.2.mod/libmount/src/cache.c
--- util-linux-2.35.2/libmount/src/cache.c 2020-05-20 15:27:43.460013503 +0300
+++ util-linux-2.35.2.mod/libmount/src/cache.c 2020-07-09 01:53:27.886946800 +0300
@@ -632,7 +632,7 @@
/* users assume backing file name rather than /dev/loopN in
* output if the device has been initialized by mount(8).
*/
- if (strncmp(pretty, "/dev/loop", 9) == 0) {
+ if (strncmp(pretty, "/dev/block/loop", 15) == 0) {
struct loopdev_cxt lc;
if (loopcxt_init(&lc, 0) || loopcxt_set_device(&lc, pretty))
diff -uNr util-linux-2.35.2/libmount/src/context_loopdev.c util-linux-2.35.2.mod/libmount/src/context_loopdev.c
--- util-linux-2.35.2/libmount/src/context_loopdev.c 2020-03-03 12:16:39.603294025 +0200
+++ util-linux-2.35.2.mod/libmount/src/context_loopdev.c 2020-07-09 01:53:27.886946800 +0300
@@ -129,7 +129,7 @@
rc = 0;
- if (strncmp(src, "/dev/loop", 9) == 0) {
+ if (strncmp(src, "/dev/block/loop", 15) == 0) {
rc = loopdev_is_used((char *) src, bf, offset, 0, LOOPDEV_FL_OFFSET);
} else if (opts && (cxt->user_mountflags & MNT_MS_LOOP) &&
diff -uNr util-linux-2.35.2/libmount/src/tab.c util-linux-2.35.2.mod/libmount/src/tab.c
--- util-linux-2.35.2/libmount/src/tab.c 2020-05-15 13:21:21.435962611 +0300
+++ util-linux-2.35.2.mod/libmount/src/tab.c 2020-07-09 01:53:27.886946800 +0300
@@ -1740,7 +1740,7 @@
int flags = 0;
if (!mnt_fs_get_srcpath(fs) ||
- !startswith(mnt_fs_get_srcpath(fs), "/dev/loop"))
+ !startswith(mnt_fs_get_srcpath(fs), "/dev/block/loop"))
continue; /* does not look like loopdev */
if (mnt_fs_get_option(fstab_fs, "offset", &val, &len) == 0) {
diff -uNr util-linux-2.35.2/libuuid/src/uuidd.h util-linux-2.35.2.mod/libuuid/src/uuidd.h
--- util-linux-2.35.2/libuuid/src/uuidd.h 2020-02-19 17:17:42.282325812 +0200
+++ util-linux-2.35.2.mod/libuuid/src/uuidd.h 2020-07-09 01:53:27.890946819 +0300
@@ -38,7 +38,7 @@
#define UUIDD_DIR _PATH_RUNSTATEDIR "/uuidd"
#define UUIDD_SOCKET_PATH UUIDD_DIR "/request"
#define UUIDD_PIDFILE_PATH UUIDD_DIR "/uuidd.pid"
-#define UUIDD_PATH "/usr/sbin/uuidd"
+#define UUIDD_PATH "@TERMUX_PREFIX@/bin/uuidd"
#define UUIDD_OP_GETPID 0
#define UUIDD_OP_GET_MAXOP 1
diff -uNr util-linux-2.35.2/libuuid/src/uuidP.h util-linux-2.35.2.mod/libuuid/src/uuidP.h
--- util-linux-2.35.2/libuuid/src/uuidP.h 2020-02-27 11:26:34.585141107 +0200
+++ util-linux-2.35.2.mod/libuuid/src/uuidP.h 2020-07-09 01:53:27.890946819 +0300
@@ -39,7 +39,7 @@
#include "uuid.h"
-#define LIBUUID_CLOCK_FILE "/var/lib/libuuid/clock.txt"
+#define LIBUUID_CLOCK_FILE "@TERMUX_PREFIX@/var/lib/libuuid/clock.txt"
/*
* Offset between 15-Oct-1582 and 1-Jan-70
diff -uNr util-linux-2.35.2/login-utils/su-common.c util-linux-2.35.2.mod/login-utils/su-common.c
--- util-linux-2.35.2/login-utils/su-common.c 2020-05-20 15:27:43.467013460 +0300
+++ util-linux-2.35.2.mod/login-utils/su-common.c 2020-07-09 01:53:27.890946819 +0300
@@ -96,7 +96,7 @@
#define is_pam_failure(_rc) ((_rc) != PAM_SUCCESS)
/* The shell to run if none is given in the user's passwd entry. */
-#define DEFAULT_SHELL "/bin/sh"
+#define DEFAULT_SHELL "@TERMUX_PREFIX@/bin/sh"
/* The user to become if none is specified. */
#define DEFAULT_USER "root"
diff -uNr util-linux-2.35.2/login-utils/sulogin.c util-linux-2.35.2.mod/login-utils/sulogin.c
--- util-linux-2.35.2/login-utils/sulogin.c 2020-02-27 11:26:34.589141080 +0200
+++ util-linux-2.35.2.mod/login-utils/sulogin.c 2020-07-09 01:53:27.890946819 +0300
@@ -743,7 +743,7 @@
if (pwd->pw_shell[0])
su_shell = pwd->pw_shell;
else
- su_shell = "/bin/sh";
+ su_shell = "@TERMUX_PREFIX@/bin/sh";
}
if ((p = strrchr(su_shell, '/')) == NULL)
p = su_shell;
@@ -792,9 +792,9 @@
execl(su_shell, shell, NULL);
warn(_("failed to execute %s"), su_shell);
- xsetenv("SHELL", "/bin/sh", 1);
- execl("/bin/sh", profile ? "-sh" : "sh", NULL);
- warn(_("failed to execute %s"), "/bin/sh");
+ xsetenv("SHELL", "@TERMUX_PREFIX@/bin/sh", 1);
+ execl("@TERMUX_PREFIX@/bin/sh", profile ? "-sh" : "sh", NULL);
+ warn(_("failed to execute %s"), "@TERMUX_PREFIX@/bin/sh");
}
static void usage(void)
diff -uNr util-linux-2.35.2/misc-utils/whereis.c util-linux-2.35.2.mod/misc-utils/whereis.c
--- util-linux-2.35.2/misc-utils/whereis.c 2020-05-20 15:27:43.473013423 +0300
+++ util-linux-2.35.2.mod/misc-utils/whereis.c 2020-07-09 01:54:02.827104318 +0300
@@ -97,82 +97,18 @@
};
static const char *bindirs[] = {
- "/usr/bin",
- "/usr/sbin",
- "/bin",
- "/sbin",
-#if defined(MULTIARCHTRIPLET)
- "/lib/" MULTIARCHTRIPLET,
- "/usr/lib/" MULTIARCHTRIPLET,
- "/usr/local/lib/" MULTIARCHTRIPLET,
-#endif
- "/usr/lib",
- "/usr/lib64",
- "/etc",
- "/usr/etc",
- "/lib",
- "/lib64",
- "/usr/games",
- "/usr/games/bin",
- "/usr/games/lib",
- "/usr/emacs/etc",
- "/usr/lib/emacs/*/etc",
- "/usr/TeX/bin",
- "/usr/tex/bin",
- "/usr/interviews/bin/LINUX",
-
- "/usr/X11R6/bin",
- "/usr/X386/bin",
- "/usr/bin/X11",
- "/usr/X11/bin",
- "/usr/X11R5/bin",
-
- "/usr/local/bin",
- "/usr/local/sbin",
- "/usr/local/etc",
- "/usr/local/lib",
- "/usr/local/games",
- "/usr/local/games/bin",
- "/usr/local/emacs/etc",
- "/usr/local/TeX/bin",
- "/usr/local/tex/bin",
- "/usr/local/bin/X11",
-
- "/usr/contrib",
- "/usr/hosts",
- "/usr/include",
-
- "/usr/g++-include",
-
- "/usr/ucb",
- "/usr/old",
- "/usr/new",
- "/usr/local",
- "/usr/libexec",
- "/usr/share",
-
- "/opt/*/bin",
+ "@TERMUX_PREFIX@/bin",
NULL
};
static const char *mandirs[] = {
- "/usr/man/*",
- "/usr/share/man/*",
- "/usr/X386/man/*",
- "/usr/X11/man/*",
- "/usr/TeX/man/*",
- "/usr/interviews/man/mann",
- "/usr/share/info",
+ "@TERMUX_PREFIX@/share/man/*",
+ "@TERMUX_PREFIX@/share/info",
NULL
};
static const char *srcdirs[] = {
- "/usr/src/*",
- "/usr/src/lib/libc/*",
- "/usr/src/lib/libc/net/*",
- "/usr/src/ucb/pascal",
- "/usr/src/ucb/pascal/utilities",
- "/usr/src/undoc",
+ "@TERMUX_PREFIX@/src",
NULL
};
diff -uNr util-linux-2.35.2/sys-utils/setarch.c util-linux-2.35.2.mod/sys-utils/setarch.c
--- util-linux-2.35.2/sys-utils/setarch.c 2020-05-20 15:27:43.555012916 +0300
+++ util-linux-2.35.2.mod/sys-utils/setarch.c 2020-07-09 01:53:27.890946819 +0300
@@ -328,7 +328,7 @@
/* Don't use ifdef sparc here, we get "Unrecognized architecture"
* error message later if necessary */
if (strcmp(arch, "sparc32bash") == 0) {
- shell = "/bin/bash";
+ shell = "@TERMUX_PREFIX@/bin/bash";
shell_arg = "";
goto set_arch;
}
@@ -437,7 +437,7 @@
verify_arch_domain(target, arch);
if (!argc) {
- shell = "/bin/sh";
+ shell = "@TERMUX_PREFIX@/bin/sh";
shell_arg = "-sh";
}
if (verbose) {
diff -uNr util-linux-2.35.2/sys-utils/setpriv.c util-linux-2.35.2.mod/sys-utils/setpriv.c
--- util-linux-2.35.2/sys-utils/setpriv.c 2020-02-27 11:26:34.709140285 +0200
+++ util-linux-2.35.2.mod/sys-utils/setpriv.c 2020-07-09 01:53:27.890946819 +0300
@@ -52,7 +52,7 @@
#define SETPRIV_EXIT_PRIVERR 127 /* how we exit when we fail to set privs */
/* The shell to set SHELL env.variable if none is given in the user's passwd entry. */
-#define DEFAULT_SHELL "/bin/sh"
+#define DEFAULT_SHELL "@TERMUX_PREFIX@/bin/sh"
static gid_t get_group(const char *s, const char *err);
diff -uNr util-linux-2.35.2/text-utils/pg.c util-linux-2.35.2.mod/text-utils/pg.c
--- util-linux-2.35.2/text-utils/pg.c 2020-05-20 15:27:43.565012854 +0300
+++ util-linux-2.35.2.mod/text-utils/pg.c 2020-07-09 01:53:27.894946836 +0300
@@ -1365,7 +1365,7 @@
{
const char *sh = getenv("SHELL");
if (!sh)
- sh = "/bin/sh";
+ sh = "@TERMUX_PREFIX@/bin/sh";
if (!nobuf)
fclose(fbuf);
fclose(find);