tsu: ensure ~/.suroot/tmp exists

Fixes https://github.com/termux/termux-root-packages/issues/220.
This commit is contained in:
Henrik Grimler 2021-01-08 20:57:56 +01:00
parent 82168adf9b
commit 54015f157b
2 changed files with 33 additions and 1 deletions

32
packages/tsu/TMPDIR.patch Normal file
View File

@ -0,0 +1,32 @@
commit 1e4105bdbd36c8a2cb34a16958a285b2372859a1
Author: Henrik Grimler <henrik@grimler.se>
Date: Fri Jan 8 20:42:21 2021 +0100
Create TMPDIR if it does not exist
Applications tend to assume that TMPDIR exists, and might fail
otherwise.
diff --git a/shell/tsu.sh b/shell/tsu.sh
index 8b349a9..8874cc4 100755
--- a/shell/tsu.sh
+++ b/shell/tsu.sh
@@ -155,15 +155,15 @@ env_path_helper() {
log_DEBUG SWITCH_USER
if [[ -z "$SWITCH_USER" ]]; then
## By default we start a fresh root shell with HOME set to that of the root home
-
- # Creat root $HOME if it doesnt exsists yet
- [[ -d "$ROOT_HOME" ]] || mkdir "$ROOT_HOME"
NEW_HOME="$ROOT_HOME"
EXP_ENV[PREFIX]="$PREFIX"
EXP_ENV[TMPDIR]="$ROOT_HOME/.tmp"
EXP_ENV[LD_PRELOAD]="$LD_PRELOAD"
+ # Create $TMPDIR, and $HOME, if they do not exist
+ [[ -d "${EXP_ENV[TMPDIR]}" ]] || mkdir -p "${EXP_ENV[TMPDIR]}"
+
log_DEBUG _TSU_AS_SUDO
if [[ "$_TSU_AS_SUDO" == true ]]; then
# sudo copies PATH variable, so most user binaries can run as root

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="A su wrapper for Termux"
TERMUX_PKG_LICENSE="ISC"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=8.5.1
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_SRCURL=https://github.com/cswl/tsu/archive/v$TERMUX_PKG_VERSION.tar.gz