-
Notifications
You must be signed in to change notification settings - Fork 2
/
service.sh
59 lines (48 loc) · 1.54 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
#!/system/bin/sh
## This script is part of the iYT module project.
## ipdev @ xda-developers
## Requires YouTube to be installed as a user app.
## Required YouTube version is 17.49.37
## Module directory(s) set by Magisk.
MODDIR=${0%/*}
# Module Directory
MDIR=${0%/*}
# Magisk Modules Directory
MMDIR=${MDIR%/*}
# ADB Directory
ADB=${MMDIR%/*}
# Required YT versionCode.
RYTVC=1533275584
# Get SDK level and architecture.
SDK=$(getprop ro.build.version.sdk);
# ARCH=$(getprop ro.product.cpu.abi);
# Find and set YouTube path.
if [ $SDK -ge 30 ]; then
YTPATH=$(readlink -f /data/app/*/com.google.android.youtube*/lib | sed 's/\/lib//g');
else
YTPATH=$(readlink -f /data/app/com.google.android.youtube*/lib | sed 's/\/lib//g');
fi;
# Check YouTube path.
if [ ! -f $YTPATH/base.apk ]; then
echo "$(date '+%Y%m%d_%H%M')" "No user installed YouTube path found." >>$MODDIR/error.log;
YTMOD=ABORT;
fi;
# Find installed (active) YouTube versionCode.
if [ -z $YTMOD ]; then
while [ -z $YTVCODE ]; do
YTVCODE=$(dumpsys package com.google.android.youtube | grep versionCode | cut -f2 -d'=' | tr -d '\n' | cut -f1 -d' ');
date +%N > /dev/null;
done;
fi;
# Check YouTube versionCode.
if [ ! $YTVCODE = $RYTVC ]; then
echo "$(date '+%Y%m%d_%H%M')" "Wrong version of YouTube found." >>$MODDIR/error.log;
YTMOD=ABORT;
elif [ -z $YTVCODE ]; then
echo "$(date '+%Y%m%d_%H%M')" "No user installed version of YouTube found." >>$MODDIR/error.log;
YTMOD=ABORT;
fi;
# Mount if failsafe(s) pass.
if [ -z $YTMOD ]; then
su -c mount $ADB/iyt/base.apk $YTPATH/base.apk;
fi;