-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: modules/android_integration: termux-setup-storage
- Loading branch information
Showing
7 changed files
with
243 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE. | ||
|
||
{ stdenv | ||
, fetchFromGitHub | ||
, autoreconfHook | ||
, makeWrapper | ||
, gnused | ||
, getopt | ||
, pandoc | ||
, termux-am | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
name = "termux-tools"; | ||
version = "1.42.4"; | ||
src = fetchFromGitHub { | ||
owner = "termux"; | ||
repo = "termux-tools"; | ||
rev = "v${version}"; | ||
sha256 = "sha256-LkkeaEQcY8HgunBYAg3Ymn5xYPvrGqGNCZTd/NyIOKY="; | ||
}; | ||
nativeBuildInputs = [ autoreconfHook makeWrapper pandoc ]; | ||
propagatedInputs = [ termux-am ]; | ||
|
||
# https://github.com/termux/termux-tools/pull/95 | ||
patches = [ ./termux-tools.patch ]; | ||
postPatch = '' | ||
substituteInPlace scripts/* --replace @TERMUX_APP_PACKAGE@/ com.termux.nix/ | ||
substituteInPlace scripts/termux-setup-storage.in \ | ||
--replace @TERMUX_APP_PACKAGE@ com.termux.nix | ||
substituteInPlace scripts/* --replace "getopt " "${getopt}/bin/getopt " | ||
${gnused}/bin/sed -i 's|^am |${termux-am}/bin/am |' scripts/* | ||
''; | ||
|
||
outputs = [ | ||
"out" # all the unsupported unsorted stuff | ||
"setup_storage" # termux-setup-storage | ||
]; | ||
postInstall = '' | ||
rm $out/etc/termux-login.sh | ||
rm $out/etc/profile.d/init-termux-properties.sh | ||
rm -r $out/etc/termux/mirrors | ||
rm -d $out/etc/termux | ||
rm -d $out/etc/profile.d | ||
rm $out/etc/motd.sh $out/etc/motd $out/etc/motd-playstore | ||
rm -d $out/etc | ||
rm $out/bin/chsh # we offer a declarative way to change your shell | ||
rm $out/bin/cmd # doesn't work because we overlay /system/bin | ||
rm $out/bin/dalvikvm # doesn't work because we overlay /system/bin | ||
rm $out/bin/df # works without the magic | ||
rm $out/bin/getprop # doesn't work because we overlay /system/bin | ||
rm $out/bin/logcat # doesn't work because we overlay /system/bin | ||
rm $out/bin/login # we have our own, very complex login | ||
rm $out/bin/ping # doesn't work because we overlay /system/bin | ||
rm $out/bin/ping6 # doesn't work because we overlay /system/bin | ||
rm $out/bin/pkg # we use Nix | ||
rm $out/bin/pm # doesn't work because we overlay /system/bin | ||
rm $out/bin/settings # doesn't work because we overlay /system/bin | ||
rm $out/bin/su # doesn't work because we overlay /bin | ||
rm $out/bin/top # doesn't work because we overlay /system/bin | ||
rm $out/bin/termux-change-repo # we use Nix | ||
rm $out/bin/termux-fix-shebang # we use Nix | ||
rm $out/bin/termux-info # Termux-specific. write our own? | ||
rm $out/bin/termux-reset # untested and dangerous | ||
rm $out/bin/termux-restore # untested and dangerous | ||
rm $out/bin/termux-setup-package-manager # we use Nix | ||
mkdir -p $setup_storage/bin | ||
mv $out/bin/termux-setup-storage $setup_storage/bin/ | ||
# check that we didn't package we didn't want to | ||
find $out | ${gnused}/bin/sed "s|^$out|.|" | sort > effective | ||
echo . >> expected | ||
echo ./bin >> expected | ||
echo ./bin/termux-backup >> expected # entirely untested | ||
echo ./bin/termux-open >> expected # good candidate for fixing | ||
echo ./bin/termux-open-url >> expected # good candidate for fixing | ||
echo ./bin/termux-reload-settings >> expected # good candidate for fixing | ||
echo ./bin/termux-wake-lock >> expected # good candidate for fixing | ||
echo ./bin/termux-wake-unlock >> expected # good candidate for fixing | ||
echo ./bin/xdg-open >> expected # good candidate for fixing | ||
echo ./share >> expected | ||
echo ./share/examples >> expected | ||
echo ./share/examples/termux >> expected | ||
echo ./share/examples/termux/termux.properties >> expected # useful | ||
echo ./share/man >> expected | ||
echo ./share/man/man1 >> expected | ||
echo ./share/man/man1/termux.1 >> expected # 50/50 useful/misleading | ||
diff -u expected effective | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
From 6d72b44d90347ddce8473b604c38f352e6773f8d Mon Sep 17 00:00:00 2001 | ||
From: Alexander Sosedkin <[email protected]> | ||
Date: Sat, 1 Jun 2024 17:14:22 +0200 | ||
Subject: [PATCH] scripts: replace com.termux with @TERMUX_APP_PACKAGE@ | ||
|
||
--- | ||
scripts/termux-open.in | 2 +- | ||
scripts/termux-reload-settings.in | 2 +- | ||
scripts/termux-reset.in | 2 +- | ||
scripts/termux-setup-storage.in | 4 ++-- | ||
scripts/termux-wake-lock.in | 4 ++-- | ||
scripts/termux-wake-unlock.in | 4 ++-- | ||
6 files changed, 9 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/scripts/termux-open.in b/scripts/termux-open.in | ||
index 9c81630..9a04e7b 100644 | ||
--- a/scripts/termux-open.in | ||
+++ b/scripts/termux-open.in | ||
@@ -44,7 +44,7 @@ case "${TERMUX__USER_ID:-}" in ''|*[!0-9]*|0[0-9]*) TERMUX__USER_ID=0;; esac | ||
|
||
am broadcast --user "$TERMUX__USER_ID" \ | ||
-a $ACTION \ | ||
- -n com.termux/com.termux.app.TermuxOpenReceiver \ | ||
+ -n @TERMUX_APP_PACKAGE@/@[email protected] \ | ||
$EXTRAS \ | ||
-d "$FILE" \ | ||
> /dev/null | ||
diff --git a/scripts/termux-reload-settings.in b/scripts/termux-reload-settings.in | ||
index 4e71f8a..ef8b0f4 100644 | ||
--- a/scripts/termux-reload-settings.in | ||
+++ b/scripts/termux-reload-settings.in | ||
@@ -11,4 +11,4 @@ fi | ||
|
||
case "${TERMUX__USER_ID:-}" in ''|*[!0-9]*|0[0-9]*) TERMUX__USER_ID=0;; esac | ||
|
||
-am broadcast --user "$TERMUX__USER_ID" -a com.termux.app.reload_style com.termux > /dev/null | ||
+am broadcast --user "$TERMUX__USER_ID" -a @[email protected]_style @TERMUX_APP_PACKAGE@ > /dev/null | ||
diff --git a/scripts/termux-reset.in b/scripts/termux-reset.in | ||
index 6f807a7..2161d1f 100644 | ||
--- a/scripts/termux-reset.in | ||
+++ b/scripts/termux-reset.in | ||
@@ -45,6 +45,6 @@ else | ||
/system/bin/killall -9 "$SHELL" | ||
else | ||
export CLASSPATH="@TERMUX_CACHE_DIR@/termux-am/am.apk" | ||
- /system/bin/app_process / com.termux.termuxam.Am stopservice com.termux/.app.TermuxService | ||
+ /system/bin/app_process / @[email protected] stopservice @TERMUX_APP_PACKAGE@/.app.TermuxService | ||
fi | ||
fi | ||
diff --git a/scripts/termux-setup-storage.in b/scripts/termux-setup-storage.in | ||
index c621234..a086159 100644 | ||
--- a/scripts/termux-setup-storage.in | ||
+++ b/scripts/termux-setup-storage.in | ||
@@ -27,5 +27,5 @@ fi | ||
case "${TERMUX__USER_ID:-}" in ''|*[!0-9]*|0[0-9]*) TERMUX__USER_ID=0;; esac | ||
|
||
am broadcast --user "$TERMUX__USER_ID" \ | ||
- --es com.termux.app.reload_style storage \ | ||
- -a com.termux.app.reload_style com.termux > /dev/null | ||
+ --es @[email protected]_style storage \ | ||
+ -a @[email protected]_style @TERMUX_APP_PACKAGE@ > /dev/null | ||
diff --git a/scripts/termux-wake-lock.in b/scripts/termux-wake-lock.in | ||
index ba4b899..f3fd59e 100644 | ||
--- a/scripts/termux-wake-lock.in | ||
+++ b/scripts/termux-wake-lock.in | ||
@@ -10,6 +10,6 @@ case "${TERMUX__USER_ID:-}" in ''|*[!0-9]*|0[0-9]*) TERMUX__USER_ID=0;; esac | ||
|
||
am startservice \ | ||
--user "$TERMUX__USER_ID" \ | ||
- -a com.termux.service_wake_lock \ | ||
- com.termux/com.termux.app.TermuxService \ | ||
+ -a @[email protected]_wake_lock \ | ||
+ @TERMUX_APP_PACKAGE@/@[email protected] \ | ||
> /dev/null | ||
diff --git a/scripts/termux-wake-unlock.in b/scripts/termux-wake-unlock.in | ||
index a4b1f57..d53ce31 100644 | ||
--- a/scripts/termux-wake-unlock.in | ||
+++ b/scripts/termux-wake-unlock.in | ||
@@ -10,6 +10,6 @@ case "${TERMUX__USER_ID:-}" in ''|*[!0-9]*|0[0-9]*) TERMUX__USER_ID=0;; esac | ||
|
||
am startservice \ | ||
--user "$TERMUX__USER_ID" \ | ||
- -a com.termux.service_wake_unlock \ | ||
- com.termux/com.termux.app.TermuxService \ | ||
+ -a @[email protected]_wake_unlock \ | ||
+ @TERMUX_APP_PACKAGE@/@[email protected] \ | ||
> /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters