Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions common-files/building-system-patches/0008-disable-apparmor.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,48 @@
--- a/scripts/build/toolchain/termux_setup_toolchain_29.sh
+++ b/scripts/build/toolchain/termux_setup_toolchain_29.sh
@@ -133,7 +133,7 @@ termux_setup_toolchain_29() {
[ -d "${TERMUX_STANDALONE_TOOLCHAIN}-work" ] || mkdir -p "${TERMUX_STANDALONE_TOOLCHAIN}-work"


- if ! mountpoint -q "${TERMUX_STANDALONE_TOOLCHAIN}"; then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR ensures that TUR entirely doesn't depend on FUSE. I think a more robust approach would be to unmount the filesystem first, to check if it is currently mounted.

Currently, I use a virtual machine to build packages. There will be some problems if I attempt to build a package using TUR immediately after having previously built a package using termux-packages.

Copy link
Copy Markdown
Member Author

@robertkirkman robertkirkman Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be some problems if I attempt to build a package using TUR immediately after having previously built a package using termux-packages.

Thank you for explaining that.

in my workflow, problems do not occur when I build a TUR package immediately after building a termux-packages package. That might be because of my practice of invariably using a unique CONTAINER_NAME with every different scripts folder that I manually set every time I download a new copy of the scripts folder. The reason I do that is because I consistently observed many problems occurring in the past as a result of attempting to share the same container for multiple separate scripts folders, that do not only have to do with AppArmor or fuse-overlayfs. However, I understand that not everyone finds it convenient to always use a different CONTAINER_NAME with every copy of the scripts folder.

In my opinion, this patch to disable both AppArmor and fuse-overlayfs should be a command line argument to the run-docker.sh script (and build-package.sh script) in upstream, but I'm not sure if thunder-coding would approve of that or not (because they wanted to encourage the use of both AppArmor and fuse-overlayfs in the main repository). I will try, and find out.

If this mode were a command line argument to the run-docker.sh script (and build-package.sh script) in upstream, then do you think that would solve your problem, because we could both use that command line argument while building our TUR and local packages, and then you wouldn't have a problem with building packages using TUR immediately after building packages using termux-packages, or am I not yet understanding the problem correctly?

+ if false; then
fuse-overlayfs \
"${TERMUX_STANDALONE_TOOLCHAIN}" \
-o lowerdir="${NDK}/toolchains/llvm/prebuilt/linux-x86_64" \
@@ -145,12 +145,17 @@ termux_setup_toolchain_29() {
return
fi

+ rm -rf "${TERMUX_STANDALONE_TOOLCHAIN}"
+
local _NDK_ARCHNAME=$TERMUX_ARCH
if [ "$TERMUX_ARCH" = "aarch64" ]; then
_NDK_ARCHNAME=arm64
elif [ "$TERMUX_ARCH" = "i686" ]; then
_NDK_ARCHNAME=x86
fi
+ cp "$NDK/toolchains/llvm/prebuilt/linux-x86_64" "${TERMUX_STANDALONE_TOOLCHAIN}" -r
+ cp "$NDK/source.properties" "${TERMUX_STANDALONE_TOOLCHAIN}"
+
# Remove android-support header wrapping not needed on android-21:
rm -Rf $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/local

--- a/scripts/run-docker.sh
+++ b/scripts/run-docker.sh
@@ -96,7 +96,7 @@ if [ "$UNAME" = Darwin ]; then
@@ -92,7 +92,7 @@ if [ "$UNAME" = Darwin ]; then
SEC_OPT=""
else
REPOROOT="$(dirname $(readlink -f $0))/../"
- SEC_OPT=" --security-opt seccomp=$REPOROOT/scripts/profile.json --security-opt apparmor=_custom-termux-package-builder-$CONTAINER_NAME --cap-add CAP_SYS_ADMIN --device /dev/fuse"
+ SEC_OPT=" --privileged --security-opt seccomp=unconfined --cap-add CAP_SYS_ADMIN --device /dev/fuse"
+ SEC_OPT=" --security-opt seccomp=$REPOROOT/scripts/profile.json"
fi

if [ "${CI:-}" = "true" ]; then
@@ -135,6 +135,7 @@ APPARMOR_PARSER=""
if command -v apparmor_parser > /dev/null; then
APPARMOR_PARSER="apparmor_parser"
@@ -138,6 +138,7 @@ if [ -z "$APPARMOR_PARSER" ] || ! $SUDO aa-status --enabled; then
echo " Avoid executing untrusted code in the container"
APPARMOR_PARSER=""
fi
+APPARMOR_PARSER=""

if [ -z "$APPARMOR_PARSER" ] || ! $SUDO aa-status --enabled; then
echo "WARNING: apparmor_parser not found, AppArmor profiles will not be loaded!"
load_apparmor_profile() {
local profile_path="$1"