Modern Apps git

← xtool.git

Docker and Linux

Commit
6a59e7ad2e8612290481dd6534794eb5d09e2591
Author
Kabir Oberai <[email protected]>
When
2024-11-17 08:47 UTC (2 years ago)
Parents
26b8c77

Diff

Dockerfile
diff --git a/Dockerfile b/Dockerfilenew file mode 100644index 0000000..dbd7adb--- /dev/null+++ b/Dockerfile@@ -0,0 +1,91 @@+# Note: We use 20.04 since AppImage recommends building on the+# oldest configuration that you support++FROM ubuntu:focal AS limd-build++RUN apt-get update \+    && apt-get install -y --no-install-recommends \+    ca-certificates \+    build-essential \+    checkinstall \+    git \+    autoconf \+    automake \+    libtool-bin \+    libssl-dev \+    pkg-config \+    libcurl4-openssl-dev \+    && rm -rf /var/lib/apt/lists/*++RUN mkdir /prefix++RUN git clone https://github.com/libimobiledevice/libplist.git \+    && cd libplist \+    && ./autogen.sh --prefix /usr --without-cython \+    && make \+    && make install \+    && make install DESTDIR=/prefix \+    && cd .. \+    && rm -rf libplist++RUN git clone https://github.com/libimobiledevice/libimobiledevice-glue.git \+    && cd libimobiledevice-glue \+    && ./autogen.sh --prefix /usr \+    && make \+    && make install \+    && make install DESTDIR=/prefix \+    && cd .. \+    && rm -rf libimobiledevice-glue++RUN git clone https://github.com/libimobiledevice/libusbmuxd.git \+    && cd libusbmuxd \+    && ./autogen.sh --prefix /usr \+    && make \+    && make install \+    && make install DESTDIR=/prefix \+    && cd .. \+    && rm -rf libusbmuxd++RUN git clone https://github.com/libimobiledevice/libtatsu.git \+    && cd libtatsu \+    && ./autogen.sh --prefix /usr \+    && make \+    && make install \+    && make install DESTDIR=/prefix \+    && cd .. \+    && rm -rf libtatsu++RUN git clone https://github.com/libimobiledevice/libimobiledevice.git \+    && cd libimobiledevice \+    && ./autogen.sh --prefix /usr --without-cython --enable-debug \+    && make \+    && make install \+    && make install DESTDIR=/prefix \+    && cd .. \+    && rm -rf libimobiledevice+++FROM swift:6.0-focal++RUN apt-get update \+    && apt-get install -y --no-install-recommends \+    curl \+    libssl-dev \+    ca-certificates \+    zip unzip \+    && rm -rf /var/lib/apt/lists/*+++COPY --from=limd-build /prefix/usr /usr++# Docker doesn't support FUSE+ENV APPIMAGE_EXTRACT_AND_RUN=1++# Use the host's usbmuxd.+# You probably want to use socat on the host to forward this port to /var/run/usbmuxd:+# socat -dd TCP-LISTEN:27015,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/run/usbmuxd+ENV USBMUXD_SOCKET_ADDRESS=host.docker.internal:27015++WORKDIR /Supersign++ENTRYPOINT [ "/bin/bash" ]
Linux/.gitignore
diff --git a/Linux/.gitignore b/Linux/.gitignorenew file mode 100644index 0000000..c3ff646--- /dev/null+++ b/Linux/.gitignore@@ -0,0 +1,5 @@+/packages+/staging+/storage+appimage-build+AppDir
Linux/README.md
diff --git a/Linux/README.md b/Linux/README.mdnew file mode 100644index 0000000..09029aa--- /dev/null+++ b/Linux/README.md@@ -0,0 +1,24 @@+# Supersign + Linux = <3++Supersign currently uses AppImage to build its Linux CLI. It is possible to build and run the AppImage on a native Linux host, as well as through Docker (natively or through Docker Desktop on macOS).++## Setup++Make sure `usbmuxd` is installed on your host machine. On macOS, `usbmuxd` is preinstalled.++### Using Docker++You can build and run a container with standard Docker Compose commands, for example:+```+docker compose run --rm supersign+``` +This will spawn a shell inside the container. The Supersign root directory will be bind-mounted at `/Supersign`.++To actually access iOS devices from inside Docker, you'll also need to forward the host's `usbmuxd` to a port which the Docker container's libusbmuxd will connect to. Keep this command running on your host machine:+```+socat -dd TCP-LISTEN:27015,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/run/usbmuxd+```++## Building++Simply run `./build.sh` in this directory. This will output an AppImage to `packages/Supersign.AppImage`, which can directly be invoked.
Linux/Supersign.desktop
diff --git a/Linux/Supersign.desktop b/Linux/Supersign.desktopnew file mode 100644index 0000000..9938068--- /dev/null+++ b/Linux/Supersign.desktop@@ -0,0 +1,9 @@+[Desktop Entry]+Version=1.0+Type=Application+Name=Supersign+Categories=Development;+Exec=SupersignCLI+Icon=Supersign+# TODO: remove+Terminal=true
Linux/Supersign.png
diff --git a/Linux/Supersign.png b/Linux/Supersign.pngnew file mode 100644index 0000000..a0c6b1fBinary files /dev/null and b/Linux/Supersign.png differ
Linux/build.sh
diff --git a/Linux/build.sh b/Linux/build.shnew file mode 100755index 0000000..7bd25c4--- /dev/null+++ b/Linux/build.sh@@ -0,0 +1,39 @@+#!/bin/bash++set -e+shopt -s nullglob++# installer version+export VERSION="1.0.0"++if ! command -v fusermount &>/dev/null; then+    # Docker doesn't support FUSE+    export APPIMAGE_EXTRACT_AND_RUN=1+fi++rm -rf staging+mkdir staging++swift build --package-path .. -c release --product SupersignCLI --static-swift-stdlib+bin="$(swift build --package-path .. -c release --show-bin-path)"+strip "${bin}/SupersignCLI"++curl "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$(arch).AppImage" \+    -Lo staging/linuxdeploy.AppImage+chmod +x staging/linuxdeploy.AppImage++mkdir -p staging/AppDir/usr/bin+find "${bin}"/ -name '*.resources' -print0 | xargs -0 -I {} cp -a {} "${PWD}/staging/AppDir/usr/bin/"++OUTPUT="staging/Supersign.AppImage" ./staging/linuxdeploy.AppImage \+    --appdir staging/AppDir \+    --output appimage \+    -e "${bin}/SupersignCLI" \+    -d Supersign.desktop \+    -i Supersign.png+mkdir -p packages+mv -f staging/Supersign.AppImage packages/Supersign.AppImage++rm -rf staging++echo "[info] Success!"
docker-compose.yml
diff --git a/docker-compose.yml b/docker-compose.ymlnew file mode 100644index 0000000..47f53d1--- /dev/null+++ b/docker-compose.yml@@ -0,0 +1,18 @@+services:+  supersign:+    build:+      context: .+    volumes:+      - .:/Supersign+    container_name: supersign+    stdin_open: true+    tty: true+    cap_add:+      - sys_ptrace+    security_opt:+      - seccomp:unconfined+    extra_hosts:+      # host.docker.internal doesn't exist by default on Linux hosts+      # TODO: Does this conflict with the default host on macOS?+      # we could rename this+      - "host.docker.internal:host-gateway"