-
Notifications
You must be signed in to change notification settings - Fork 0
/
debinstall
executable file
·3412 lines (3269 loc) · 315 KB
/
debinstall
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
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/bash
# Copyright 2014-2022 George Savvidis
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
Version=3.5.1
# Defining colors and bold letters
lightgreen='\e[1;32m'
lightred='\e[1;31m'
red='\e[0;31m'
lightblue='\e[1;34m'
NC='\e[0m'
bold=`tput bold`
normal=`tput sgr0`
# Options, help, database update and error messages
for i in "$@"; do
if [[ "$i" =~ ^-([huqQswpPv]*)h([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--help$ ]]; then
help=set
fi
if [[ "$i" =~ ^-([huqQswpPv]*)u([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--update$ ]]; then
update=set
fi
if [[ "$i" =~ ^-([huqQswpPv]*)i([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--install$ ]]; then
install=set
fi
if [[ "$i" =~ ^-([huqQswpPv]*)q([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--quiet$ ]]; then
quiet=set
fi
if [[ "$i" =~ ^-([huqQswpPv]*)Q([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--Quiet$ ]]; then
Quiet=set
fi
if [[ "$i" =~ ^-([huqQswpPv]*)s([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--pseudo$ ]]; then
pseudo=set
fi
if [[ "$i" =~ ^-([huqQswpPv]*)w([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--wipeout$ ]]; then
wipeout=set
fi
if [[ "$i" =~ ^-([huqQswpPv]*)p([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--pkgbuild$ ]]; then
pkgbuild=set
fi
if [[ "$i" =~ ^-([huqQswpPv]*)P([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--Pkgbuild$ ]]; then
Pkgbuild=set
fi
if [[ "$i" =~ ^-([huqQswpPv]*)v([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--version$ ]]; then
version=set
fi
done
if [[ $pseudo == set ]] && [[ ! -e /var/lib/pacman/sync/multilib.db ]] && [[ ! -e /var/lib/pacman/sync/multilib-testing.db ]]; then
echo -e "${red}Error: You are either running non-x86_64 Arch Linux, or you haven't enabled multilib repository. If you are running x86_64 Arch Linux, you must enable a multilib repository and then synchronize pacman database${NC}"; exit 1
fi
if [[ $help == set ]]; then
echo -e "Syntax: debtap [options] package_filename\n\nOptions:\n\n -h --help Print this help message\n -u --update Update debtap database\n -i --install Install with pacman\n -q --quiet Bypass all questions, except for editing metadata file(s)\n -Q --Quiet Bypass all questions (not recommended)\n -s --pseudo Create a pseudo-64-bit package from a 32-bit .deb package\n -w --wipeout Wipeout versions from all dependencies, conflicts etc.\n -p --pkgbuild Additionally generate a PKGBUILD file\n -P --Pkgbuild Generate a PKGBUILD file only\n -v --version Print version"; exit 0
elif [[ $version == set ]]; then
echo -e "$Version"; exit 0
elif [[ $update == set ]]; then
if [[ $EUID != 0 ]]; then
echo -e "${red}Error: You must run this command with root privileges${NC}"; exit 1
else
mkdir -p /var/cache/debtap 2> /dev/null
chmod 755 /var/cache/debtap
echo -e "${lightgreen}==>${NC} ${bold}Synchronizing pkgfile database...${normal}"
pkgfile -u
if [[ $(echo $?) != 0 ]]; then
echo -e "${red}Synchronization failed. Exiting...${NC}"; exit 1
else
echo -e "${lightgreen}==>${NC} ${bold}Synchronizing debtap database...${normal}"
if [[ "$(uname -m)" == "i686" ]] || [[ "$(uname -m)" == "x86_64" ]]; then
_arch=amd64
elif [[ "$(uname -m)" == "armv7l" ]] || [[ "$(uname -m)" == "armv7h" ]]; then
_arch=armhf
elif [[ "$(uname -m)" == "aarch64" ]]; then
_arch=arm64
fi
ubuntu_latest_stable_version=`curl -k -s https://packages.ubuntu.com | grep option | gawk -F '=' '{print $2}' | gawk '{print $1}' | grep -v option | tac | sed -n 3'{p;q;}' | sed s'/\("\|-updated\|-backports\)//g'`
curl -k -C - -f http://ftp.debian.org/debian/dists/sid/main/Contents-$_arch.gz > /var/cache/debtap/debian-main-packages-files.gz
gzip -df /var/cache/debtap/debian-main-packages-files.gz
curl -k -C - -f http://ftp.debian.org/debian/dists/sid/non-free/Contents-$_arch.gz > /var/cache/debtap/debian-non-free-packages-files.gz
gzip -df /var/cache/debtap/debian-non-free-packages-files.gz
curl -k -C - -f http://ftp.debian.org/debian/dists/sid/contrib/Contents-$_arch.gz > /var/cache/debtap/debian-contrib-packages-files.gz
gzip -df /var/cache/debtap/debian-contrib-packages-files.gz
if [[ $_arch == amd64 ]]; then
curl -k -C - -f http://archive.ubuntu.com/ubuntu/dists/$ubuntu_latest_stable_version/Contents-$_arch.gz > /var/cache/debtap/ubuntu-packages-files.gz
else
curl -k -C - -f http://ports.ubuntu.com/ubuntu-ports/dists/$ubuntu_latest_stable_version/Contents-$_arch.gz > /var/cache/debtap/ubuntu-packages-files.gz
fi
gzip -df /var/cache/debtap/ubuntu-packages-files.gz
if [[ $(echo $?) != 0 ]]; then
echo -e "${red}Synchronization failed. Exiting...${NC}"; exit 1
else
echo -e "${lightgreen}==>${NC} ${bold}Downloading latest virtual packages list...${normal}"
curl -k -L https://github.com/helixarch/virtual-packages-list-generator/archive/master.tar.gz > /var/cache/debtap/master.tar.gz
tar xfz /var/cache/debtap/master.tar.gz -C /var/cache/debtap
mv /var/cache/debtap/virtual-packages-list-generator-master/virtual-packages /var/cache/debtap
rm -rf /var/cache/debtap/master.tar.gz /var/cache/debtap/virtual-packages-list-generator-master
if [[ $(echo $?) != 0 ]]; then
echo -e "${red}Downloading failed. Exiting...${NC}"; exit 1
else
echo -e "${lightgreen}==>${NC} ${bold}Downloading latest AUR packages list...${normal}"
curl -k -C - -f https://aur.archlinux.org/packages.gz > /var/cache/debtap/aur-packages.gz
gzip -df /var/cache/debtap/aur-packages.gz
if [[ $(echo $?) != 0 ]]; then
echo -e "${red}Downloading failed. Exiting...${NC}"; exit 1
else
echo -e "${lightgreen}==>${NC} ${bold}Generating base group packages list...${normal}"
rm -rf /var/cache/debtap/base-packages
for i in $(pacman -Qi base 2> /dev/null | grep ^Depends | cut -d: -f2); do echo "$i" >> /var/cache/debtap/base-packages; done; echo >> /var/cache/debtap/base-packages
chmod 644 /var/cache/debtap/*
echo -e "${lightgreen}==>${NC} ${bold}All steps successfully completed!${normal}"; exit 0
fi
fi
fi
fi
fi
elif [[ "${@: -1}" == "debtap" ]] || [[ "${@: -1}" =~ /debtap$ ]] || [[ "${@: -1}" =~ ^-([qQswpP]+)$ ]] || [[ "${@: -1}" =~ ^--([quiet|Quiet|pseudo|wipeout|pkgbuild|Pkgbuild]){1,}$ ]]; then
echo -e "${red}Error: You haven't specified a deb package${NC}\nSyntax: debtap [options] package_filename\n\nOptions:\n\n -h --help Print this help message\n -u --update Update debtap database\n -i --install Install with pacman\n -q --quiet Bypass all questions, except for editing metadata file(s)\n -Q --Quiet Bypass all questions (not recommended)\n -s --pseudo Create a pseudo-64-bit package from a 32-bit .deb package\n -w --wipeout Wipeout versions from all dependencies, conflicts etc.\n -p --pkgbuild Additionally generate a PKGBUILD file\n -P --Pkgbuild Generate a PKGBUILD file only\n -v --version Print version"; exit 1
elif [[ "${@: -1}" =~ ^(-)+(.)*$ ]] || [[ $(ls "${@: -1}" &> /dev/null; echo $?) != 0 ]]; then
echo -e "${red}Error: No such file or directory or invalid option${NC}"; exit 1
elif [[ $(file -S -b "${@: -1}" | grep -q "Debian binary package"; echo $?) != 0 ]]; then
echo -e "${red}Error: You haven't specified a valid deb package${NC}"; exit 1
fi
if [[ ! $(ls /var/cache/pkgfile/*.files 2> /dev/null) ]] || [[ ! $(ls /var/cache/debtap/*-packages-files 2> /dev/null) ]] || [[ ! -e /var/cache/debtap/base-packages ]] || [[ ! -e /var/cache/debtap/aur-packages ]] || [[ ! -e /var/cache/debtap/virtual-packages ]]; then
if [[ $pseudo != set ]]; then
echo -e "${red}Error: You must run at least once \"debtap -u\" with root privileges (preferably recently), before running this script${NC}"; exit 1
else
echo -e "${red}Error: You must enable a multilib repository, synchronize pacman database and then run at least once \"debtap -u\" with root privileges (preferably recently), before running this script${NC}"; exit 1
fi
fi
tar_extract_cmd() {
local file="${@: -1}"
local flags
case "$file" in
*.tar) flags="" ;;
*.tar.gz) flags="z" ;;
*.tar.xz) flags="J" ;;
*.tar.bz2) flags="j" ;;
*.tar.lzma) flags="J" ;;
*.tar.zst) flags="I unzstd"
if ! which unzstd >/dev/null; then
echo -e "${red}Error: extracting $file requires unzstd${NC}" >&2
return 1
fi
;;
*)
echo -e "${red}Error: Don't know how to extract '$file'${NC}" >&2
return 1
;;
esac
echo "tar -x$flags"
}
# Defining package with full path & defining and creating working directory
package_with_full_path="`readlink -f "${@: -1}"`"
working_directory="`pwd`/`basename "${@: -1}" | tr '[:upper:]' '[:lower:]' | sed s'/\.deb$//'`-working-directory"
rm -rf "$working_directory" 2> /dev/null
mkdir "$working_directory" 2> /dev/null
if [[ $(echo $?) != 0 ]]; then
echo -e "${red}Error: Cannot create working directory, permission denied. Exiting...${NC}"
exit 1
fi
cd "$working_directory"
# Extracting package data and metadata in working directory (also checking package architecture, if you are running the pseudo option)
echo -e "${lightgreen}==>${NC} ${bold}Extracting package data...${normal}"
control_tar_check=$(ar t "$package_with_full_path" | grep -m 1 "control\.tar")
control_extract=$(tar_extract_cmd "$control_tar_check")
if [ $? != 0 ]; then
rm -rf "$working_directory"
exit 1
fi
ar p "$package_with_full_path" "$control_tar_check" | $control_extract
if [[ $pseudo == set ]] && [[ $(grep ^Architecture: control | grep -q i386; echo $?) != 0 ]]; then
echo -e "${red}Error: Invalid package architecture. Removing extracted package data and exiting...${NC}"
rm -rf "$working_directory"
exit 1
fi
rm -rf $(ls * | grep -v 'control\|preinst\|postinst\|prerm\|postrm\|conffiles')
data_tar_check=$(ar t "$package_with_full_path" | grep -m 1 "data\.tar")
data_extract=$(tar_extract_cmd "$data_tar_check")
if [ $? != 0 ]; then
rm -rf "$working_directory"
exit 1
fi
ar p "$package_with_full_path" "$data_tar_check" | $data_extract
# Fixing possible differences in filesystem hierarchy of the extracted package data, so that it matches Arch Linux filesystem hierarchy
echo -e "${lightgreen}==>${NC} ${bold}Fixing possible directories structure differencies...${normal}"
if [[ $pkgbuild == set ]] || [[ $Pkgbuild == set ]]; then
if [[ $(find ./ -iname '*license*' | wc -l) != 0 ]]; then
echo "install -D -m644 \"$(find ./ -iname '*license*' | sort | tail -1 | sed s'/^\.\///')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
fi
if [[ $(find ./ -iname '*copyright*' | wc -l) != 0 ]]; then
if [[ $(find ./ -iname '*license*' | wc -l) != 0 ]]; then
echo "install -D -m644 \"$(find ./ -iname '*copyright*' | sort | tail -1 | sed s'/^\.\///')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/COPYRIGHT\"" >> pkgbuildinstallations1
else
echo "install -D -m644 \"$(find ./ -iname '*copyright*' | sort | tail -1 | sed s'/^\.\///')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
fi
fi
if [[ $(find ./ -iname '*eula*' | wc -l) != 0 ]]; then
if [[ $(find ./ -iname '*license*' | wc -l) != 0 ]] || [[ $(find ./ -iname '*copyright*' | wc -l) != 0 ]]; then
echo "install -D -m644 \"$(find ./ -iname '*eula*' | sort | tail -1 | sed s'/^\.\///')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/EULA\"" >> pkgbuildinstallations1
else
echo "install -D -m644 \"$(find ./ -iname '*eula*' | sort | tail -1 | sed s'/^\.\///')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
fi
fi
if [[ -e usr/games ]]; then
echo 'mkdir usr/bin 2> /dev/null; mv usr/games/* usr/bin; rm -rf usr/games' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/usr\/games\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e bin ]]; then
echo 'mkdir -p usr/bin 2> /dev/null; mv bin/* usr/bin; rm -rf bin' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/bin\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e sbin ]]; then
echo 'mkdir -p usr/bin 2> /dev/null; mv sbin/* usr/bin; rm -rf sbin' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/sbin\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e usr/sbin ]]; then
echo 'mkdir usr/bin 2> /dev/null; mv usr/sbin/* usr/bin; rm -rf usr/sbin' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/usr\/sbin\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e usr/local/games ]]; then
echo 'mkdir usr/bin 2> /dev/null; mv usr/local/games/* usr/bin; rm -rf usr/local/games' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/usr\/local\/games\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e usr/local/bin ]]; then
echo 'mkdir usr/bin 2> /dev/null; mv usr/local/bin/* usr/bin; rm -rf usr/local/bin' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/usr\/local\/bin\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e usr/local/sbin ]]; then
echo 'mkdir usr/bin 2> /dev/null; mv usr/local/sbin/* usr/bin; rm -rf usr/local/sbin' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/usr\/local\/sbin\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ $pseudo != set ]]; then
if [[ -e lib ]]; then
echo 'mkdir -p usr/lib 2> /dev/null; mv lib/* usr/lib; rm -rf lib' >> pkgbuildinstallations1
fi
if [[ -e lib32 ]]; then
if [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
echo 'mkdir -p usr/lib 2> /dev/null; mv lib32/* usr/lib; rm -rf lib32' >> pkgbuildinstallations32
else
echo 'mkdir -p usr/lib32 2> /dev/null; mv lib32/* usr/lib32; rm -rf lib32' >> pkgbuildinstallations64
fi
fi
if [[ -e lib64 ]]; then
echo 'mkdir -p usr/lib 2> /dev/null; mv lib64/* usr/lib; rm -rf lib64' >> pkgbuildinstallations64
fi
if [[ -e usr/lib32 ]] && [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
echo 'mkdir usr/lib 2> /dev/null; mv usr/lib32/* usr/lib; rm -rf usr/lib32' >> pkgbuildinstallations32
fi
if [[ -e usr/lib64 ]]; then
echo 'mkdir usr/lib 2> /dev/null; mv usr/lib64/* usr/lib; rm -rf usr/lib64' >> pkgbuildinstallations64
fi
if [[ -e usr/local/lib32 ]] && [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
echo 'mkdir usr/local/lib 2> /dev/null; mv usr/local/lib32/* usr/local/lib; rm -rf usr/local/lib32' >> pkgbuildinstallations32
fi
if [[ -e usr/local/lib64 ]]; then
echo 'mkdir usr/local/lib 2> /dev/null; mv usr/local/lib64/* usr/local/lib; rm -rf usr/local/lib64' >> pkgbuildinstallations64
fi
else
if [[ -e lib ]]; then
tac pkgbuildinstallations32 2> /dev/null >> pkgbuildinstallations32-1; echo 'mkdir -p usr/lib 2> /dev/null; mv lib/* usr/lib; rm -rf lib' >> pkgbuildinstallations32-1; tac pkgbuildinstallations32-1 > pkgbuildinstallations32; rm -rf pkgbuildinstallations32-1
echo 'mkdir -p usr/lib32 2> /dev/null; mv lib/* usr/lib32; rm -rf lib' >> pkgbuildinstallations64
fi
if [[ -e lib32 ]]; then
echo 'mkdir -p usr/lib32 2> /dev/null; mv lib32/* usr/lib32; rm -rf lib32' >> pkgbuildinstallations64
fi
if [[ -e usr/lib ]]; then
echo 'mkdir usr/lib32 2> /dev/null; mv usr/lib/* usr/lib32; rm -rf usr/lib' >> pkgbuildinstallations64
fi
if [[ -e usr/local/lib ]]; then
echo 'mkdir usr/local/lib32 2> /dev/null; mv usr/local/lib/* usr/local/lib32; rm -rf usr/local/lib' >> pkgbuildinstallations64
fi
fi
fi
if [[ -e usr/games ]]; then
mkdir usr/bin 2> /dev/null; mv usr/games/* usr/bin; rm -rf usr/games
fi
if [[ -e bin ]]; then
mkdir -p usr/bin 2> /dev/null; mv bin/* usr/bin; rm -rf bin
fi
if [[ -e sbin ]]; then
mkdir -p usr/bin 2> /dev/null; mv sbin/* usr/bin; rm -rf sbin
fi
if [[ -e usr/sbin ]]; then
mkdir usr/bin 2> /dev/null; mv usr/sbin/* usr/bin; rm -rf usr/sbin
fi
if [[ -e usr/local/games ]]; then
mkdir usr/bin 2> /dev/null; mv usr/local/games/* usr/bin; rm -rf usr/local/games
fi
if [[ -e usr/local/bin ]]; then
mkdir usr/bin 2> /dev/null; mv usr/local/bin/* usr/bin; rm -rf usr/local/bin
fi
if [[ -e usr/local/sbin ]]; then
mkdir usr/bin 2> /dev/null; mv usr/local/sbin/* usr/bin; rm -rf usr/local/sbin
fi
if [[ -e usr/share/applications ]]; then
ls usr/share/applications/*.desktop | while read line; do
sed -i -e s'/^Exec=\/bin\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/sbin\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/usr\/sbin\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/usr\/games\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/usr\/local\/bin\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/usr\/local\/sbin\//Exec=\/usr\/bin\//g' -e s'/^Exec=\/usr\/local\/games\//Exec=\/usr\/bin\//g' "$line" 2> /dev/null
done
fi
if [[ $pseudo != set ]]; then
if [[ -e lib ]]; then
mkdir -p usr/lib 2> /dev/null; mv lib/* usr/lib; rm -rf lib
fi
if [[ -e lib32 ]]; then
if [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
mkdir -p usr/lib 2> /dev/null; mv lib32/* usr/lib; rm -rf lib32
else
mkdir -p usr/lib32 2> /dev/null; mv lib32/* usr/lib32; rm -rf lib32
fi
fi
if [[ -e lib64 ]]; then
mkdir -p usr/lib 2> /dev/null; mv lib64/* usr/lib; rm -rf lib64
fi
if [[ -e usr/lib32 ]] && [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
mkdir usr/lib 2> /dev/null; mv usr/lib32/* usr/lib; rm -rf usr/lib32
fi
if [[ -e usr/lib64 ]]; then
mkdir usr/lib 2> /dev/null; mv usr/lib64/* usr/lib; rm -rf usr/lib64
fi
if [[ -e usr/local/lib32 ]] && [[ $(grep -i ^Architecture: control | grep -q i386; echo $?) == 0 ]]; then
mkdir usr/local/lib 2> /dev/null; mv usr/local/lib32/* usr/local/lib; rm -rf usr/local/lib32
fi
if [[ -e usr/local/lib64 ]]; then
mkdir usr/local/lib 2> /dev/null; mv usr/local/lib64/* usr/local/lib; rm -rf usr/local/lib64
fi
else
if [[ -e lib ]]; then
mkdir -p usr/lib32 2> /dev/null; mv lib/* usr/lib32; rm -rf lib
fi
if [[ -e lib32 ]]; then
mkdir -p usr/lib32 2> /dev/null; mv lib32/* usr/lib32; rm -rf lib32
fi
if [[ -e usr/lib ]]; then
mkdir usr/lib32 2> /dev/null; mv usr/lib/* usr/lib32; rm -rf usr/lib
fi
if [[ -e usr/local/lib ]]; then
mkdir usr/local/lib32 2> /dev/null; mv usr/local/lib/* usr/local/lib32; rm -rf usr/local/lib
fi
fi
if [[ $pkgbuild == set ]] || [[ $Pkgbuild == set ]]; then
if [[ -e usr/local ]] && [[ ! $(ls -A usr/local 2> /dev/null) ]]; then
echo 'rm -rf usr/local' >> pkgbuildinstallations2
fi
fi
if [[ -e usr/local ]] && [[ ! $(ls -A usr/local 2> /dev/null) ]]; then
rm -rf usr/local
fi
# Generating .PKGINFO file
echo -e "${lightgreen}==>${NC} ${bold}Generating .PKGINFO file...${normal}"
# Generating pkgname field
if [[ $pseudo == set ]] && [[ $(ls -A usr/lib32 2> /dev/null) ]] && [[ ! $(ls -A usr/bin 2> /dev/null) ]]; then
for i in {git,bzr,darcs,hg}; do
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-$i | sed s"/-$i-$i$/-$i/" | sed s'/--/-/g' > .PKGINFO
fi
done
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q svn; echo $?) == 0 ]]; then
echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-svn | sed s'/-svn-svn$/-svn/' | sed s'/--/-/g' > .PKGINFO
fi
for i in {cvs,CVS}; do
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-cvs | sed s'/-cvs-cvs$/-cvs/' | sed s'/--/-/g' > .PKGINFO
fi
done
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`" | sed s'/--/-/g' > .PKGINFO
fi
else
for i in {git,bzr,darcs,hg}; do
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-$i | sed s"/-$i-$i$/-$i/" | sed s'/--/-/g' > .PKGINFO
fi
done
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q svn; echo $?) == 0 ]]; then
echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-svn | sed s'/-svn-svn$/-svn/' | sed s'/--/-/g' > .PKGINFO
fi
for i in {cvs,CVS}; do
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-cvs | sed s'/-cvs-cvs$/-cvs/' | sed s'/--/-/g' > .PKGINFO
fi
done
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`" | sed s'/demo$/-demo/' | sed s'/trial$/-trial/' | sed s'/--/-/g' > .PKGINFO
fi
fi
# Generating pkgver field
version=$(grep -i ^Version: control | gawk '{print $2}' | sed -e s'/[+~]/-/g' -e s'/[-._]alpha/alpha/' -e s'/[-._]beta/beta/' -e s'/[-._]pre/pre/' -e s'/[-._]rc/rc/' -e s'/[-._]dfsg/dfsg/' | gawk -F 'dev' '{print $1}' | sed -e s'/-\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+\.[0-9]\+//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]*[a-z]*[0-9]*//g' -e s'/--/-/g' -e s'/\.\././g' | sed s'/\.$//')
for i in {git,bzr,darcs,hg}; do
if [[ $(echo $version | grep -q $i; echo $?) == 0 ]]; then
echo "pkgver = `echo $version | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}'`"-1 >> .PKGINFO
fi
done
for i in {svn.r,svnr}; do
if [[ $(echo $version | grep -q $i; echo $?) == 0 ]]; then
echo "pkgver = r`echo $version | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}'`"-1 >> .PKGINFO
fi
done
if [[ $(echo $version | grep -q svn; echo $?) == 0 ]] && [[ $(echo $version | grep -q "svn\.r\|svnr"; echo $?) != 0 ]]; then
echo "pkgver = `echo $version | gawk -F 'svn' '{print $2}' | gawk -F '-' '{print $1}'`"-1 >> .PKGINFO
fi
for i in {cvs,CVS}; do
if [[ $(echo $version | grep -q $i; echo $?) == 0 ]]; then
echo "pkgver = `echo $version | sed -e s"/[-.]$i/ /g" -e s"/$i/ /g" -e s"/-/ /g" | gawk '{print $2}'`"-1 >> .PKGINFO
fi
done
if [[ $(echo $version | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
echo "pkgver = `echo $version | gawk -F '-[0-9]' '{print $1}' | sed s'/-/./'`"-1 >> .PKGINFO
fi
# Generating pkgdesc field
if [[ $(echo `grep -v ":\| \." control` | grep -iq "`grep -i ^Description: control | sed s'/^Description: //i' | sed s'/\.//'`"; echo $?) == 0 ]]; then
description=$(echo $(echo "`grep -v ":\| \." control`") | sed s'/^\s*./\U&\E/g' | sed s'/\(\. \|\! \|\? \)\s*./\U&\E/g')
else
description=$(echo $(echo "`grep -i ^Description: control | sed s'/^Description: //i' | sed 's/.*/\u&/'`" | sed s'/\.//'). `grep -v ":\| \." control` | sed s'/^\s*./\U&\E/g' | sed s'/\(\. \|\! \|\? \)\s*./\U&\E/g' | sed s'/\!\./\!/g' | sed s'/\?\./\?/g')
fi
echo "pkgdesc = $description" >> .PKGINFO
# Generating url field
echo "url = `grep -i ^Homepage: control | gawk '{print $2}'`" | sed s'/\/$//' >> .PKGINFO
# Generating builddate (which is actually packaging date) field
echo "builddate = `date -u "+%s"`" >> .PKGINFO
# Generating packager field
if [[ $quiet == set ]] || [[ $Quiet == set ]]; then
echo "packager = Unknown Packager" >> .PKGINFO
else
source /usr/share/makepkg/util/config.sh
load_makepkg_config
echo -e "\n${lightblue}::${NC} Enter Packager name (can be left blank):"
read -e -i "${PACKAGER}" packager_name
echo "packager = $packager_name" >> .PKGINFO
fi
# Generating arch field
if [[ $pseudo != set ]]; then
echo "arch = `grep -i ^Architecture: control | gawk '{print $2}' | sed -e s'/i386/i686/' -e s'/amd64/x86_64/' -e s'/armhf/armv7h/' -e s'/arm64/aarch64/' -e s'/all/any/'`" >> .PKGINFO
else
echo "arch = x86_64" >> .PKGINFO
fi
# Generating size field
if [[ -e preinst ]]; then
preinst_size=$(ls -l | grep preinst | gawk '{print $5}')
else
preinst_size=0
fi
if [[ -e postinst ]]; then
postinst_size=$(ls -l | grep postinst | gawk '{print $5}')
else
postinst_size=0
fi
if [[ -e prerm ]]; then
prerm_size=$(ls -l | grep prerm | gawk '{print $5}')
else
prerm_size=0
fi
if [[ -e postrm ]]; then
postrm_size=$(ls -l | grep postrm | gawk '{print $5}')
else
postrm_size=0
fi
if [[ -e conffiles ]]; then
conffiles_size=$(ls -l | grep conffiles | gawk '{print $5}')
else
conffiles_size=0
fi
if [[ -e pkgbuildinstallations1 ]]; then
pkgbuildinstallations1_size=$(ls -l | grep pkgbuildinstallations1 | gawk '{print $5}')
else
pkgbuildinstallations1_size=0
fi
if [[ -e pkgbuildinstallations2 ]]; then
pkgbuildinstallations2_size=$(ls -l | grep pkgbuildinstallations2 | gawk '{print $5}')
else
pkgbuildinstallations2_size=0
fi
if [[ -e pkgbuildinstallations32 ]]; then
pkgbuildinstallations32_size=$(ls -l | grep pkgbuildinstallations32 | gawk '{print $5}')
else
pkgbuildinstallations32_size=0
fi
if [[ -e pkgbuildinstallations64 ]]; then
pkgbuildinstallations64_size=$(ls -l | grep pkgbuildinstallations64 | gawk '{print $5}')
else
pkgbuildinstallations64_size=0
fi
echo "size =" $((`du -sb | tr -d " ."` - `ls -l | grep control | gawk '{print $5}'` - $preinst_size - $postinst_size - $prerm_size - $postrm_size - $conffiles_size - $pkgbuildinstallations1_size - $pkgbuildinstallations2_size - $pkgbuildinstallations32_size - $pkgbuildinstallations64_size - `ls -la | grep .PKGINFO | gawk '{print $5}'` - 4096)) >> .PKGINFO
# Generating license field
if [[ $quiet == set ]] || [[ $Quiet == set ]]; then
echo "license = custom" >> .PKGINFO
else
echo -e "\n${lightblue}::${NC} Enter package license (can be left blank, you can enter multiple licenses comma separated):"
read package_license
for i in `echo "$package_license" | sed -e s'/ /__/g' -e s'/,/ /g'`; do
license+=($i)
done
for (( i=0; i<$(echo ${#license[@]}); i=i+1 )); do
license[$i]=$(echo ${license[$i]} | sed s'/__/ /g')
done
printf '%s\n' "${license[@]}" | while read line; do
echo "license = $line" >> .PKGINFO
done
fi
echo -e "\n${lightgreen}***${NC} ${bold}Creation of .PKGINFO file in progress. It may take a few minutes, please wait...${normal}"
# The packages names translator function
packages-names-translator() {
# First method of translating .deb packages names into Arch Linux packages names, more accurate, comparing contents of .deb packages with Arch Linux packages contents
for debian_package_name in $(gawk '{print $1}' `ls | grep initial-check-list`); do
for debian_package_file in `grep "\/$debian_package_name$" /var/cache/debtap/debian-main-packages-files /var/cache/debtap/debian-non-free-packages-files /var/cache/debtap/debian-contrib-packages-files | grep 'bin\|opt\|\.so' | gawk '{print $1}' | sed s'/\// /g' | gawk '{print $NF}'`; do
echo $debian_package_file $(grep "^$debian_package_name$\|^$debian_package_name " `ls | grep initial-check-list` | gawk '{print $2}')
done >> $debian_package_name-tempfile03
done
for i in `ls | grep tempfile03`; do
for j in `gawk '{print $1}' $i`; do
for k in `pkgfile -q $j`; do
echo $k`head -1 $i | gawk '{print $2$3}'`
done
done >> `echo $i | sed s'/tempfile03/tempfile04/'`
done
touch tempfile05
for debian_package_name in $(gawk '{print $1}' `ls | grep initial-check-list`); do
grep -q "^$debian_package_name$" tempfile05 || echo $debian_package_name >> tempfile05
done
for i in $(for j in `cat tempfile05`; do echo $j-tempfile04; done); do
k=`sort $i | uniq -c | gawk '{print $1}' | sort -n | tail -1`
if [[ $(sort $i | uniq -c | gawk '{print $1}' | sort -n | grep "^$k$" | wc -l) -ge 2 ]]; then
for l in `cat $i`; do
for m in $(sort $i | uniq -c | gawk '{print $1,$2}' | sort -n | grep "^$k " | gawk '{print $2}'); do
echo $l | grep "^$m$"
done
done | head -1 >> tempfile06
elif [[ $(sort $i | uniq -c | gawk '{print $1}' | sort -n | grep "^$k$" | wc -l) -eq 1 ]]; then
sort $i | uniq -c | gawk '{print $1,$2}' | sort -n | grep "^$k " | gawk '{print $2}' >> tempfile06
else
echo >> tempfile06
fi
done
cat tempfile06 | sed s'/=/ = /g' | sed s'/>/ > /g' | sed s'/</ < /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' | sed s'/^lib32-\|-multilib$//g' > tempfile07
cat tempfile07 | while read line; do
if [[ $(echo "$line" | wc -w) -eq 0 ]]; then
echo >> final-check-list
elif [[ $(echo "$line" | wc -w) -eq 1 ]] || [[ $(echo "$line" | wc -w) -eq 3 ]]; then
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
elif [[ $(echo "$line" | wc -w) -eq 5 ]]; then
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $4}'` `echo "$line" | gawk '{print $5}'`" >> final-check-list
fi
done
for i in $(eval echo {1..$(cat `ls | grep initial-check-list` | wc -l)}); do
if [[ $(sed -n ""$i"{p;q;}" final-check-list | gawk '{print $1}') == "" ]]; then
echo $(sed -n ""$i"{p;q;}" `ls | grep initial-check-list`) >> untranslated
echo $(sed -n ""$i"{p;q;}" `ls | grep initial-check-list` | gawk '{print $1}') >> untranslated-names-only
elif [[ $(echo " $(echo $(grep ^pkgname .PKGINFO | gawk '{print $3}' | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//'){-svn,-git,-cvs,-bzr,-darcs,-hg,}) " | grep -q " $(sed -n ""$i"{p;q;}" final-check-list | gawk '{print $1}') "; echo $?) == 0 ]]; then
echo $(sed -n ""$i"{p;q;}" `ls | grep initial-check-list` | sed s'/ //') >> missing-files
fi
done
# Second method of translating remaining untranslated .deb packages names into Arch Linux packages names, same as first method, but searches in Ubuntu database for packages contents instead of Debian database
if [[ -e untranslated-names-only ]]; then
for ubuntu_package_name in $(sort -u untranslated-names-only); do
for ubuntu_package_file in `grep "\/$ubuntu_package_name$" /var/cache/debtap/ubuntu-packages-files | grep 'bin\|opt\|\.so' | gawk '{print $1}' | sed s'/\// /g' | gawk '{print $NF}'`; do
echo $ubuntu_package_file $(grep "^$ubuntu_package_name$\|^$ubuntu_package_name " untranslated | gawk '{print $2}')
done >> $ubuntu_package_name-tempfile08
done
for i in `ls | grep tempfile08`; do
for j in `gawk '{print $1}' $i`; do
for k in `pkgfile -q $j`; do
echo $k`head -1 $i | gawk '{print $2$3}'`
done
done >> `echo $i | sed s'/tempfile08/tempfile09/'`
done
touch tempfile10
for ubuntu_package_name in $(sort -u untranslated-names-only); do
grep -q "^$ubuntu_package_name$" tempfile10 || echo $ubuntu_package_name >> tempfile10
done
for i in $(for j in `cat tempfile10`; do echo $j-tempfile09; done); do
k=`sort $i | uniq -c | gawk '{print $1}' | sort -n | tail -1`
if [[ $(sort $i | uniq -c | gawk '{print $1}' | sort -n | grep "^$k$" | wc -l) -ge 2 ]]; then
for l in `cat $i`; do
for m in $(sort $i | uniq -c | gawk '{print $1,$2}' | sort -n | grep "^$k " | gawk '{print $2}'); do
echo $l | grep "^$m$"
done
done | head -1 >> tempfile11
elif [[ $(sort $i | uniq -c | gawk '{print $1}' | sort -n | grep "^$k$" | wc -l) -eq 1 ]]; then
sort $i | uniq -c | gawk '{print $1,$2}' | sort -n | grep "^$k " | gawk '{print $2}' >> tempfile11
else
echo >> tempfile11
fi
done
cat tempfile11 | sed s'/=/ = /g' | sed s'/>/ > /g' | sed s'/</ < /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' | sed s'/^lib32-\|-multilib$//g' > tempfile12
cat tempfile12 | while read line; do
if [[ $(echo "$line" | wc -w) -eq 0 ]]; then
echo >> final-check-list
elif [[ $(echo "$line" | wc -w) -eq 1 ]] || [[ $(echo "$line" | wc -w) -eq 3 ]]; then
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
elif [[ $(echo "$line" | wc -w) -eq 5 ]]; then
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $4}'` `echo "$line" | gawk '{print $5}'`" >> final-check-list
fi
done
for i in $(eval echo {1..$(cat untranslated | wc -l)}); do
if [[ $(tac final-check-list | sed -n ""$i"{p;q;}" | gawk '{print $1}') == "" ]]; then
echo $(tac untranslated | sed -n ""$i"{p;q;}") >> new-untranslated
echo $(tac untranslated | sed -n ""$i"{p;q;}" | gawk '{print $1}') >> new-untranslated-names-only
elif [[ $(echo " $(echo $(grep ^pkgname .PKGINFO | gawk '{print $3}' | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//'){-svn,-git,-cvs,-bzr,-darcs,-hg,}) " | grep -q " $(tac final-check-list | sed -n ""$i"{p;q;}" | gawk '{print $1}') "; echo $?) == 0 ]]; then
echo $(tac untranslated | sed -n ""$i"{p;q;}" | sed s'/ //') >> missing-files
fi
done
rm -rf untranslated untranslated-names-only
fi
# Third method of translating remaining untranslated .deb packages names into Arch Linux packages names, less accurate, comparing .deb packages names with Arch Linux packages names
if [[ -e new-untranslated-names-only ]]; then
for i in $(sort -u new-untranslated-names-only | grep -v python-support); do
j=$(echo "$i" | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//')
pacman -Ssq $(echo "$j" | sed s'/^lib//') | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' > result1
grep -q "^$j$" result1 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" > matches
grep -q "^$(echo "$j" | sed s'/^lib//')$" result1 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' >> matches
if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[a-z]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/\./ /g' | gawk '{print $4}' | wc -c)
o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/-/ /g' | gawk '{print $5}' | wc -c)
p=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | rev)
pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n + $o + 1))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o - 1))} $(($k + $l + $m + $n + $o + 1))); do
grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o))}); do
grep -q "^$(echo $(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 2))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 2))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 2))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 1))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 2))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 4))} $(($k + $l + $m + $n + $o - 2))); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 2))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//3' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 3))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o - 1))} $(($k + $l + $m + $n + $o + 1))); do
grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
done
fi
if [[ ! -e matches ]]; then
for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o))}); do
grep -q "^$(echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//3' | cut -c $r- | rev >> matches
grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//3' | cut -c $r- | rev >> matches
done
fi
if [[ ! -e matches ]]; then
for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
done
fi
if [[ ! -e matches ]]; then
for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 1))}); do
grep -q "^$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev >> matches
grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//3' | cut -c $r- | rev >> matches
done
fi
fi
if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]\+-[0-9]\+\.[0-9]\+-[a-z]\+[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/[a-z]/ /' | gawk '{print $2}' | wc -c)
m=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | wc -c)
n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/\./ /g' | gawk '{print $3}' | wc -c)
o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/-/ /g' | gawk '{print $4}' | wc -c)
p=$(echo "$j" | rev | sed s'/[0-9]/ /g' | sed s'/-/ /' | gawk '{print $2}' | rev)
pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
grep -q "^$(echo $(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 2))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 4))} $(($k + $l + $m + $n + $o - 2))); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 3))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//2' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/[a-z]/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 2))} $(($k + $l + $m + $n + $o))); do
grep -q "^$(echo "$j" | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | cut -c $r- | rev >> matches
grep -q "^$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev >> matches
done
fi
if [[ ! -e matches ]]; then
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
grep -q "^$(echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/-//2' | cut -c $r- | rev >> matches
grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/-//2' | cut -c $r- | rev >> matches
done
fi
if [[ ! -e matches ]]; then
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 3))} $(($k + $l + $m + $n + $o - 1))); do
grep -q "^$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev >> matches
done
fi
if [[ ! -e matches ]]; then
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
grep -q "^$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev >> matches
grep -q "^$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev)$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//2' | cut -c $r- | rev >> matches
done
fi
fi
if [[ ! -e matches ]] && [[ $(echo "$j" | grep -q "^[[:alnum:]]*[a-z]\+[0-9]\+\.[0-9]\+-[a-z]\+-[0-9]\+\.[0-9]\+$"; echo $?) == 0 ]]; then
k=$(echo "$j" | rev | sed s'/\./ /' | gawk '{print $1}' | wc -c)
l=$(echo "$j" | rev | sed -e s'/\./ /' -e s'/-/ /' | gawk '{print $2}' | wc -c)
m=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | wc -c)
n=$(echo "$j" | rev | sed -e s'/-/ /g' -e s'/\./ /g' | gawk '{print $4}' | wc -c)
o=$(echo "$j" | rev | sed -e s'/\./ /g' -e s'/[a-z]/ /g' | gawk '{print $4}' | wc -c)
p=$(echo "$j" | rev | sed s'/-/ /g' | gawk '{print $2}' | rev)
pacman -Ssq $(echo "$j" | sed s'/^lib//' | rev | cut -c $(($k + $l + $m + $n + $o))- | rev) | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//' | sort -u > result2
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n - 1))} {$(($k + $l + $m + $n + 1))..$(($k + $l + $m + $n + $o))}); do
grep -q "^$(echo $(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
grep -q "^$(echo $(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 2))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n - 2))} {$(($k + $l + $m + $n))..$(($k + $l + $m + $n + $o - 1))}); do
grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n - 3))} {$(($k + $l + $m + $n - 1))..$(($k + $l + $m + $n + $o - 2))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m + 1))..$(($k + $l + $m + $n + $o - 1))}); do
grep -q "^$(echo $(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed 's/\.//2' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k - 1))} {$(($k + 1))..$(($k + $l))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//2' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 2))}); do
for r in $(eval echo {$(($k + $l + $m))..$(($k + $l + $m + $n + $o - 2))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' | cut -c $r- | rev)-$p-$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
done
done
fi
if [[ ! -e matches ]]; then
for q in $(eval echo {1..$(($k + $l - 1))}); do
for r in $(eval echo {$(($k + $l + $m - 1))..$(($k + $l + $m + $n + $o - 3))}); do
grep -q "^$(echo $(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches
grep -q "^$(echo $(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev))$" result2 /var/cache/debtap/virtual-packages /var/cache/debtap/aur-packages && echo "$(echo "$j" | sed s'/^lib//' | rev | sed -e 's/\.//1' -e 's/\.//1' -e 's/-//1' | cut -c $r- | rev)-$p$(echo "$j" | rev | sed 's/\.//1' | sed s'/-/ /' | gawk '{print $1}' | cut -c $q- | rev)" >> matches