Browse Source
Termux doesn't require things like 'sudo', 'chroot', 'adduser/addgroup' for installing or building packages. Furthermore, Termux is single-user environment.android-5
Leonid Plyushch
6 years ago
committed by
Fredrik Fornwall
4 changed files with 177 additions and 11 deletions
@ -0,0 +1,30 @@ |
|||
--- abuild-3.2.0/abuild-keygen.in 2018-06-22 10:24:10.000000000 +0300
|
|||
+++ abuild-3.2.0.mod/abuild-keygen.in 2018-11-18 20:02:12.017576128 +0200
|
|||
@@ -56,14 +56,14 @@
|
|||
|
|||
|
|||
if [ -n "$install_pubkey" ]; then |
|||
- msg "Installing $pubkey to /etc/apk/keys..."
|
|||
- sudo mkdir -p /etc/apk/keys
|
|||
- sudo cp -i "$pubkey" /etc/apk/keys/
|
|||
+ msg "Installing $pubkey to \$PREFIX/etc/apk/keys..."
|
|||
+ mkdir -p @TERMUX_PREFIX@/etc/apk/keys
|
|||
+ cp -i "$pubkey" @TERMUX_PREFIX@/etc/apk/keys/
|
|||
else |
|||
|
|||
msg "" |
|||
msg "You'll need to install $pubkey into " |
|||
- msg "/etc/apk/keys to be able to install packages and repositories signed with"
|
|||
+ msg "\$PREFIX/etc/apk/keys to be able to install packages and repositories signed with"
|
|||
msg "$privkey" |
|||
fi |
|||
|
|||
@@ -94,7 +94,7 @@
|
|||
Options: |
|||
-a, --append Set PACKAGER_PRIVKEY=<generated key> in |
|||
$ABUILD_USERCONF |
|||
- -i, --install Install public key into /etc/apk/keys using sudo
|
|||
+ -i, --install Install public key into \$PREFIX/etc/apk/keys
|
|||
-n Non-interactive. Use defaults |
|||
-q, --quiet |
|||
-h, --help Show this help |
@ -0,0 +1,37 @@ |
|||
--- abuild-3.2.0/abuild-rmtemp.c 2018-06-22 10:24:10.000000000 +0300
|
|||
+++ abuild-3.2.0.mod/abuild-rmtemp.c 2018-11-18 19:54:49.254290401 +0200
|
|||
@@ -16,7 +16,7 @@
|
|||
#include <sys/types.h> |
|||
#include <unistd.h> |
|||
|
|||
-#define PREFIX "/var/tmp/abuild."
|
|||
+#define PREFIX "@TERMUX_PREFIX@/var/tmp/abuild."
|
|||
|
|||
static void fail() { |
|||
errx(1, "%s", strerror(errno)); |
|||
@@ -29,10 +29,12 @@
|
|||
int main(int argc, char **argv) { |
|||
if (argc < 2) return 0; |
|||
|
|||
+#ifndef __ANDROID__
|
|||
if (getuid()) { |
|||
argv[0] = "-abuild-rmtemp"; |
|||
execv("/usr/bin/abuild-sudo", argv); |
|||
} |
|||
+#endif
|
|||
|
|||
if (strncmp(argv[1], PREFIX, strlen(PREFIX)) || \ |
|||
strchr(argv[1] + strlen(PREFIX), '/')) |
|||
@@ -40,9 +42,12 @@
|
|||
|
|||
struct stat s; |
|||
if (lstat(argv[1], &s)) fail(); |
|||
+
|
|||
+#ifndef __ANDROID__
|
|||
struct passwd *p = getpwnam(getenv("USER")); |
|||
if (!p) errx(1, "Incorrect user"); |
|||
if (s.st_uid != p->pw_uid) errx(1, "Permission denied"); |
|||
+#endif
|
|||
|
|||
if (nftw(argv[1], handler, 512, FTW_DEPTH)) fail(); |
|||
|
Loading…
Reference in new issue