-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.sh
69 lines (56 loc) · 1.83 KB
/
service.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/system/bin/sh
## This script is part of the iYT module project.
## ipdev @ xda-developers
## Requires YouTube Music to be installed as a user app.
## Required YouTube Music version is 5.36.51
## Module directory(s) set by Magisk.
MODDIR=${0%/*}
# Module Directory
MDIR=${0%/*}
# Magisk Modules Directory
MMDIR=${MDIR%/*}
# ADB Directory
ADB=${MMDIR%/*}
# Required versionCode.
RYTMVC=53651240
# Required architecture.
# ARCH=arm64-v8a
# ARCH=armeabi-v7a
# Get SDK level and architecture.
SDK=$(getprop ro.build.version.sdk);
# ARCH=$(getprop ro.product.cpu.abi);
# # Check YTM architecture..
# if [ ! $ABI = $ARCH ]; then
# echo "$(date '+%Y%m%d_%H%M')" "Wrong architecture." >>$MODDIR/error.log;
# YTMMOD=ABORT;
# fi;
# Find and set YouTube Music path.
if [ $SDK -ge 30 ]; then
YTMPATH=$(readlink -f /data/app/*/com.google.android.apps.youtube.music*/lib | sed 's/\/lib//g');
else
YTMPATH=$(readlink -f /data/app/com.google.android.apps.youtube.music*/lib | sed 's/\/lib//g');
fi;
# Check YouTube Music path.
if [ ! -f $YTMPATH/base.apk ]; then
echo "$(date '+%Y%m%d_%H%M')" "No user installed YouTube path found." >>$MODDIR/error.log;
YTMMOD=ABORT;
fi;
# Find installed (active) YouTube Music versionCode.
if [ -z $YTMMOD ]; then
while [ -z $YTMVC ]; do
YTMVC=$(dumpsys package com.google.android.apps.youtube.music | grep versionCode | cut -f2 -d'=' | tr -d '\n' | cut -f1 -d' ');
date +%N > /dev/null;
done;
fi;
# Check YouTube Music versionCode.
if [ ! $YTMVC = $RYTMVC ]; then
echo "$(date '+%Y%m%d_%H%M')" "Wrong version of YouTube Music found." >>$MODDIR/error.log;
YTMMOD=ABORT;
elif [ -z $YTMVC ]; then
echo "$(date '+%Y%m%d_%H%M')" "No user installed version of YouTube Music found." >>$MODDIR/error.log;
YTMMOD=ABORT;
fi;
# Mount if failsafe(s) pass.
if [ -z $YTMMOD ]; then
su -c mount $ADB/iytm/base.apk $YTMPATH/base.apk;
fi;