forked from fukiame/kernel_builder
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwrapper.sh
More file actions
executable file
·106 lines (90 loc) · 3.26 KB
/
Copy pathwrapper.sh
File metadata and controls
executable file
·106 lines (90 loc) · 3.26 KB
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
100
101
102
103
104
105
106
#!/usr/bin/env bash
#
# wrapper providing almost the same amount of verbosity as the main github actions workflow
sln=$(readlink -f "$0")
spath=$(dirname "$sln")
echo $spath
export OLDDIR=$(pwd)
cd $spath
source ./$1priv_env || { echo "$RUN_ID: incorrect envset: nonexistent priv_env, bailing" && exit 127 ; }
RUN_ID=$(shuf -ern4 {0..9} | sha1sum - | head -c 8)
RUN_START=$(date +"%s")
#ALT_RECIPENT=$2
#if [ ! -z $ALT_RECIPENT ]; then
# CHAT_ID="$ALT_RECIPENT"
#fi
bash tg_utils.sh msg "$RUN_ID: run started"
bash tg_utils.sh msg "$RUN_ID: using envset $1"
[ -z "$KDIR" ] && { echo "$RUN_ID: incorrect priv_env: KDIR was not set, bailing" && exit 127 ; } || :
bash tg_utils.sh msg "$RUN_ID: kernel dir: $KDIR"
if [ ! -z "$NOTE" ]; then
bash tg_utils.sh msg "$NOTE"
fi
if [ ! -z "$VERBOSE" ]; then
bash tg_utils.sh msg "host: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'=' -f2)%nlfree disk space: $(df --sync -BM --output=avail / | grep -v Avail)"
bash tg_utils.sh msg "cloning kernel source%nlrepo: $kernel_repo%nlbranch: $kernel_branch"
fi
if [ ! -d "$KDIR" ]; then
git clone ${kernel_repo} -b ${kernel_branch} "$KDIR" || exit 1
cd "$KDIR"
git submodule update --init --recursive
else
cd "$KDIR" || exit 1
git reset --hard
git checkout ${kernel_branch}
git fetch origin ${kernel_branch}
git reset --hard origin/${kernel_branch}
rm -rf KernelSU
git submodule update --init --recursive
fi
if [[ ! -z "$2" ]]; then rm -rf out ../zipper; fi
source ../$1env || { bash tg_utils.sh msg "$RUN_ID: incorrect envset: nonexistent env, bailing" && exit 127 ; }
bash ../tg_utils.sh msg "kernel name: ${kernel_name}%nlkernel ver: ${kernel_ver}%nlkernel head commit: ${kernel_head}%nldefconfig: ${defconfig}"
case $PATCH_KSU in
"both" )
bash ../tg_utils.sh msg "running compilation script(s): $COMPILERS"
bash ../build.sh "$COMPILERS" $1
bash ../tg_utils.sh msg "KernelSU patching enabled, patching"
bash ../ksu/applyPatches.sh $1 || exit 1
bash ../tg_utils.sh msg "running compilation script(s): $COMPILERS"
bash ../build.sh "$COMPILERS" $1
;;
"sus" )
bash ../tg_utils.sh msg "KernelSU and SuSFS patching enabled, patching"
bash ../ksu/asus.sh
bash ../tg_utils.sh msg "running compilation script(s): $COMPILERS"
bash ../build.sh "$COMPILERS"
;;
"" )
bash ../tg_utils.sh msg "running compilation script(s): $COMPILERS"
bash ../build.sh "$COMPILERS" $1
;;
* )
bash ../tg_utils.sh msg "KernelSU patching enabled, patching"
bash ../ksu/applyPatches.sh $1 || exit 1
bash ../tg_utils.sh msg "running compilation script(s): $COMPILERS"
bash ../build.sh "$COMPILERS" $1
;;
esac
if [[ $(ls *.log) ]]; then
for file in *.log ; do
if [ -e "${file}.info" ]; then
bash ../tg_utils.sh up "${file}" "$(cat "${file}.info")"
export RES=0
fi
done
fi
if [[ $(ls *.zip) ]]; then
for file in *.zip ; do
bash ../tg_utils.sh up "${file}" "$(cat "${file}.info")"
export RES=1
done
fi
rm *.zip* *.log
if [[ ! -z "$2" ]]; then
rm -rf out ../zipper
fi
RUN_END=$(date +"%s")
WDIFF=$((RUN_END - RUN_START))
[ "$RES" = "0" ] && bash ../tg_utils.sh msg "$RUN_ID: run failed in $((WDIFF / 60))m, $((WDIFF % 60))s" || bash ../tg_utils.sh msg "$RUN_ID: run ended in $((WDIFF / 60))m, $((WDIFF % 60))s"
cd "$OLDDIR"