Skip to content

Commit

Permalink
fix(main/just): fix shebang recipes
Browse files Browse the repository at this point in the history
Co-authored-by: kaike95 <[email protected]>
Co-authored-by: Ted Stein <[email protected]>
  • Loading branch information
TomJo2000 committed Nov 17, 2024
1 parent eb7c422 commit 9ff502d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/just/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="A handy way to save and run project-specific commands"
TERMUX_PKG_LICENSE="CC0-1.0"
TERMUX_PKG_MAINTAINER="@flipee"
TERMUX_PKG_VERSION="1.36.0"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/casey/just/archive/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=bc2e2ff0268c2818659c524b21663564864b50ba102afb0a44fe73c08cf35ff0
TERMUX_PKG_AUTO_UPDATE=true
Expand Down
22 changes: 22 additions & 0 deletions packages/just/termux_shebang.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/src/recipe.rs b/src/recipe.rs
index 3976983a..d9b8ee5c 100644
--- a/src/recipe.rs
+++ b/src/recipe.rs
@@ -355,6 +355,8 @@ impl<'src, D> Recipe<'src, D> {
.unwrap_or_else(|| Interpreter::default_script_interpreter()),
)
} else {
+ evaluated_lines[0] = format!("#!@TERMUX_PREFIX@{}", evaluated_lines[0][2..].to_string());
+ evaluated_lines[0] = evaluated_lines[0].replace("/usr/usr", "/usr");
let line = evaluated_lines
.first()
.ok_or_else(|| Error::internal("evaluated_lines was empty"))?;
@@ -370,7 +372,7 @@ impl<'src, D> Recipe<'src, D> {
let tempdir = match &context.module.settings.tempdir {
Some(tempdir) => tempdir_builder.tempdir_in(context.search.working_directory.join(tempdir)),
None => {
- if let Some(runtime_dir) = dirs::runtime_dir() {
+ if let runtime_dir = dirs::runtime_dir().unwrap_or("@TERMUX_PREFIX@/var/run/user".into()) {
let path = runtime_dir.join("just");
fs::create_dir_all(&path).map_err(|io_error| Error::RuntimeDirIo {
io_error,

0 comments on commit 9ff502d

Please sign in to comment.