diff --git a/disabled-packages/apk-tools/build.sh b/disabled-packages/apk-tools/build.sh index ff8f2c5c3..80fa20be2 100644 --- a/disabled-packages/apk-tools/build.sh +++ b/disabled-packages/apk-tools/build.sh @@ -6,6 +6,7 @@ TERMUX_PKG_SRCURL=https://github.com/alpinelinux/apk-tools/archive/v${TERMUX_PKG TERMUX_PKG_DEPENDS="openssl" TERMUX_PKG_BUILD_IN_SRC=yes TERMUX_PKG_EXTRA_MAKE_ARGS="LUAAPK=" +TERMUX_PKG_CONFFILES="etc/apk/repositories" termux_step_post_make_install() { mkdir -p $TERMUX_PREFIX/etc/apk/ @@ -13,5 +14,7 @@ termux_step_post_make_install() { mkdir -p $TERMUX_PREFIX/lib/apk/db/ echo "Needed by the apk tool." > $TERMUX_PREFIX/lib/apk/db/README + + echo "https://termux.net/apk/main" > $TERMUX_PREFIX/etc/apk/repositories } diff --git a/disabled-packages/apk-tools/src-database.c.patch b/disabled-packages/apk-tools/src-database.c.patch index ee733bb62..b6ab8e5ce 100644 --- a/disabled-packages/apk-tools/src-database.c.patch +++ b/disabled-packages/apk-tools/src-database.c.patch @@ -1,29 +1,25 @@ -diff -u -r ../apk-tools-2.10.1/src/database.c ./src/database.c ---- ../apk-tools-2.10.1/src/database.c 2018-09-10 08:04:03.000000000 +0000 -+++ ./src/database.c 2018-09-10 22:06:19.510417812 +0000 -@@ -1331,7 +1331,7 @@ +diff -u -r ../apk-tools-2.10.3/src/database.c ./src/database.c +--- ../apk-tools-2.10.3/src/database.c 2018-11-15 13:09:07.000000000 +0000 ++++ ./src/database.c 2018-11-18 01:05:38.568983268 +0000 +@@ -1332,10 +1332,11 @@ static int apk_db_create(struct apk_database *db) { int fd; - -+#ifndef __ANDROID__ mkdirat(db->root_fd, "tmp", 01777); mkdirat(db->root_fd, "dev", 0755); ++#ifndef __ANDROID__ mknodat(db->root_fd, "dev/null", S_IFCHR | 0666, makedev(1, 3)); -@@ -1344,6 +1344,7 @@ - mkdirat(db->root_fd, "var/cache", 0755); - mkdirat(db->root_fd, "var/cache/apk", 0755); - mkdirat(db->root_fd, "var/cache/misc", 0755); +#endif - - fd = openat(db->root_fd, apk_world_file, O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC, 0644); - if (fd < 0) -@@ -1529,7 +1530,7 @@ + mkdirat(db->root_fd, "etc", 0755); + mkdirat(db->root_fd, "etc/apk", 0755); + mkdirat(db->root_fd, "lib", 0755); +@@ -1538,7 +1539,7 @@ apk_db_setup_repositories(db, dbopts->cache_dir); db->cache_max_age = dbopts->cache_max_age ?: 4*60*60; /* 4 hours default */ - db->root = strdup(dbopts->root ?: "/"); -+ db->root = strdup(dbopts->root ?: "@TERMUX_PREFIX@"); ++ db->root = strdup(dbopts->root ?: "/data/data/com.termux/files/usr"); db->root_fd = openat(AT_FDCWD, db->root, O_RDONLY | O_CLOEXEC); if (db->root_fd < 0 && (dbopts->open_flags & APK_OPENF_CREATE)) { mkdirat(AT_FDCWD, db->root, 0755);