diff --git a/Dockerfile b/Dockerfile index c01b3b5..e6a6fc9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,15 @@ FROM ubuntu -RUN apt-get update -RUN apt-get install -y bsdmainutils curl wget jq openjdk-17-jre aapt +RUN apt-get update && apt-get install -y git jq openjdk-17-jdk zip wget +RUN git clone --recurse https://github.com/revanced-apks/build-apps.git /app WORKDIR /app - -COPY revanced.sh . -RUN chmod +x revanced.sh +RUN sed -i 's/ks\.keystore/build\/revanced\.keystore/g' build.sh +RUN sed -i 's/enabled = false/enabled = true/g' config.toml RUN groupadd -g 1000 revanced RUN useradd -u 1000 -g revanced revanced RUN chown -R revanced:revanced /app USER revanced -ENTRYPOINT [ "./revanced.sh" ] -CMD [ "-A" ] +CMD [ "bash", "build.sh" ] diff --git a/README.md b/README.md index 189d46d..904b417 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # docker-revanced-builder -A bash script that will help you build Revanced apps using Docker. Based on [revanced-automatic-builder](https://github.com/gnuhead-chieb/revanced-automatic-builder). +A Docker container that will help you build Revanced apps. Based on [revanced-apks/build-apps](https://github.com/revanced-apks/build-apps). ```shell -docker run -v $(pwd)/build:/app/build -v $(pwd)/out:/app/out -e GITHUB_TOKEN=YOUR_GITHUB_TOKEN registry.karaolidis.com/nikas36/revanced-builder:latest +docker run -v $(pwd)/build:/app/build -e GITHUB_TOKEN=YOUR_GITHUB_TOKEN registry.karaolidis.com/nikas36/revanced-builder:latest ``` ## Environment Variables @@ -14,11 +14,10 @@ docker run -v $(pwd)/build:/app/build -v $(pwd)/out:/app/out -e GITHUB_TOKEN=YOU ## Volumes -| Volume | Description | -| ------------ | --------------------- | -| `/app/build` | The build directory. | -| `/app/out` | The output directory. | +| Volume | Description | +| ------------ | ----------------------------------------------- | +| `/app/build` | The build directory (should contain a keystore) | ## Notes -Remember to download [VancedMicroG](<[VancedMicroG](https://github.com/TeamVanced/VancedMicroG/releases)>) in order to be able to sign in to your Google account. +Remember to download [VancedMicroG](https://github.com/TeamVanced/VancedMicroG/releases) in order to be able to sign in to your Google account. diff --git a/revanced.sh b/revanced.sh deleted file mode 100755 index 08a7a2c..0000000 --- a/revanced.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/bash - -cli_api="https://api.github.com/repos/revanced/revanced-cli/releases/latest" -patches_api="https://api.github.com/repos/revanced/revanced-patches/releases/latest" -integrations_api="https://api.github.com/repos/revanced/revanced-integrations/releases/latest" - -vc=4 - -apps=("youtube" "music" "twitter" "reddit" "tiktoka" "tiktokg" "spotify" "windyapp" "nyx" "backdrops" "expensemgr" "hexedit" "ticktick" "warnapp" "iconpack" "citra" "myexpenses" "twitch") - -youtube=( - "Youtube" - "https://apkcombo.com/youtube/com.google.android.youtube" -) -music=( - "Youtube Music" - "https://apkcombo.com/youtube-music/com.google.android.apps.youtube.music" -) -twitter=( - "Twitter" - "https://apkcombo.com/twitter/com.twitter.android" -) -reddit=( - "Reddit" - "https://apkcombo.com/reddit/com.reddit.frontpage" -) -tiktoka=( - "TikTok(Asia)" - "https://apkcombo.com/tiktok-asia/com.ss.android.ugc.trill" -) -tiktokg=( - "Tiktok(Global)" - "https://apkcombo.com/tiktok/com.zhiliaoapp.musically" -) -spotify=( - "Spotify" - "https://apkcombo.com/spotify/com.spotify.music" -) -windyapp=( - "Windy.app" - "https://apkcombo.com/windy-app/co.windyapp.android" -) -nyx=( - "Nyx Music Player" - "https://apkcombo.com/nyx-music-player/com.awedea.nyx" -) -backdrops=( - "Backdrops - Wallpapers" - "https://apkcombo.com/backdrops-wallpapers/com.backdrops.wallpapers" -) -expensemgr=( - "Money Manager" - "https://apkcombo.com/money-manager-expense-budget/com.ithebk.expensemanager" -) -hexedit=( - "HEX Editor" - "https://apkcombo.com/hex-editor/com.myprog.hexedit" -) -ticktick=( - "TickTick" - "https://apkcombo.com/ticktick/com.ticktick.task" -) -warnapp=( - "WarnWetter" - "https://apkcombo.com/warnwetter/de.dwd.warnapp" -) -iconpack=( - "Icon Pack Studio" - "https://apkcombo.com/icon-pack-studio/ginlemon.iconpackstudio" -) -citra=( - "Citra Emulator" - "https://apkcombo.com/citra-emulator/org.citra.citra_emu" -) -myexpenses=( - "My Expenses" - "https://apkcombo.com/my-expenses/org.totschnig.myexpenses" -) -twitch=( - "Twitch" - "https://apkcombo.com/twitch/tv.twitch.android.app" -) - -mkdir /app/build &>/dev/null -mkdir /app/out &>/dev/null -cd /app/build - -function getappver() { - ver=$(jq -r ".[].compatiblePackages[]|select(.name==\"$(eval echo \${$1[1]} | awk -F/ '{print $NF}')\")|.versions[]" ./patches.json | awk '{if(m<$NF) m=$NF} END{print m}') - [[ -n "$ver" ]] || ver="all" - echo $ver -} - -# Check version and download revanced packages -for pkg in cli patches integrations; do - ver=$(eval curl -sH \"Authorization: token $GITHUB_TOKEN\" '$'${pkg}_api | jq -r ".name") - download=$(eval curl -sH \"Authorization: token $GITHUB_TOKEN\" '$'${pkg}_api | jq -r ".assets[-1].browser_download_url") - [[ $ver == "null" ]] && { - echo "${pkg^}:API Error" - continue - } - ls $pkg-$ver &>/dev/null && echo ${pkg^}:updated! || { - rm -f $pkg-* - wget "$download" -c -t 15 -O $pkg-$ver - } -done - -# Fetch Patches database -wget https://github.com/revanced/revanced-patches/raw/main/patches.json &>/dev/null - -exclude="" -if [ $# -eq 2 ]; then - if [ "$1" == "--exclude" ] || [ "$1" == "-e" ]; then - excludes=$2 - exclude=" -e ${excludes//,/ -e }" - fi -fi - -# List patch available app versions -echo -e "Loading apps... \n" -{ - opt=0 - for pkg in ${apps[@]}; do - eval echo "$opt:\${$pkg[0]},$(getappver $pkg)" - ((opt++)) - done -} | column -t -s, - -# If the script was run with no arguments, prompt the user to select apps -if [ $# -eq 0 ]; then - read -p "Enter the app numbers you want to download, leave blank for all (e.g. 1,3,5-7): " menuinput - if [[ -z $menuinput ]]; then - menuinput=0-$((${#apps[@]} - 1)) - fi -# If the script was run with -a or --apps, use the second argument as the app numbers -elif [ $# -eq 2 ]; then - if [ "$1" == "--apps" ] || [ "$1" == "-a" ]; then - menuinput=$2 - fi -fi -# If the script was run with -A or --all, download all apps -if [ $# -eq 1 ]; then - if [ "$1" == "--all" ] || [ "$1" == "-A" ]; then - menuinput=0-$((${#apps[@]} - 1)) - fi -fi - -IFS=',' read -ra app_nums <<<"$menuinput" -invalid_input=false -selected_apps=() -for num in "${app_nums[@]}"; do - if [[ $num =~ ^[0-9]+$ ]]; then - if ((num >= 0 && num < ${#apps[@]})); then - selected_apps+=($num) - else - invalid_input=true - break - fi - elif [[ $num =~ ^([0-9]+)-([0-9]+)$ ]]; then - start=${BASH_REMATCH[1]} - end=${BASH_REMATCH[2]} - if ((start < end && start >= 0 && end < ${#apps[@]})); then - for ((i = start; i <= end; i++)); do - selected_apps+=($i) - done - else - invalid_input=true - break - fi - else - invalid_input=true - break - fi -done -if $invalid_input; then - echo "Invalid input. Please enter a comma-separated list of integers or ranges." -fi - -# Download required apk from APKCombo and patch -for i in ${selected_apps[@]}; do - rm -f ${apps[$i]}-orig.apk &>/dev/null - ver=$(getappver ${apps[$i]}) - [[ "$ver" = "all" ]] && req="apk" || req="phone-${ver}-apk" - wget $(eval curl -s "\${${apps[$i]}[1]}/download/${req}" | grep -oPm1 "(?<=href=\")https://download.apkcombo.com/.*?(?=\")")\&$(curl -s "https://apkcombo.com/checkin") -O ${apps[$i]}-orig.apk - java -jar cli-* -b patches-* -m integrations-*$exclude -a ${apps[$i]}-orig.apk -c -o ${apps[$i]}-patched.apk --experimental --keystore revanced.keystore - mv ${apps[$i]}-patched.apk /app/out -done