Skip to content

Commit

Permalink
add optional architecture overriding for downloading altserver, netmu…
Browse files Browse the repository at this point in the history
…xd and provision binaries
  • Loading branch information
dreth committed Aug 10, 2024
1 parent 2f16ebf commit a7df9c0
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 3 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,31 @@ sudo docker run -d \

Logs will be stored in the directory where the container is ran inside `./logs`

## Optional environment variables

It's possible to override which architecture of altserver, netmuxd and anisette-server are downloaded by setting the following environment variables in the docker compose file:

```yaml
environment:
- OVERRIDE_ALTSERVER_ARCH=x86_64
- OVERRIDE_NETMUXD_ARCH=x86_64
- OVERRIDE_ANISETTE_ARCH=x86_64
```
or alternatively adding them in the `docker run` command before the image name:

```shell
-e OVERRIDE_ALTSERVER_ARCH=x86_64 \
-e OVERRIDE_NETMUXD_ARCH=x86_64 \
-e OVERRIDE_ANISETTE_ARCH=x86_64 \
```

You can check for which architectures are available by checking the releases of each project:

- [AltServer-Linux](https://github.com/NyaMisty/AltServer-Linux/releases)
- [netmuxd](https://https://github.com/jkcoxson/netmuxd/releases)
- [Provision](https://github.com/Dadoum/Provision/releases) (this is the anisette-server)

## Provision libraries

Provision automatically pulls the libraries it requires (libCoreADI.so and libstoreservicescore.so) from the apple music android apk, but this requires a 60+MB download it does automatically, so I decided to include these in the root of the repo already and have the `docker-entrypoint.sh` decompress them where Provision normally would. This is optional and can be removed/commented from the `docker-entrypoint.sh` if you prefer to have Provision download and pull them from the apk.
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ services:
- "/var/run:/var/run"
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
network_mode: host
# Optional environment variables to override the default architecture
# for the altserver, netmuxd, and anisette binaries.
# environment:
# - OVERRIDE_ALTSERVER_ARCH=x86_64
# - OVERRIDE_NETMUXD_ARCH=x86_64
# - OVERRIDE_ANISETTE_ARCH=x86_64
privileged: true
restart: unless-stopped
43 changes: 40 additions & 3 deletions scripts/get-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ save_version() {
fi
}

# Function to save the architecture to the architectures file
save_architecture() {
local component="$1"
local architecture="$2"
if grep -q "^$component" "/altserver/bin/architectures"; then
sed -i "s/^$component .*/$component $architecture/" "/altserver/bin/architectures"
else
echo "$component $architecture" >> "/altserver/bin/architectures"
fi
}

# Generalized function to check version and download files
check_and_download() {
local component="$1"
Expand Down Expand Up @@ -78,6 +89,11 @@ anisette_url="https://api.github.com/repos/Dadoum/Provision/releases/latest"

ARCH="$(uname -m)"

# Override architectures
OVERRIDE_ALTSERVER_ARCH="${OVERRIDE_ALTSERVER_ARCH:-}"
OVERRIDE_NETMUXD_ARCH="${OVERRIDE_NETMUXD_ARCH:-}"
OVERRIDE_ANISETTE_ARCH="${OVERRIDE_ANISETTE_ARCH:-}"

# Ensure bin directory exists
mkdir -p "/altserver/bin"

Expand All @@ -87,10 +103,31 @@ altstore_download_url=$(curl -s "$altstore_url" | jq -r "$altstore_download_path
check_and_download "AltStore" "$altstore_url" "$altstore_version_path" "$altstore_download_url" "/altserver/bin/AltStore.ipa"

# Check and download AltServer
check_and_download "AltServer" "$altserver_url" ".tag_name" "https://github.com/NyaMisty/AltServer-Linux/releases/download/%s/AltServer-${ARCH}" "/altserver/bin/AltServer"
# If the architecture is overridden, use the overridden value
if [ -n "$OVERRIDE_ALTSERVER_ARCH" ]; then
ALTSERVER_PKG_ARCH="AltServer-${OVERRIDE_ALTSERVER_ARCH}"
else
ALTSERVER_PKG_ARCH="AltServer-${ARCH}"
fi
check_and_download "AltServer" "$altserver_url" ".tag_name" "https://github.com/NyaMisty/AltServer-Linux/releases/download/%s/${ALTSERVER_PKG_ARCH}" "/altserver/bin/AltServer"

# Check and download netmuxd
check_and_download "netmuxd" "$netmuxd_url" ".tag_name" "https://github.com/jkcoxson/netmuxd/releases/download/%s/${ARCH}-linux-netmuxd" "/altserver/bin/netmuxd"
if [ -n "$OVERRIDE_NETMUXD_ARCH" ]; then
NETMUXD_PKG_ARCH="${OVERRIDE_NETMUXD_ARCH}-linux-netmuxd"
else
NETMUXD_PKG_ARCH="${ARCH}-linux-netmuxd"
fi
check_and_download "netmuxd" "$netmuxd_url" ".tag_name" "https://github.com/jkcoxson/netmuxd/releases/download/%s/${NETMUXD_PKG_ARCH}" "/altserver/bin/netmuxd"

# Check and download anisette-server
check_and_download "anisette-server" "$anisette_url" ".tag_name" "https://github.com/Dadoum/Provision/releases/download/%s/anisette-server-${ARCH}" "/altserver/bin/anisette-server"
if [ -n "$OVERRIDE_ANISETTE_ARCH" ]; then
ANISETTE_PKG_ARCH="anisette-server-${OVERRIDE_ANISETTE_ARCH}"
else
ANISETTE_PKG_ARCH="anisette-server-${ARCH}"
fi
check_and_download "anisette-server" "$anisette_url" ".tag_name" "https://github.com/Dadoum/Provision/releases/download/%s/${ANISETTE_PKG_ARCH}" "/altserver/bin/anisette-server"

# Save the architectures
save_architecture "AltServer" "$ALTSERVER_PKG_ARCH"
save_architecture "netmuxd" "$NETMUXD_PKG_ARCH"
save_architecture "anisette-server" "$ANISETTE_PKG_ARCH"

0 comments on commit a7df9c0

Please sign in to comment.