-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy paths3
executable file
·430 lines (375 loc) · 9.92 KB
/
s3
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
#!/bin/bash
SIMPLEVERSION="2024.07"
VERSIONCOUNTER="$(git rev-list --count HEAD 2>/dev/null || printf "$(echo "$SIMPLEVERSION" | sed -e 's/\(.\)/\1\+0/g' | bc)_non-git")"
DEVELOPER="Gorgone, WXbet"
OIFS=$IFS
export NCURSES_NO_UTF8_ACS=1
here_=$(pwd)
realdir=$(readlink -f $0)
cd "$(dirname $realdir)"
#set dir_vars
workdir="$(pwd)"
sdir="$workdir/support"
osdir="$sdir/os"
ldir="$sdir/logs"
adir="$sdir/archive"
configdir="$sdir/configs"
pdir="$sdir/patches"
profdir="$sdir/profiles"
bdir="$sdir/binaries"
sodir="$sdir/software"
dldir="$sdir/downloads"
fdir="$sdir/functions"
menudir="$sdir/menu_save"
brepo="$sdir/backup_repo"
tcdir="$sdir/toolchains"
tdir="$sdir/translation"
tccfgdir="$sdir/toolchains.cfg"
# create folders
mkdir -p "$tcdir/native/bin" 2>/dev/null
mkdir -p $sdir/{archive,binaries,downloads,software,logs,patches,backup_repo,menu_save} 2>/dev/null
[ -f $sdir/patches/no.patch ] && rm -f $sdir/patches/no.patch 2>/dev/null
# some migrations of deprecated directories
for migdir in backup_svn backup_git
do
if [ -d "$sdir/$migdir" ]; then
mv -f "$sdir/$migdir"/{*,.*} "$brepo/" 2>/dev/null
mv "$brepo/last.tar.gz" "$brepo/last${migdir: -3}.tar.gz" 2>/dev/null
ln -fs "$(readlink "$brepo/last${migdir: -3}.tar.gz" | awk -F'/' '{ print $NF }')" "$brepo/last${migdir: -3}.tar.gz"
rm -d "$sdir/$migdir"
fi
done
# create links
[ ! -d "$ldir" ] && clear && echo -e "\n folder creation error\n\n" && exit
[ -L "$workdir/logs" ] || ln -frs "$ldir" "$workdir/logs" 2>/dev/null
[ -L "$workdir/archive" ] || ln -frs "$adir" "$workdir/archive" 2>/dev/null
[ -L "$workdir/patches" ] || ln -frs "$pdir" "$workdir/patches" 2>/dev/null
[ -L "$workdir/binaries" ] || ln -frs "$bdir" "$workdir/binaries" 2>/dev/null
[ -L "$workdir/software" ] || ln -frs "$sodir" "$workdir/software" 2>/dev/null
[ -L "$workdir/profiles" ] || ln -frs "$profdir" "$workdir/profiles" 2>/dev/null
#set arrays
array_names_a=( SHORT_PROTOCOLS SHORT_READERS SHORT_CARD_READERS AVAI_TCLIST
MISS_TCLIST SHORT_ADDONS DISABLED_MODULES SHORT_MODULENAMES
ALL_MODULES_LONG ENABLED_MODULES INST_TCLIST SSH_CONF_CONTENT )
array_names_A=( INTERNAL_MODULES USE_vars USE_vars_disable s3cfg_vars )
for a_n in "${array_names_a[@]}"
do
unset $a_n
declare -a $a_n
done
for a_n in "${array_names_A[@]}"
do
unset $a_n
declare -A $a_n
done
USE_vars[USE_DIAG]=;
USE_vars[USE_TARGZ]=;
USE_vars[USE_PATCH]=;
USE_vars[USE_STAPI]=;
USE_vars[USE_STAPI5]=;
USE_vars[USE_CONFDIR]=;
USE_vars[USE_EXTRA]=;
USE_vars[USE_STATIC]=;
USE_vars[STATIC_LIBCRYPTO]=;
USE_vars[STATIC_SSL]=;
USE_vars[STATIC_LIBUSB]=;
USE_vars[STATIC_PCSC]=;
USE_vars[STATIC_LIBDVBCSA]=;
USE_vars[USE_OSCAMNAME]=;
s3cfg_vars[USE_TARGZ]=0
s3cfg_vars[DIRECTMENU]=0
s3cfg_vars[NO_REPO_AUTOUPDATE]=0
s3cfg_vars[USE_VERBOSE]=0
s3cfg_vars[S3_UPDATE_CHECK]=1
s3cfg_vars[S3_URL_CHECK]=1
s3cfg_vars[INSTALL_NATIVE_LIBDVBCSA]=1
s3cfg_vars[PATCH_WEBIF]=1
s3cfg_vars[SAVE_LISTSMARGO]=1
s3cfg_vars[ADD_PROFILE_NAME]=0
s3cfg_vars[NO_REPO_AUTOUPDATE]=0
s3cfg_vars[delete_oscamdebugbinary]=1
#filled arrays
config_cases=( all addons protocols readers card_readers );
s3opts=( cedit checkout clean fix_me get_patch help lang_select loadonly\
menu profiles ssh_profiles repoclean repopatch reporestore repoup syscheck sysinfo tccheck\
tcrepair tedit update update_me upload version ) # extendable with plugins
CUSTOM_CONFDIR="not_set"
pf_name="not_set"
#internal vars
OPENBOX=0
UFS916003=0
_t1e="VG9vbGNoYWluLQ=="
run="0"
cposx=0
cposy=0
on="_on"
off="_off"
pf="empty"
_verbose=""
menucall="no"
file_exist="0"
loadprofile="no"
s3cfg="$configdir/simplebuild.config"
# Compiler settings
cc_warn="-W -Wall -Wshadow -Wredundant-decls -Wstrict-prototypes -Wold-style-definition"
#compiling options for minimize cpu load
cc_opts="-ggdb -pipe -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-schedule-insns"
#compiling options for compatibility
#cc_opts="-ggdb -pipe -ffunction-sections -fdata-sections -o nodeadcode"
#compiling options for optimizing
#cc_opts="-ggdb -pipe -ffunction-sections -fdata-sections -o nodeadcode -ffast-math -fomit-frame-pointer -fthread-jumps -foptimize-strlen --no-inline"
#load default urls
source "$configdir/urls"
#load custom urls
[ -f "$workdir/oscamsource.url" ] && source "$workdir/oscamsource.url"
# switch trunkurl based on environment variable SOURCE
# needs an existing oscamsource.url file containing trunkurl<SOURCE>="some url"
# e.q. to force s3 to use trunkurlsvn which was defined in oscamsource.url, simply run: SOURCE=svn ./s3 menu
forcedurl="trunkurl$SOURCE"
[ -v trunkurl$SOURCE ] && trunkurl="${!forcedurl}" || unset SOURCE
#load translationlist
cd "$tdir"
langsupport=(*)
#load functions and plugins
if [ -d "$fdir" ]
then
cd "$fdir"
x=(*)
for i in "${x[@]}"
do
source "$i"
plugin=$(awk '/^#simplebuild_plugin/ {printf $2}' $i)
[ -z "$plugin" ] || s3opts+=($plugin)
done
else
echo "fail functions"
fi
#set additional dir_vars
REPO="$(REPOTYPE)"
ID="$(echo "$(REPOIDENT)" | tr ' ' '-')"
repodir="$workdir/oscam-${REPO}${ID}"
ispatched="$workdir/${REPO^^}${ID}-IS-PATCHED"
#software build support
if [ -d "$sodir" ]
then
cd "$sodir"
x=(*)
for i in "${x[@]}"
do
if [ -f "$i" ]; then
source "$i"
plugin=$(awk '/^#simplebuild_plugin/ {printf $2}' $i)
[ -z "$plugin" ] || s3opts+=($plugin)
fi
done
fi
#initialize simplebuild
initializeANSI # load colors
auto_langset # echo "info $txt_load_ok";
read_s3cfg # read simplebuild config
# check system #########################################################
syscheck
[ ! "$sanity" == "1" ] && echo "sanity fail" && sleep 5 && bye
########################################################################
_create_native_profile # put native datas to toolchains and configs
_get_config_con "$1" # echo $addons;exit;
_create_module_arrays # fill module arrays
_fill_tc_array # get # AVAI_TCLIST # INST_TCLIST # MISS_TCLIST
_set_dialog_types # fill $gui vars
_systype # check used uname
if [ -z "$1" ]
then
[ "${s3cfg_vars[DIRECTMENU]}" == "1" ] && _dialog_checkout && exit
_help
exit
else
for e in "${s3opts[@]}"
do
if [ "$e" == "$1" ]
then
case $e in
fix_me|checkout|update_me|reporestore|upload_cam)
if [ ! -n "$2" ]
then
eval "$e"
else
eval "$e" "$2"
fi
exit;;
menu)
if [ ! -n "$2" ]
then
_dialog_checkout
else
_dialog_checkout "$2"
fi;;
loadonly)
if [ ! -n "$2" ]
then
_nl
clear
s3logo
echo -e "$r_l\n $txt_error: toolchain $txt_parameter $txt_missing\n""$w_l"
_help_toolchain
sleep 2
exit
else
for t in "${AVAI_TCLIST[@]}"
do
_tmp="$2"
[ "$t" == "$2" ] && _load_toolchain "$2" && break
done
if [ -f "$tc_dl" ]
then
echo -e "$p_l\n\n toolchain for $_tmp loaded\n"
else
_nl
clear
s3logo
printf "$r_l toolchain missing/error\n"
fi
exit
fi;;
tccheck)
if [ ! -n "$2" ]
then
_nl
clear
s3logo
printf "$r_l\n $txt_error: toolchain $txt_parameter $txt_missing\n""$w_l"
_help_toolchain
printf "$W"
sleep 2
exit
else
for t in "${AVAI_TCLIST[@]}"
do
[ "$t" == "$2" ] && _toolchain_check "$2" && break
done
_nl
clear
s3logo
printf "$r_l\n toolchain missing/error\n$w_l"
_help_toolchain
echo -e "$W"
sleep 2
exit
fi;;
tcrepair)
if [ ! -n "$2" ];then
_nl
clear
s3logo
printf "$r_l\n $txt_error: toolchain $txt_parameter $txt_missing\n""$w_l"
_help_toolchain
printf "$W"
sleep 2
exit
else
_nl
clear
_toolchain_repair "$2"
sleep 2
exit
fi;;
upload)
if [ ! -n "$2" ]
then
_nl
clear
s3logo
echo -e "$r_l\n $txt_error: $txt_parameter $txt_missing""$w_l"
menucall="yes"
ssh_profiles
else
upload_cam "$2"
fi
exit;;
syscheck)
syscheck silent $2
exit;;
tedit)
if [ -n "$2" ]
then
for telement in ${INST_TCLIST[@]}
do
if [ "$telement" == "$2" ]
then
tedit $2
exit
fi
done
clear
s3logo
printf "$w_l\n $2 toolchain not installed\n"$W
fi
exit;;
help)
_help
exit;;
*)
shift && eval "$e" "$@"; #Remove the first command line argument and pass the remaining ones to the plugin
exit;;
esac
fi
done
for t in "${AVAI_TCLIST[@]}"
do
if [ "$t" == "$1" ]
then
[ "${2:0:4}" == "here" ] && EXTRA_COPY_DIR=1 || EXTRA_COPY_DIR=0
if [ "${2:0:3}" == "-p=" ] || [ "${2:0:3}" == "-P=" ]
then
if [ -f "$profdir/${2#*=}" ]
then
pf=$(cat "$profdir/${2#*=}")
pf_name="${2#*=}"
fi
fi
if [ "${3:0:3}" == "-p=" ] || [ "${3:0:3}" == "-P=" ]
then
if [ -f "$profdir/${2#*=}" ]
then
pf=$(cat "$profdir/${2#*=}")
pf_name="${2#*=}"
fi
fi
[ "$pf" == "empty" ] && c_m_d="$*" || c_m_d="all_off $pf $*"; # set only active module with profiles
for cmd in $c_m_d
do
if [ "${cmd:0:3}" == "-c=" ] || [ "${cmd:0:3}" == "-C=" ]
then
CUSTOM_CONFDIR="${cmd#*=}"
fi
if [ "${cmd:0:11}" == "-oscamname=" ]
then
USE_vars[USE_OSCAMNAME]="USE_OSCAMNAME=${cmd#*=}"
fi
for cc in "${config_cases[@]}"
do
[ "$cmd" == "$cc$on" ] && all_cc+=($cc$on) && break
[ "$cmd" == "$cc$off" ] && all_cc+=($cc$off) && break
done
for sm in "${SHORT_MODULENAMES[@]}"
do
[ "$cmd" == "$sm" ] && all_cc+=($(get_module_name "$sm")$on) && break
[ "$cmd" == "$sm$off" ] && all_cc+=($(get_module_name "$sm")$off) && break
done
for uvar in "${!USE_vars[@]}"
do
[ "$cmd" == "$uvar" ] && USE_vars[$uvar]="$uvar=1" && break
[ "$cmd" == "$uvar$off" ] && USE_vars_disable[$uvar]="$uvar=1" && break
done
case $cmd in
OPENBOX) OPENBOX=1;;
UFS916003) UFS916003=1;;
USE_VERBOSE) s3cfg_vars[USE_VERBOSE]=1;;
esac
done
_pre_build "$t"
exit
fi
done
_help
fi
exit