forked from baalajimaestro/auto-blob-updater
-
Notifications
You must be signed in to change notification settings - Fork 6
/
runner_user.sh
99 lines (86 loc) · 2.68 KB
/
runner_user.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.b (the "License");
# you may not use this file except in compliance with the License.
#
# CI Runner Script for Generation of blobs
# We need this directive
# shellcheck disable=1090
build_env() {
echo "Build Dependencies Installed....."
CURR_DIR=$(pwd)
}
rom() {
echo "Preparing to fetch firmware....."
python3 get_rom.py
unzip rom.zip -d miui > /dev/null 2>&1
cd miui
}
dec_brotli() {
echo "Decompressing brotli....."
brotli --decompress system.new.dat.br
brotli --decompress vendor.new.dat.br
}
sdatimg() {
echo "Converting to img....."
curl -sLo sdat2img.py https://raw.githubusercontent.com/xpirt/sdat2img/master/sdat2img.py
python3 sdat2img.py system.transfer.list system.new.dat > /dev/null 2>&1
python3 sdat2img.py vendor.transfer.list vendor.new.dat vendor.img > /dev/null 2>&1
}
extract() {
echo "Extracting the img's....."
mkdir system
mkdir vendor
7z x system.img -y -osystem > /dev/null 2>&1
7z x vendor.img -y -ovendor > /dev/null 2>&1
cd $CURR_DIR
}
build_conf() {
mkdir repo && cd repo
git config --global user.email "[email protected]"
git config --global user.name "Dyneteve"
}
init_repo() {
echo "Cloning vendor repo and its deps......."
git clone https://github.com/PixelExperience/vendor_aosp --depth=1 vendor/aosp > /dev/null 2>&1
git clone https://github.com/LineageOS/android_prebuilts_tools-lineage --depth=1 prebuilts/tools-custom > /dev/null 2>&1
}
dt() {
echo "Cloning device tree......."
git clone https://github.com/PixelExperience-Devices/device_xiaomi_violet -b ten device/xiaomi/violet > /dev/null 2>&1
git clone https://github.com/PixelExperience-Devices/vendor_xiaomi -b ten vendor/xiaomi > /dev/null 2>&1
cd device/xiaomi/violet
}
gen_blob() {
bash extract-files.sh $CURR_DIR/miui
echo "Blobs Generated!"
}
violet_patches() {
git clone https://Dyneteve:${API_KEY}@github.com/Dyneteve/patches.git patches > /dev/null 2>&1
cp patches/patch.sh $CURR_DIR/repo/vendor/xiaomi/violet/patch.sh
}
push_vendor() {
cd $CURR_DIR/repo/vendor/xiaomi/violet
git remote rm origin
git remote add origin https://Dyneteve:${API_KEY}@github.com/PixelExperience-Devices/vendor_xiaomi.git
# Patch my stuff
bash patch.sh && rm patch.sh
# For Dyneteve only
git add .
git commit -m "violet: Re-gen blobs from MIUI $(cat /tmp/version)" --signoff
git checkout -B ten
git push origin ten
echo "Job Successful!"
}
build_env
rom
dec_brotli
sdatimg
extract
build_conf
init_repo
dt
gen_blob
violet_patches
push_vendor