-
Notifications
You must be signed in to change notification settings - Fork 287
Expand file tree
/
Copy pathbuild
More file actions
105 lines (91 loc) · 2.53 KB
/
Copy pathbuild
File metadata and controls
105 lines (91 loc) · 2.53 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
shopt -s extglob
ReplaceInclude()
{
local replace_path="$DEV_PATH"
local replace_name="$1"
if [ "$replace_name" == "build" ]
then
return
fi
if [ "$replace_name" == "src/\$self" ]
then
echo "${2:-}if [ \"\$self\" == \"tv\" ] || [ \"\$self\" == \"iptv\" ] || [ \"\$self\" == \"aios\" ]"
echo "${2:-}then"
ReplaceInclude src/tv " ${2:-}"
bins=(v2 x nx or pve arm ibm cf cx ali lhh rc cw dr ha)
for bin in "${bins[@]}"
do
echo "${2:-}elif [ \"\$self\" == \"$bin\" ]"
echo "${2:-}then"
ReplaceInclude src/$bin " ${2:-}"
done
echo "${2:-}elif [ \"\$self\" == \"tr\" ]"
echo "${2:-}then"
ReplaceInclude src/tr " ${2:-}"
echo "${2:-}fi"
return
fi
# if [[ "$replace_name" == @($(JoinByChar '|' "${replace_files[@]//|/\\|}")) ]]
# then
# return
# fi
replace_files+=("$replace_name")
while [[ $replace_name =~ \/ ]]
do
replace_path="$replace_path/${replace_name%%/*}"
replace_name="${replace_name#*/}"
done
local here=false here_tag=""
while IFS= read -r line
do
if [ "$here" = true ]
then
echo "$line"
if [ "$line" = "$here_tag" ]
then
here=false
fi
continue
elif [[ $line =~ ^([ ]*)cat([ ]) ]]
then
here=true
here_tag="${line#*<<}"
here_tag="${here_tag#"${here_tag%%[![:space:]]*}"}"
here_tag=${here_tag%% *}
here_tag=${here_tag#-}
fi
if [ -z "$line" ]
then
echo
elif [ "$here" = true ]
then
echo "$line"
elif [[ $line =~ ^([ ]*)Include\ ([^ ]+) ]]
then
ReplaceInclude ${BASH_REMATCH[2]} "${2:-}${BASH_REMATCH[1]}"
elif [[ $line =~ ^([ ]*)\$\{ ]] || [[ $line =~ ^([ ]*)\` ]] || [[ $line =~ ^([ ]*)\— ]]
then
echo "$line"
else
echo "${2:-}$line"
fi
done < "$replace_path/$replace_name"
}
BuildShFile()
{
replace_files=()
ReplaceInclude make | sed '/DEV_PATH/,/sh_ver/{/sh_ver/!d;};/Include build/d' > "$DEV_PATH/aios.sh"
if [ "$INSTALL_SH" = true ]
then
cp -f "$DEV_PATH/aios.sh" "$SH_FILE"
fi
}
if [ "${1:-}" == "install" ]
then
INSTALL_SH=true
else
INSTALL_SH=false
fi
Spinner "Building aios.sh" BuildShFile
Println "$info new aios.sh created! For devs only!!\n"
exit 0