From 73eeb8e8ae948277491656e15aa3e859e12de634 Mon Sep 17 00:00:00 2001 From: j-hc <25510067+j-hc@users.noreply.github.com> Date: Mon, 8 Aug 2022 00:51:25 +0300 Subject: [PATCH] update stuff --- build.sh | 4 ++-- utils.sh | 28 ++++++++++++---------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/build.sh b/build.sh index 75b13f3..1f5152a 100755 --- a/build.sh +++ b/build.sh @@ -35,8 +35,8 @@ reset_template get_xdelta if [ "$BUILD_YT" = true ]; then build_yt; fi -if [ "$BUILD_MUSIC_ARM64_V8A" = true ]; then build_music "$ARM64_V8A"; fi -if [ "$BUILD_MUSIC_ARM_V7A" = true ]; then build_music "$ARM_V7A"; fi +if [ "$BUILD_MUSIC_ARM64_V8A" = true ]; then build_music $ARM64_V8A; fi +if [ "$BUILD_MUSIC_ARM_V7A" = true ]; then build_music $ARM_V7A; fi if [ "$BUILD_TWITTER" = true ]; then build_twitter; fi if [ "$BUILD_REDDIT" = true ]; then build_reddit; fi if [ "$BUILD_MINDETACH_MODULE" = true ]; then diff --git a/utils.sh b/utils.sh index 9d1a21b..33ff561 100755 --- a/utils.sh +++ b/utils.sh @@ -37,9 +37,9 @@ extract_deb() { dl_if_dne "$deb_path" "$url" ar x "$deb_path" data.tar.xz if [ "${output: -1}" = "/" ]; then - tar -C "$output" -vxf data.tar.xz --wildcards "$path" --strip-components 7 + tar -C "$output" -xf data.tar.xz --wildcards "$path" --strip-components 7 else - tar -C "$TEMP_DIR" -vxf data.tar.xz "$path" --strip-components 7 + tar -C "$TEMP_DIR" -xf data.tar.xz "$path" --strip-components 7 mv -f "${TEMP_DIR}/${path##*/}" "$output" fi rm -rf data.tar.xz @@ -162,8 +162,7 @@ build_twitter() { build_yt() { echo "Building YouTube" reset_template - local last_ver - last_ver=$(get_patch_last_supported_ver "youtube") + declare -r last_ver=$(get_patch_last_supported_ver "youtube") echo "Choosing version '${last_ver}'" local stock_apk="${TEMP_DIR}/youtube-stock-v${last_ver}.apk" patched_apk="${TEMP_DIR}/youtube-revanced-v${last_ver}.apk" @@ -199,10 +198,10 @@ build_yt() { } build_music() { - echo "Building YouTube Music" + local arch=$1 + echo "Building YouTube Music (${arch})" reset_template - local arch=$1 last_ver - last_ver=$(get_patch_last_supported_ver "music") + declare -r last_ver=$(get_patch_last_supported_ver "music") echo "Choosing version '${last_ver}'" local stock_apk="${TEMP_DIR}/music-stock-v${last_ver}-${arch}.apk" patched_apk="${TEMP_DIR}/music-revanced-v${last_ver}-${arch}.apk" @@ -279,8 +278,7 @@ install_sh() { DUMP=$(dumpsys package __PKGNAME) MODULE_VER=__MDVRSN CUR_VER=$(echo "$DUMP" | grep versionName | head -n1 | cut -d= -f2) - -if [ -z "$CUR_VER" ]; then abort "ERROR: __PKGNAME is not installed!"; fi +[ -z "$CUR_VER" ] && "ERROR: __PKGNAME is not installed!" am force-stop __PKGNAME grep __PKGNAME /proc/mounts | while read -r line; do @@ -293,7 +291,7 @@ if [ "$MODULE_VER" != "$CUR_VER" ]; then ui_print " module : ${MODULE_VER}" abort "" fi - +ui_print "* Patching __PKGNAME" if [ "$ARCH" = "arm" ]; then export LD_LIBRARY_PATH=$MODPATH/lib/arm ln -s $MODPATH/xdelta_arm $MODPATH/xdelta @@ -304,24 +302,22 @@ else abort "ERROR: unsupported arch: ${ARCH}" fi chmod +x $MODPATH/xdelta - -ui_print "* Patching __PKGNAME" BASEPATH=$(echo "$DUMP" | grep path | cut -d: -f2 | xargs) -[ -z "$BASEPATH" ] && abort "ERROR: Base path not found" +[ -z "$BASEPATH" ] && abort "ERROR: Base path not found!" if ! op=$($MODPATH/xdelta -d -f -s $BASEPATH $MODPATH/rv.xdelta $MODPATH/base.apk 2>&1); then ui_print "ERROR: Patching failed!" ui_print "Make sure you installed __PKGNAME from the link given in releases section." abort "$op" fi ui_print "* Patching done" -rm -r $MODPATH/lib $MODPATH/*xdelta* - chcon u:object_r:apk_data_file:s0 $MODPATH/base.apk if ! op=$(mount -o bind $MODPATH/base.apk $BASEPATH 2>&1); then ui_print "ERROR: Mount failed!" abort "$op" fi -ui_print "* Mounted __PKGNAME"' +ui_print "* Mounted __PKGNAME" +rm -r $MODPATH/lib $MODPATH/*xdelta* +am force-stop __PKGNAME' s="${s//__PKGNAME/$1}" echo "${s//__MDVRSN/$2}" >"${MODULE_TEMPLATE_DIR}/common/install.sh"