Skip to content

Commit

Permalink
scripts(setup-ubuntu|setup-archlinux): do not use hardcoded /data p…
Browse files Browse the repository at this point in the history
…ath for setting ownership of `TERMUX__PREFIX` and create `TERMUX_APP__DATA_DIR` as well in case `TERMUX__PREFIX` is not under it

Ownership of `TERMUX__PREFIX` must be fixed before `TERMUX_APP__DATA_DIR` if its under it, otherwise `TERMUX__ROOTFS` will not have its ownership fixed and following error would occur during package dependency extraction.

`tar: data/data/com.termux/files: Cannot change mode to rwxr-xr-x: Operation not permitted`
  • Loading branch information
agnostic-apollo committed Dec 22, 2024
1 parent bcc922f commit e7be404
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions scripts/setup-archlinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ fi

$SUDO pacman -Syq --noconfirm $PACKAGES

$SUDO mkdir -p /data/data/com.termux/files/usr
$SUDO chown -R $(whoami) /data
. $(dirname "$(realpath "$0")")/properties.sh

# Ownership of `TERMUX__PREFIX` must be fixed before `TERMUX_APP__DATA_DIR`
# if its under it, otherwise `TERMUX__ROOTFS` will not have its ownership fixed.
$SUDO mkdir -p "$TERMUX__PREFIX"
$SUDO chown -R "$(whoami)" "$TERMUX__PREFIX"
$SUDO mkdir -p "$TERMUX_APP__DATA_DIR"
$SUDO chown -R "$(whoami)" "${TERMUX_APP__DATA_DIR%"${TERMUX_APP__DATA_DIR#/*/}"}" # Get `/path/` from `/path/to/app__data_dir`.

echo "Please also install ncurses5-compat-libs and makedepend packages from the AUR before continuing"
10 changes: 8 additions & 2 deletions scripts/setup-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,11 @@ curl -O http://security.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jr
$SUDO dpkg -i openjdk-8-jre-headless_8u212-b03-0ubuntu1."$UBUNTU_VERSION"_amd64.deb openjdk-8-jre_8u212-b03-0ubuntu1."$UBUNTU_VERSION"_amd64.deb openjdk-8-jdk_8u212-b03-0ubuntu1."$UBUNTU_VERSION"_amd64.deb openjdk-8-jdk-headless_8u212-b03-0ubuntu1."$UBUNTU_VERSION"_amd64.deb || $SUDO apt install -f -y
rm openjdk-8-jre-headless_8u212-b03-0ubuntu1."$UBUNTU_VERSION"_amd64.deb openjdk-8-jre_8u212-b03-0ubuntu1."$UBUNTU_VERSION"_amd64.deb openjdk-8-jdk_8u212-b03-0ubuntu1."$UBUNTU_VERSION"_amd64.deb openjdk-8-jdk-headless_8u212-b03-0ubuntu1."$UBUNTU_VERSION"_amd64.deb

$SUDO mkdir -p /data/data/com.termux/files/usr
$SUDO chown -R $(whoami) /data
. $(dirname "$(realpath "$0")")/properties.sh

# Ownership of `TERMUX__PREFIX` must be fixed before `TERMUX_APP__DATA_DIR`
# if its under it, otherwise `TERMUX__ROOTFS` will not have its ownership fixed.
$SUDO mkdir -p "$TERMUX__PREFIX"
$SUDO chown -R "$(whoami)" "$TERMUX__PREFIX"
$SUDO mkdir -p "$TERMUX_APP__DATA_DIR"
$SUDO chown -R "$(whoami)" "${TERMUX_APP__DATA_DIR%"${TERMUX_APP__DATA_DIR#/*/}"}" # Get `/path/` from `/path/to/app__data_dir`.

0 comments on commit e7be404

Please sign in to comment.