-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdl
More file actions
executable file
·779 lines (714 loc) · 19.1 KB
/
pdl
File metadata and controls
executable file
·779 lines (714 loc) · 19.1 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
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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
#!/usr/bin/bash
# LainOS Orginal Program 237865 2023
# This Project Writed for help you to Install Other Programs
# Writer : Eiko Akiba
# ---- For LainOS Team ----
# Information ( Don't change thease texts )
# default repo is https://github.com/ashk123/PDLP
# default OS is LainOS
# default version is 2.9
# default SHOW is all
# default MENU is 1
# default CONF_PATH is ~/.pdlrc
# pdlrc.sample is a sample config file
# Auto Patch Creator dependency file is main.dep
# Config Structure
# your config file should be on ~/.pdlrc ( you can change it on CONF_PATH var )
# repo: its a repo git address like https://yourgitservice/yourusername/yourpdlpreponame
# show: how menu start when you run pdl
# list: when you use -l, which group of programs that pdl should show you
# description: turn on or off information on custome list
VERSION="3.9"
NAME="LainOS LPD Package Downloader"
OS='LainOS'
CONF_PATH=$HOME
MENU='1'
SHOW='all'
DESC='on'
REPO='https://github.com/ashk123/PDLP'
API_REPO=${REPO:19:${#REPO}}
IFS='*'
function echo_title() { echo -ne "\033[1;44;37m${*}\033[0m\n"; }
function echo_caption() { echo -ne "\033[0;1;44m${*}\033[0m\n"; }
function echo_bold() { echo -ne "\033[0;1;34m${*}\033[0m\n"; }
function echo_danger() { echo -ne "\033[0;31m${*}\033[0m\n"; }
function echo_success() { echo -ne "\033[0;32m${*}\033[0m\n"; }
function echo_warning() { echo -ne "\033[0;33m${*}\033[0m\n"; }
function echo_secondary() { echo -ne "\033[0;34m${*}\033[0m"; }
function echo_info() { echo -ne "\033[0;35m${*}\033[0m\n"; }
function echo_primary() { echo -ne "\033[0;36m${*}\033[0m\n"; }
function echo_error() { echo -ne "\033[0;1;31merror:\033[0;31m\t${*}\033[0m\n"; }
function echo_label() { echo -ne "\033[0;1;32m${*}:\033[0m\t"; }
function echo_prompt() { echo -ne "\033[0;36m${*}\033[0m "; }
function splash() {
local hr
hr=" **$(printf "%${#1}s" | tr ' ' '*')** "
echo_title "${hr}"
echo_title " * $1 * "
echo_title "${hr}"
echo
}
function select_option {
ESC=$( printf "\033")
cursor_blink_on() { printf "$ESC[?25h"; }
cursor_blink_off() { printf "$ESC[?25l"; }
cursor_to() { printf "$ESC[$1;${2:-1}H"; }
print_option() { printf "$1 "; }
print_selected() { printf "$ESC[7m$1 $ESC[27m"; }
get_cursor_row() { IFS=';' read -sdR -p $'\E[6n' ROW COL; echo ${ROW#*[}; }
key_input() { read -s -n3 key 2>/dev/null >&2
if [[ $key = $ESC[A ]]; then echo up; fi
if [[ $key = $ESC[B ]]; then echo down; fi
if [[ $key = "" ]]; then echo enter; fi; }
for opt; do printf "\n"; done
local lastrow=`get_cursor_row`
local startrow=$(($lastrow - $#))
trap "cursor_blink_on; stty echo; printf '\n'; exit" 2
cursor_blink_off
local selected=0
while true; do
local idx=0
for opt; do
cursor_to $(($startrow + $idx))
if [ $idx -eq $selected ]; then
print_selected "$opt"
else
print_option "$opt"
fi
((idx++))
done
case `key_input` in
enter) break;;
up) ((selected--));
if [ $selected -lt 0 ]; then selected=$(($# - 1)); fi;;
down) ((selected++));
if [ $selected -ge $# ]; then selected=0; fi;;
esac
done
cursor_to $lastrow
printf "\n"
cursor_blink_on
return $selected
}
function select_opt {
select_option "$@" 1>&2
local result=$?
echo $result
return $result
}
function help_information()
{
if [[ $1 == "install" ]]; then
echo -ne "-----------------------\n Install \n-----------------------\n\n"
echo """Install your program with just one argumant
you can use it when you want to download special program without updating your system
if program have a dependency, actuly program download dependency too (if you don't have need dep, don't use )
you can install programs with:
pdl install <program>
like
pdl install nix
Have good time !
"""
elif [[ $1 == "make" ]]; then
echo -ne "--------------------\n Make \n--------------------\n\n"
echo """you can make your own patch file wihtout any work, just use:
pdl make <name_patch>
for making your own patch file
this maker, see your all files and install your files on correct folders on your system
you can change it to any you want
example:
pdl make <name>
like
pdl make new_program
If you need dependency on your patch file, you can make 'main.dep' file and write your dependencys
Notice: ( you should call file main.dep its very important )
Have good day/night !"""
elif [[ $1 == "search" ]]; then
echo -ne "--------------------\n Search \n--------------------\n\n"
echo """You can search packages ( patch files ) from repo that you config it on pdlrc
For example:
pdl search <patch_file>
"""
fi
}
function makepatch()
{
org="""--name $1
--desc :
this is nice for me
--code :
"""
files=$(ls $pwd)
if [ -f "${pwd}main.dep" ]; then
dep=$(cat main.dep);
mapfile -t strb <<< "$dep"
for ((b = 0; b < ${#strb[@]}; b++))
do
ddd=${strb[$b]}
if [[ ${ddd:0:1} != "#" ]]; then
if [[ $ddd != "" ]]; then
o+="${strb[$b]} ";
fi
fi
done
org+="DEP ${o:0:$(( ${#o} - 1))}\n"
fi
mapfile -t stra <<< "$files"
for ((a = 0; a < ${#stra[@]}; a++))
do
res=$(file ${stra[$a]})
if [[ $res =~ "ELF" ]]; then
echo "File ${stra[$a]} is binary !";
org+="sudo cp $pwd/${stra[$a]} /usr/local/bin\n"
elif [[ ${stra[$a]} == "Makefile" ]]; then
org+="make\n"
org+="sudo make install\n"
fi
done
echo -en $org > setup.pdl
# patch_adder $1.pdl
}
function Find(){
pfiles=$(sqlite3 mainsb "SELECT name FROM cus_prg")
mapfile pars_names <<< "$pfiles"
for ((a = 0; a < ${#pars_names[@]}; a++))
{
org=${pars_names[$a]};
if [[ $1 == ${org:0:-1} ]]; then
echo_danger "you have already had $1 this file !"
return 1;
fi
}
return 0;
}
# New version of PatchAdder (Beta)
function patch_adder()
{
echo $1;
stext=$1
slen=${#stext}
if [[ ${stext:$((slen - 3)):3} != "pdl" ]]; then
echo_danger "you can't use any file type !";
return 1;
fi
if [ -f "$(pwd)/$1" ]; then
path=$1
else
if [ -f "$(pwd)/PDLP/$1" ]; then
path="PDLP/$1"
else
echo "your file is not found !"
return 0;
fi
fi
file_name=$(sed -n 1p $path)
file_name_org=${file_name:7}
Find $file_name_org
res=$?
if [[ $res -eq 1 ]]; then
return 1;
fi
org=""
uncode=""
num=0;
code=$(cat $path | sed '/^[[:space:]]*$/d')
mapfile -t data <<< "$code"
for ((i = 1; i < ${#data[@]}; i++))
{
d=${data[$i]}
if [[ ${data[$i]} != "" ]]; then
if [[ ${d:0:6} == "--code" ]]; then
num="1";
elif [[ ${d:0:8} == "--uninst" ]]; then
num="3";
elif [[ $num == "1" ]]; then
org+="${data[$i]}*"
elif [[ ${d:0:6} == "--desc" ]]; then
num="2";
elif [[ $num == "2" ]]; then
org_des+="$d\n"
elif [[ $num == "3" ]]; then
uncode+="$d*";
fi
fi
}
sqlite3 mainsb "insert into cus_prg values ('$file_name_org', '$org_des', '$org', '$1', '$uncode');"
echo_success "[+] The $1 patch file was applied"
org=""
org_des=""
num=0;
}
function ConfigCore(){
shopt -s extglob
configfile="$CONF_PATH/.pdlrc"
tr -d '\r' < $configfile > $configfile.unix
while IFS='= ' read -r lhs rhs
do
if [[ ! $lhs =~ ^\ *# && -n $lhs ]]; then
rhs="${rhs%%\#*}"
rhs="${rhs%%*( )}"
rhs="${rhs%\"*}"
rhs="${rhs#\"*}"
declare $lhs="$rhs"
fi
done < $configfile.unix
rm -rf $CONF_PATH/.pdlrc.unix
if (( ${#repo} > 2 )); then
REPO=$repo;
fi
if (( ${#menu} > 0 )); then
MENU=$menu;
fi
if (( ${#list} > 1 )); then
SHOW=$list;
fi
if (( ${#description} > 1 )); then
DESC=$description;
fi
}
cust=()
$selc;
$pck_name;
$str;
# PDL Banner
splash "LainOS PDL - V$VERSION"
if [ -f "$CONF_PATH/.pdlrc" ]; then
ConfigCore
fi
function pe() {
dpkg -s "$1" &> /dev/null
return $?
}
function help()
{
echo_caption "-- LainOS Package Downloader LainOS (PDL) Version $VERSION --"
echo
echo_primary "Description :"
echo_secondary " This tool helps you to download and install packages that you can see in APT-REP or GIT-REP\n"
echo_secondary " We use Save installer commands into a database and you can install all packages with one click\n"
echo_secondary " You should have GIT for download from github\n"
echo_secondary " Is git available? "
if pe "git"; then
echo_success "Yes"
else
echo_danger "No!"
fi
echo
echo "-------------"
echo_primary "Arguments :"
echo_secondary "-h/--help "; echo_info "help command"
echo_secondary "-p "; echo_info "add patch file to PDL"
echo_secondary "-n "; echo_info "install normal level programs"
echo_secondary "-c "; echo_info "install compile level programs"
echo_secondary "-i "; echo_info "install custom programs"
echo_secondary "-l "; echo_info "list all programs and PDL patch files that currently PDL have"
echo_secondary "-u/--update "; echo_info "update patch files from PDLP git repository"
echo_secondary "-d "; echo_info "Remove Program with name"
echo_secondary "-r "; echo_info "Print repository that pdl currently use"
echo_secondary "install "; echo_info "Install any program from git repository"
echo_secondary "make "; echo_info "Create Auto patch file (setup.pdl)"
echo_secondary "search "; echo_info "Search your patch file ( depend on what repo do you config )"
echo_primary "----------------------------------------------------"
echo_secondary "help <content> "; echo_info "You can see each information (HOWTO) content"
}
function comp_inst()
{
data=($(sqlite3 mainsb 'select name from comp_prg'))
mapfile -t arr7 <<< "$data"
for ((i = 0; i < ${#arr7[@]}; i++))
{
if pe ${arr7[$i]}; then
echo_warning "[!] You already have ${arr7[$i]} package installed!"
else
eval "sudo apt install ${arr7[$i]}"
fi
}
}
#function norm_inst()
#{
# data2=($(sqlite3 mainsb 'select name from norm_prg'))
# mapfile -t arr5 <<< "$data2"
# for ((i = 0; i < ${#arr5[@]}; i++))
# {
# if pe ${arr5[$i]}; then
# echo_warning "[!] You already have ${arr5[$i]} package installed!"
# else
# eval "sudo apt install ${arr5[$i]}"
# fi
# }
#}
function customize_installation()
{
local t=$1
echo "[+] $t item is added to your program list ."
cust+=($t)
}
function custom()
{
dsa=$(realpath pdl)
data_name=($(sqlite3 mainsb "select name from cus_prg"))
mapfile -t dnc <<< "$data_name"
for ((o = 0; o < ${#dnc[@]}; o++))
do
if [[ ${dnc[$o]} == $1 ]]; then
data_code=$(sqlite3 mainsb "select code from cus_prg where name='$1'")
read -a strq <<< "$data_code"
break
fi
done
dep_line=${strq[0]};
if [[ ${dep_line:0:3} == "DEP" ]]; then
if [[ $2 != "2" ]]; then
dep_value=${dep_line:4:${#dep_line}}
spl_data=$dep_value;
#readarray -d " " -t strarr <<< "$spl_data"
PreInstall $spl_data $1
return 1;
fi
fi
#echo "------------------------------------"
#echo $1
#if [[ $1 == "just" ]]; then echo "asdkjalksdjaksldjaslkjkasljdkasj"; else echo "a$1.pdl"; fi
out_path="/tmp/$(( RANDOM % 100 )).sh"
echo "#!/usr/bin/bash" >> $out_path
for ((i = 0; i < ${#strq[@]}; i++))
do
run_data=${strq[$i]}
if [[ ${run_data:0:3} != "DEP" ]]; then
#echo "[!] Executing: ${strq[$i]}"
echo ${strq[$i]} >> $out_path
fi
done
chmod +x "$out_path"
source "$out_path"
cd "${dsa:0:$((${#dsa} - 3))}"
rm $out_path
echo "------------------------------"
}
function Uninstall()
{
data_name=($(sqlite3 mainsb "select name from cus_prg"))
mapfile -t dnc <<< "$data_name"
for ((o = 0; o < ${#dnc[@]}; o++))
do
if [[ ${dnc[$o]} == $1 ]]; then
data_code=$(sqlite3 mainsb "select uncode from cus_prg where name='$1'")
read -a strq <<< "$data_code"
break
fi
done
out_path="/tmp/$(( $RANDOM % 10 )).run"
echo "#!/usr/bin/bash" >> $out_path
for ((i = 0; i < ${#strq[@]}; i++))
do
run_data=${strq[$i]}
echo $run_data >> $out_path;
done
chmod +x "$out_path"
source "$out_path"
rm $out_path
}
function Search()
{
asd=$(curl -s https://api.github.com/repos/$API_REPO/contents | grep name | tr -d "," | tr -d " ")
asd=${asd//\"/""}
mapfile tg <<< "$asd";
chs=false;
num=0;
org_des="";
for ((a = 0; a < ${#tg[@]}; a++))
do
readarray -d ':' -t new_str <<< "${tg[$a]}"
org=$(echo ${new_str[1]} | tr -d "\n")
if [[ $1.pdl == $org ]]; then
chs=true;
code=$(curl -s https://raw.githubusercontent.com/$API_REPO/master/$1.pdl)
mapfile -t data <<< "$code"
for ((i = 1; i < ${#data[@]}; i++))
{
d=${data[$i]}
if [[ ${data[$i]} != "" ]]; then
if [[ ${d:0:6} == "--code" ]]; then
nuum=0;
break
fi
if [[ ${d:0:6} == "--desc" ]]; then
num="2";
elif [[ $num == "2" ]]; then
org_des+="$d\n"
fi
fi
}
echo_info "Package Name: $1"
echo_info "Description :\n"
echo_info $org_des
break;
fi
done
if [ $chs == false ]; then
echo_danger "I can't find your patch file !"
fi
}
function GetCount(){
#norm_count=($(sqlite3 mainsb "select name from norm_prg"))
#comp_count=($(sqlite3 mainsb "select name from comp_prg"))
cus_count=($(sqlite3 mainsb "select name from cus_prg"))
#mapfile -t ncc <<< "$norm_count"
#mapfile -t ccc <<< "$comp_count"
mapfile -t cucc <<< "$cus_count"
}
GetCount
function net()
{
if pe "git"; then
echo
else
echo_error "you don't have git, first you should install git ..."
return 0;
fi
git clone "$REPO" -b master -q
file=$(ls PDLP)
mapfile -t files <<< "$file"
for ((a = 0; a < ${#files[@]}; a++))
do
patch_adder ${files[$a]}
done
rm -rf PDLP
}
function PreInstall()
{
GetAll $1;
readarray -d " " -t tga <<< "$1"
len=${#tga[@]}
end_item=${tga[$((len - 1))]}
len_end_item=${#end_item}
tga[$(( len - 1 ))]=${end_item:0:$((len_end_item - 1))};
for ((a = 0; a < ${#tga[@]}; a++))
do
realname=$(sqlite3 mainsb "select name from cus_prg where filename='${tga[$a]}.pdl';")
echo $realname
custom $realname;
done
custom $2 "2"
}
function GetAll()
{
readarray -d " " -t tg <<< "$1"
len=${#tg[@]}
end_item=${tg[$((len - 1))]}
len_end_item=${#end_item}
tg[$(( len - 1 ))]=${end_item:0:$((len_end_item - 1))};
for ((as = 0; as < $len; as++))
do
Cneto ${tg[$as]}
done
}
function Cneto() {
#dsa=$(curl -s https://raw.githubusercontent.com/$API_REPO/beta_pdlp/$1.pdl) > $1.pdl;
dsa=$(curl -s -H 'Cache-Control: no-cache, no-store' https://raw.githubusercontent.com/$API_REPO/master/$1.pdl);
echo $dsa > $1.pdl
if [[ $dsa =~ "404" ]]; then
echo_danger "I can't find your patch file !";
rm $1.pdl
return 1;
fi
patch_adder "$1.pdl";
rm $1.pdl
}
function LocalInstall(){
Cneto $1;
custom $1;
}
function menu_install()
{
work=false;
data_name=($(sqlite3 mainsb "select name from cus_prg"))
mapfile -t dnc <<< "$data_name"
for ((o = 0; o < ${#dnc[@]}; o++))
do
if [[ ${dnc[$o]} == $1 ]]; then
work=true
break
fi
done
if [[ $work == false ]]; then
Cneto $1;
fi;
custom $1;
}
function choos_item_cust()
{
cust_names=($(sqlite3 mainsb "select name from cus_prg"))
mapfile -t arr3 <<< "$cust_names"
echo "$1"
}
function custom_menu()
{
echo_label "\nyou have these options";
echo ""
custs=()
cust_names=($(sqlite3 mainsb "select name from cus_prg"))
desc_list=($(sqlite3 mainsb "select description from cus_prg"))
mapfile -t arr3 <<< "$cust_names"
mapfile -t arr4 <<< "$desc_list"
echo_secondary "----------------------------\n"
for ((i3 = 0; i3 < ${#arr3[@]}; i3++))
do
echo_secondary "$((i3 + 1)) - ${arr3[$i3]}\n"
if [[ $DESC == "on" ]]; then
echo_info "\n${arr4[$i3]}\n";
fi
echo_secondary "----------------------------\n"
custs+=(${arr3[$i3]})
done
echo ""
read -p "Package Name: " pck_name
case $pck_name in
''|*[!0-9]*)
echo_error "not a number"
;;
*)
num=$((pck_name - 1))
custom ${custs[num]}
;;
esac
}
function custome_menu_2()
{
echo -ne "\n"
read -p "Enter your patch name: " pfn
menu_install $pfn;
}
function prg_list()
{
data_name=($(sqlite3 mainsb "select name from cus_prg"))
mapfile -t prg_names <<< "$data_name"
for ((a = 0; a < ${#prg_names[@]}; a++))
{
echo "$((a + 1)) - ${prg_names[$a]}"
}
if [[ $SHOW == "all" ]]; then
data_name=($(sqlite3 mainsb "select name from norm_prg"))
mapfile -t norm_names <<< "$data_name"
for ((b = 0; b < ${#norm_names[@]}; b++))
{
echo "$((a + 1)) - ${norm_names[$b]}"
a=$a+1
}
data_name=($(sqlite3 mainsb "select name from comp_prg"))
mapfile -t comp_names <<< "$data_name"
for ((c = 0; c < ${#comp_names[@]}; c++))
{
echo "$((a + 1)) - ${comp_names[$c]}"
a=$a+1
}
echo
fi
echo "Total: $((a))"
}
function cus_remove()
{
Find $1
res=$?
if [[ $res -eq 1 ]]; then
sqlite3 mainsb "delete from cus_prg where name = '$1'"
echo "[+] Package $1 is remove from custome packages"
else
echo "I can't find your package !"
fi
}
#function main_menu()
#{
# echo ""
# echo_primary "1. Normal installation (${#ncc[@]})"
# echo_primary "2. Compilers (${#ccc[@]})"
# echo_primary "3. Custom list (${#cucc[@]})"
#}
if [ -z "$*" ]; then
# while [ true ]
# do
# GetCount
# main_menu
# read -p ": " selc
# if [[ $selc == "h" ]]; then
# help;
# elif [[ $selc == "1" ]]; then
# norm_inst;
# elif [[ $selc == "2" ]]; then
# comp_inst;
# elif [[ $selc == "3" ]]; then
# #custom_menu
# custome_menu_2
# elif [[ $selc == "list 1" ]] || [[ $selc == "l 1" ]]; then
# echo_primary "\n-- Normal installation packages --"
# data=($(sqlite3 mainsb 'select name from norm_prg'))
# mapfile -t arr2 <<< "$data"
# for ((i4 = 0; i4 < ${#arr2[@]}; i4++))
# do
# echo_secondary "[+] Package ${arr2[$i4]}\n"
# done
# elif [[ $selc == "list 2" ]] || [[ $selc == "l 2" ]]; then
# echo_primary "\n-- Compilers installation packages --"
# data2=($(sqlite3 mainsb 'select name from comp_prg'))
# mapfile -t arr <<< "$data2"
# for ((i2 = 0; i2 < ${#arr[@]}; i2++))
# do
# echo_secondary "[+] Package ${arr[$i2]}\n"
# done
# elif [[ $selc == "l" ]]; then
# prg_list;
# elif [[ $selc == "exit" ]] || [[ $selc == "q" ]]; then
# break
# elif [[ $selc == "version" ]]; then
# echo $VERSION
# elif [[ $selc == "os" ]]; then
# echo $OS
# else
# echo "Please enter a valid option."
# fi
# done
help;
#elif [[ $MENU == "0" ]] || [ $1 == "-m" ]; then
# options=("1. Normal installation (${#ncc[@]})" "2. Compilers (${#ccc[@]})" "3. Custom list (${#cucc[@]})")
# case `select_opt "${options[@]}"` in
# 0) norm_inst;;
# 1) comp_inst;;
# 2) custom_menu;;
# esac
elif [ $1 == "--help" ] || [ $1 == "-h" ]; then
help
elif [ $1 == "-p" ]; then
patch_adder $2
elif [ $1 == "-u" ] || [ $1 == "--update" ]; then
net
elif [ $1 == "-n" ]; then
norm_inst
elif [ $1 == "-c" ]; then
comp_inst
elif [ $1 == "-i" ]; then
custom $2
elif [ $1 == "-v" ]; then
echo "v$VERSION";
elif [ $1 == "-l" ]; then
prg_list
elif [ $1 == "-d" ]; then
cus_remove $2
elif [ $1 == "-r" ]; then
echo $REPO;
elif [ $1 == "make" ]; then
makepatch $2
elif [ $1 == "install" ]; then
LocalInstall $2
elif [ $1 == "remove" ]; then
cus_remove $2;
elif [ $1 == "help" ]; then
help_information $2
elif [ $1 == "search" ]; then
Search $2;
elif [ $1 == "uninstall" ]; then
Uninstall $2;
elif [ $1 == "--version" ] || [ $1 == "-v" ]; then
echo $VERSION;
else
echo_danger "This command is not found !, try ./main --help"
fi