-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathrperl_installer.sh
executable file
·1853 lines (1625 loc) · 104 KB
/
rperl_installer.sh
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
#!/bin/bash
# Copyright © 2014, 2015, 2016, 2017, 2018, William N. Braswell, Jr.. All Rights Reserved. This work is Free \& Open Source; you can redistribute it and/or modify it under the same terms as Perl 5.24.0.
# RPerl Installer Script (directly copied from LAMP Installer Script)
VERSION='0.470_000'
# IMPORTANT DEV NOTE: do not edit anything in this file without making the exact same changes to LAMP_installer.sh!!!
# IMPORTANT DEV NOTE: do not edit anything in this file without making the exact same changes to LAMP_installer.sh!!!
# IMPORTANT DEV NOTE: do not edit anything in this file without making the exact same changes to LAMP_installer.sh!!!
# PRE-PRE-INSTALL: install wget
# sudo apt-get install wget
# OR
# sudo yum install wget
# PRE-INSTALL: download the latest version of this file and make it executable
# rm ./rperl_installer.sh; wget https://raw.githubusercontent.com/wbraswell/rperl/master/script/rperl_installer.sh; chmod a+x ./rperl_installer.sh
# OR
# rm ./NEED_FILENAME; wget tinyurl.com/NEED_NEW_TINYURL; chmod a+x NEED_NEW_TINYURL
# enable extended pattern matching in case statements
shopt -s extglob
# global variables
USER_INPUT=''
CURRENT_SECTION=0
# command-line arguments
HELP_CHOICE="no" # DEFAULT NO
DEVELOPER_CHOICE="no" # DEFAULT NO
SECTION_CHOICE="__EMPTY__"
MACHINE_CHOICE="__EMPTY__"
OS_CHOICE="__EMPTY__"
PERL_INSTALL_CHOICE="__EMPTY__"
RPERL_INSTALL_CHOICE="__EMPTY__"
# block comment template
: <<'END_COMMENT'
foo bar bat
END_COMMENT
# command-line arguments AKA options
for i in "$@"
do
case $i in
-?|-h|--help)
HELP_CHOICE="yes"
shift
;;
-d=*|--developer=*)
DEVELOPER_CHOICE="${i#*=}"
shift
;;
-s=*|--section=*)
SECTION_CHOICE="${i#*=}"
shift
;;
-m=*|--machine=*)
MACHINE_CHOICE="${i#*=}"
shift
;;
-os=*|--operating-system=*)
OS_CHOICE="${i#*=}"
shift
;;
-pi=*|--perl-install=*)
PERL_INSTALL_CHOICE="${i#*=}"
shift
;;
-ri=*|--rperl-install=*)
RPERL_INSTALL_CHOICE="${i#*=}"
shift
;;
*)
# unknown argument, ignore
;;
esac
done
echo 'Received the following command-line arguments AKA options:'
echo "HELP_CHOICE = ${HELP_CHOICE}"
echo "DEVELOPER_CHOICE = ${DEVELOPER_CHOICE}"
echo "SECTION_CHOICE = ${SECTION_CHOICE}"
echo "MACHINE_CHOICE = ${MACHINE_CHOICE}"
echo "OS_CHOICE = ${OS_CHOICE}"
echo " PERL_INSTALL_CHOICE = ${PERL_INSTALL_CHOICE}"
echo "RPERL_INSTALL_CHOICE = ${RPERL_INSTALL_CHOICE}"
echo
if [ $HELP_CHOICE == 'yes' ]; then
echo 'LAMP Installer Script'
echo 'Usage:'
echo ' LAMP_installer.sh [ARGUMENTS]'
echo
echo 'Arguments:'
echo ' -? ...OR... -h ...OR... --help'
echo ' Print this (relatively) brief help message for command-line usage.'
echo
echo ' -d=[yes|no] ...OR... --developer=[yes|no]'
echo ' Execute commands for developer sections, or not.'
echo
echo ' -s=INTEGER ...OR... --section=INTEGER'
echo ' Execute commands starting at specified section number.'
echo
echo ' -m=[new|existing] ...OR... --machine=[new|existing]'
echo ' Execute commands for new or existing machine.'
echo
echo ' -os=[ubuntu|centos] ...OR... --operating-system=[ubuntu|centos]'
echo ' Execute commands for specified operating system.'
echo
echo ' -pi=[locallib|perlbrew|source|system] ...OR... --perl-install=[locallib|perlbrew|source|system]'
echo ' Execute commands for specified Perl installation option.'
echo
echo ' -ri=[packages|cpanm-single|cpanm-system|cpan-single|cpan-system|github-secure-git|github-public-git|github-public-zip] ...OR...'
echo ' -rperl-install=[packages|cpanm-single|cpanm-system|cpan-single|cpan-system|github-secure-git|github-public-git|github-public-zip]'
echo ' Execute commands for specified RPerl installation option.'
echo
exit
fi
CURRENT_SECTION_COMPLETE () {
echo
echo '[[[ SECTION' $CURRENT_SECTION 'COMPLETE ]]]'
echo
CURRENT_SECTION=$((CURRENT_SECTION+1))
while true; do
read -p "Continue to section $CURRENT_SECTION, yes or no? [yes] " -n 1 PROMPT_INPUT
case $PROMPT_INPUT in
n|N ) echo; echo; exit;;
y|Y ) echo; echo; break;;
# ' ' ) echo;; # NEED FIX: space ' ' should not trigger empty ''
'' ) echo; break;;
* ) echo;;
esac
done
}
SOURCE () { # source (.) with error check & note
echo '$ source' $1
while true; do
read -p 'Run above command, yes or no? [yes] ' -n 1 PROMPT_INPUT
case $PROMPT_INPUT in
n|N ) echo; echo; return;;
y|Y ) echo; break;;
'' ) break;;
* ) echo;;
esac
done
if [ -f "$1" ]; then
source $1
echo '[ NOTE: When This Installer Exits, You Must Then Copy & Re-Run The Above Command, Or Log Out & Log Back In If The File Is ~/.bashrc ]'
else
echo 'Cannot source file ' $1 ' because such file does not exist'
fi
}
CD () { # _C_hange _D_irectory with error check
CD_DIR="${1/#\~/$HOME}" # replace ~/FOO with $HOME/FOO to avoid 'directory not found' error
echo '$ cd' $CD_DIR
while true; do
read -p 'Run above command, yes or no? [yes] ' -n 1 PROMPT_INPUT
case $PROMPT_INPUT in
n|N ) echo; echo; return;;
y|Y ) echo; break;;
'' ) break;;
* ) echo;;
esac
done
if [ -d "$CD_DIR" ]; then
cd $CD_DIR
else
echo 'Cannot change directory to ' $CD_DIR ' because such directory does not exist'
fi
}
C () { # _C_onfirm user action
echo $1
while true; do
read -p 'Did you do it, yes or no? [yes] ' -n 1 PROMPT_INPUT
case $PROMPT_INPUT in
n|N ) echo; echo; echo $1;;
y|Y ) echo; echo; break;;
# ' ' ) echo;; # NEED FIX: space ' ' should not trigger empty ''
'' ) echo; break;;
* ) echo;;
esac
done
}
P () { # _P_rompt user for input
if [[ $1 != '__EMPTY__' ]]; then
USER_INPUT=$1
return
fi
while true; do
read -p "Please type the $2... " USER_INPUT
case $USER_INPUT in
# do not force input to start with lowercase letter or forward slash; do not limit any keyboard characters because of passwords
# [abcdefghijklmnopqrstuvwxyz/]+([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_./]) ) echo; break;;
+([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\~\!\@\#\$\%\^\&\*\(\)\-\_\=\+\[\]\{\}\\\|\/\?\,\.\<\>]) ) echo; break;;
* ) echo "Please type the $2! "; echo;;
esac
done
}
N () { # prompt user for _N_umeric input
if [[ $1 != '__EMPTY__' ]]; then
USER_INPUT=$1
return
fi
while true; do
read -p "Please type the $2... " USER_INPUT
case $USER_INPUT in
[0123456789]+([0123456789.]) ) echo; break;;
* ) echo "Please type the $2! "; echo;;
esac
done
}
D () { # prompt user for input w/ _D_efault value
if [[ $1 != '__EMPTY__' ]]; then
USER_INPUT=$1
return
fi
while true; do
read -p "Please type the $2, or press <ENTER> for $3... " USER_INPUT
case $USER_INPUT in
+([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\~\!\@\#\$\%\^\&\*\(\)\-\_\=\+\[\]\{\}\\\|\/\?\,\.\<\>]) ) echo; break;;
'' ) echo; USER_INPUT=$3; break;;
* ) echo "Please type the $2, or press <ENTER> for $3! "; echo;;
esac
done
}
S () { # _S_udo command
# DEV NOTE: attempting to use S() as a shortcut to B() does not work, adds unnecessary logic to B() and incorrectly strips newline characters from commands
# B sudo $@ # WRONG
# DEV NOTE: using just plain $@ works for commands wrapped all in double-quotes such as redirected echo commands (presumably all stored as a single word in only ${01});
# but $@ does NOT work for normal multi-word commands (not just stored in ${01}), must use $COMMAND to handle both cases
COMMAND=" ${01} ${02} ${03} ${04} ${05} ${06} ${07} ${08} ${09} ${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} "
# echo '$' $@ # WRONG
echo '$' $COMMAND
while true; do
read -p 'Run above command AS ROOT, yes or no? [yes] ' -n 1 PROMPT_INPUT
case $PROMPT_INPUT in
n|N ) echo; echo; return;;
y|Y ) echo; break;;
'' ) break;;
* ) echo;;
esac
done
# sudo bash -c " $@ " # WRONG
sudo bash -c " $COMMAND "
echo
}
B () { # _B_ash command
COMMAND=" ${01} ${02} ${03} ${04} ${05} ${06} ${07} ${08} ${09} ${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} "
echo '$' $COMMAND
while true; do
read -p 'Run above command, yes or no? [yes] ' -n 1 PROMPT_INPUT
case $PROMPT_INPUT in
n|N ) echo; echo; return;;
y|Y ) echo; break;;
'' ) break;;
* ) echo;;
esac
done
bash -c " $COMMAND "
echo
}
VERIFY_OS_CHOICE() {
local OS_REQ="$1"
local CHOICE="$OS_CHOICE"
local GUESS='UNKNOWN'
if [[ -f "/etc/redhat-release" ]]; then
GUESS='centos'
elif [[ -f "/etc/debian_version" ]]; then
GUESS='ubuntu'
fi
if [[ "$GUESS" != "$CHOICE" ]]; then
PROMPT="NOT OK: OS_CHOICE is $CHOICE but I think you are running $GUESS ! Proceed? "
while true; do
read -p "$PROMPT" -n 1 PROMPT_INPUT
case $PROMPT_INPUT in
n|N ) echo; echo; exit 1;;
y|Y ) echo; break;;
* ) echo;;
esac
done
fi
if [[ "$OS_REQ" != "$CHOICE" ]]; then
PROMPT="NOT OK: OS must be $OS_REQ but you chose $OS_CHOICE! Proceed Anyway? "
while true; do
read -p "$PROMPT" -n 1 PROMPT_INPUT
case $PROMPT_INPUT in
n|N ) echo; echo; exit 1;;
y|Y ) echo; break;;
* ) echo;;
esac
done
echo
fi
}
VERIFY_CENTOS() {
VERIFY_OS_CHOICE 'centos'
}
VERIFY_UBUNTU() {
VERIFY_OS_CHOICE 'ubuntu'
}
# do not provide menu prompt if already provided as command-line argument
if [ $SECTION_CHOICE == '__EMPTY__' ]; then
echo "[[[<<< LAMP Installer Script v$VERSION >>>]]]"
echo
echo ' [[[<<< Tested Using Fresh Installs >>>]]]'
echo
echo 'Xubuntu v14.04.2 (Trusty Tahr)'
echo 'Xubuntu v16.04.4 (Xenial Xerus)'
echo 'CentOS v7.4-1708'
echo
echo ' [[[<<< Main Menu >>>]]]'
echo
echo ' <<< PERL & RPERL SECTIONS >>>'
echo '20. [[[ LINUX, INSTALL PERL DEPENDENCIES ]]]'
echo '21. [[[ LINUX, INSTALL PERL & CPANM ]]]'
echo '22. [[[ LINUX, PACKAGE RPERL DEPENDENCIES, DEVELOPERS ONLY ]]]'
echo '23. [[[ LINUX, INSTALL RPERL DEPENDENCIES ]]]'
echo '24. [[[ PERL, INSTALL RPERL ]]]'
echo '25. [[[ RPERL, RUN COMPILER TESTS ]]]'
echo '26. [[[ RPERL, INSTALL RPERL APPS & RUN DEMOS ]]]'
echo
while true; do
read -p 'Please type your chosen main menu section number, or press <ENTER> for 0... ' SECTION_CHOICE
case $SECTION_CHOICE in
[0123456789]|[1234][0123456789]|5[01]|60 ) echo; break;;
'' ) echo; SECTION_CHOICE=0; break;;
* ) echo 'Please choose a section number from the menu!'; echo;;
esac
done
fi
CURRENT_SECTION=$SECTION_CHOICE
# do not provide menu prompt if already provided as command-line argument
if [ $MACHINE_CHOICE == '__EMPTY__' ]; then
echo ' [[[<<< Machine Menu >>>]]]'
echo
echo \ '0. [[[ NEW MACHINE; SERVER; REMOTE CLOUD HOST ]]]'
echo \ '1. [[[ EXISTING MACHINE; CLIENT; LOCAL USER SYSTEM ]]]'
echo
while true; do
read -p 'Please type your machine menu choice number, or press <ENTER> for 0... ' MACHINE_CHOICE
case $MACHINE_CHOICE in
[01] ) echo; break;;
'' ) echo; MACHINE_CHOICE=0; break;;
* ) echo 'Please choose a number from the menu!'; echo;;
esac
done
fi
# do not provide menu prompt if already provided as command-line argument
if [ $OS_CHOICE == '__EMPTY__' ]; then
echo ' [[[<<< OS Menu >>>]]]'
echo
echo \ '0. [[[ UBUNTU ]]]'
echo \ '1. [[[ CENTOS ]]]'
echo \ '9. [[[ OTHER ]]]'
echo
while true; do
read -p 'Please type your OS menu choice number, or press <ENTER> for 0... ' OS_CHOICE
case $OS_CHOICE in
0 ) echo; OS_CHOICE='ubuntu'; break;;
1 ) echo; OS_CHOICE='centos'; break;;
9 ) echo; OS_CHOICE='OTHER'; break;;
'' ) echo; OS_CHOICE='ubuntu'; break;;
* ) echo 'Please choose a number from the menu!'; echo;;
esac
done
fi
if [ $SECTION_CHOICE -le 20 ]; then
echo '20. [[[ LINUX, INSTALL PERL DEPENDENCIES ]]]'
echo
if [ $MACHINE_CHOICE == '0' ] || [ $MACHINE_CHOICE == 'new' ]; then
echo '[ Overview Of Perl Dependencies In This Section ]'
echo '[ CPAN: The Comprehensive Perl Archive Network, Required For Installing Perl Software ]'
echo '[ Perl Debug: Symbols For The Perl Interpreter, Optional For Perl Core & XS & RPerl Debugging ]'
echo '[ Git: Source Code Version Control, Required To Install Latest Development & Unstable Software ]'
echo '[ Make: Program Builder, Required To Build ExtUtils::MakeMaker ]'
echo '[ cURL: Downloader, Required To Install cpanminus & Perlbrew & Perl-Build ]'
echo '[ ExtUtils::MakeMaker: Source Code Builder, Required To Build Many Perl Software Suites ]'
echo
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
VERIFY_UBUNTU
echo '[ Install Perl Debugging Symbols System-Wide ]'
S apt-get install perl-debug
echo '[ Install git ]'
S apt-get install git
echo '[ Install make ]'
S apt-get install make
echo '[ Install cURL ]'
S apt-get install curl
echo '[ Check Install, Confirm No Errors ]'
S apt-get -f install
# OR
elif [[ "$OS_CHOICE" == "centos" ]]; then
VERIFY_CENTOS
echo '[ Install CPAN ]'
S yum install perl-core perl-CPAN
echo '[ Install Perl Debugging Symbols System-Wide ]'
echo '[ NOT CURRENTLY AVAILABLE FOR CENTOS ]'
echo '[ Install git ]'
S yum install git
echo '[ Install make ]'
S yum install make
echo '[ Install cURL ]'
S yum install curl
if [ $DEVELOPER_CHOICE == 'yes' ]; then
echo '[ Check Install, Confirm No Errors; WARNING! MAY TAKE HOURS TO RUN! ]'
S yum check
fi
fi
echo '[ Check cURL Installation ]'
B 'curl -L cpanmin.us > /dev/null'
echo
echo '[ Look For Any Errors In The Output From The curl Command Above ]'
echo '[ WARNING: IF AND ONLY IF The Above curl Command Gives The Error On The Following Line, THEN Execute The echo Command In The Next Step ]'
echo 'curl: (77) error setting certificate verify locations'
echo
C 'Please read the warning above. Seriously.'
echo
B "echo 'cacert=/etc/ssl/certs/ca-certificates.crt' >> ~/.curlrc"
echo '[ Optionally Disable Previous local::lib Or Perlbrew Installations ]'
echo '[ NOTE: You SHOULD Disable Any Previous Perl Installations, Unless You Know What You Are Doing ]'
B mv ~/perl5 ~/perl5.old
echo '[ Install ExtUtils::MakeMaker System-Wide, Check Current System-Wide Version, Must Be v7.04 Or Newer ]'
S 'perl -MExtUtils::MakeMaker\ 999' # system-wide v7.04 or newer required by Inline::C & possibly others
echo '[ Install ExtUtils::MakeMaker System-Wide ]'
echo '[ NOTE: You MUST Have v7.04 Or Newer Installed System-Wide (And Also Single-User) For RPerl ]'
# DEV NOTE: create Perl lib dirs due to CentOS bug, dirs should already exist but do not, checked by CPAN::FirstTime::_can_write_to_libdirs()
echo '[ Ensure Perl Library Directories Exist ]'
S "perl -e 'use Config; use File::Path qw(make_path); foreach my \$dir_key (qw(installprivlib installarchlib installsitelib installsitearch)) { if (not -e \$Config{\$dir_key}) { my \$success = make_path(\$Config{\$dir_key}); if (\$success) { print q{Created directory: }, \$Config{\$dir_key}, qq{\\n}; } else { print q{Error, could not create directory: }, \$Config{\$dir_key}, qq{\\n}, \$!, qq{\\n}; } } else { print q{Directory already exists: }, \$Config{\$dir_key}, qq{\\n}; } }'"
echo '[ Choose "yes" For Automatic Configuration & Also "yes" For Automatic CPAN Mirror Selection ]'
echo '[ Choose "sudo" For Installation Approach If Previous Command Does Not Solve "Warning: You do not have write permission for Perl library directories." ]'
S cpan ExtUtils::MakeMaker
echo '[ Install ExtUtils::MakeMaker System-Wide, Check Updated Version, Must Be v7.04 Or Newer ]'
S 'perl -MExtUtils::MakeMaker\ 999'
echo '[ Check Perl Version To Determine Which Of The Following Sections To Choose ]'
B perl -v
elif [ $MACHINE_CHOICE == '1' ] || [ $MACHINE_CHOICE == 'existing' ]; then
echo "Nothing To Do On Existing Machine!"
fi
CURRENT_SECTION_COMPLETE
fi
# SECTION 21 VARIABLES
#PERL_INSTALL_CHOICE='__EMPTY__' # this is now a global variable for command-line args, see top of file
if [ $SECTION_CHOICE -le 21 ]; then
echo '21. [[[ LINUX, INSTALL PERL & CPANM ]]]'
if [ $MACHINE_CHOICE == '0' ] || [ $MACHINE_CHOICE == 'new' ]; then
if [ $PERL_INSTALL_CHOICE == '__EMPTY__' ]; then
echo 'Please carefully read the following instructions, in order to choose a Perl installation option...'
echo
echo '21a. [[[ LINUX, INSTALL SINGLE-USER PERL LOCAL::LIB & CPANM ]]]'
echo ' [ You SHOULD Use This Instead Of Perlbrew Or Perl From Source Or System Perl In Sections 21b & 21c & 21d, Unless You Have No Choice ]'
echo ' [ This Option Will Contain All Perl Code In Your Home Directory Under The ~/perl5 Subdirectory ]'
echo ' [ This Option May Not Work With Older Versions Of Debian GNU/Linux Which Include A Broken Perl v5.14, Use Perlbrew in Section 21b Instead ]'
echo ' [ This Option Will Not Work With Older Versions Of Perl Which Are Not At Least v5.10 Or Newer, Use Perlbrew in Section 21b Instead ]'
echo
echo '__OR__ '
echo
echo '21b. [[[ LINUX, INSTALL SINGLE-USER PERLBREW & CPANM ]]]'
echo ' [ You SHOULD NOT Use This Instead Of local::lib In Section 21a, Unless You Have No Choice ]'
echo ' [ This Option WILL Work With Older Versions Of Debian GNU/Linux Which Include A Broken Perl v5.14 ]'
echo ' [ This Option WILL Work With Older Versions Of Perl Which Are Not At Least v5.10 Or Newer ]'
echo
echo '__OR__ '
echo
echo '21c. [[[ LINUX, INSTALL SYSTEM-WIDE PERL FROM SOURCE & CPANM ]]]'
echo ' [ You SHOULD NOT Use This Instead Of local::lib In Section 21a, Unless You Have No Choice ]'
echo
echo '__OR__ '
echo
echo '21d. [[[ LINUX, INSTALL SYSTEM-WIDE SYSTEM PERL & CPANM ]]]'
echo '[ You SHOULD NOT Use This Instead Of local::lib In Section 21a, Unless You Have No Choice ]'
echo '[ This Option Will Install Both Perl & cpanminus System-Wide ]'
echo '[ Also, All Future CPAN Distributions Will Install System-Wide In A Hard-To Control Manner ]'
echo
C 'Please read the warnings above. Seriously.'
echo
P $PERL_INSTALL_CHOICE $'letter or word for a Perl installation option:\n[a] locallib\n[b] perlbrew\n[c] source\n[d] system\n'
PERL_INSTALL_CHOICE=$USER_INPUT
fi
if [ $PERL_INSTALL_CHOICE == 'a' ] || [ $PERL_INSTALL_CHOICE == 'locallib' ]; then
echo '21a. [[[ LINUX, INSTALL SINGLE-USER PERL LOCAL::LIB & CPANM ]]]'
echo '[ Install local::lib & CPANM in ~/perl5 ]'
B 'curl -L cpanmin.us | perl - -l $HOME/perl5 App::cpanminus local::lib'
echo '[ Enable local::lib In .bashrc Run Commands Startup File ]'
echo '[ NOTE: Do Not Run The Following Step If You Already Copied Your Own Pre-Existing LAMP University .bashrc File In Section 0 ]'
# DEV NOTE: pre-munged command for comparison
# if [ -d $HOME/perl5/lib/perl5 ]; then
# eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)
# fi
# START HERE: need add following 6 lines to munged echo statement below...
# START HERE: need add following 6 lines to munged echo statement below...
# START HERE: need add following lines to munged echo statement below...
# if ! [[ ":$PERL5LIB:" == *":$HOME/perl5/lib/perl5:"* ]]; then
# export PERL5LIB=$HOME/perl5/lib/perl5:$PERL5LIB
# fi
# if ! [[ ":$PERL5LIB:" == *":$HOME/perl5/lib/perl5/x86_64-linux:"* ]]; then
# export PERL5LIB=$HOME/perl5/lib/perl5/x86_64-linux:$PERL5LIB
# fi
# fi
B echo -e '"# enable local::lib, do NOT mix with Perlbrew\nif [ -d"' '\$HOME/perl5/lib/perl5 ]\; then' '"\n "' "'" eval '$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' "'" '"\nfi\n"' '>> ~/.bashrc'
SOURCE ~/.bashrc
echo '[ Ensure The Following 4 Environmental Variables Now Include ~/perl5: PERL_MM_OPT, PERL_MB_OPT, PERL5LIB, PATH ]'
echo '[ If Not, Please Log Out & Log Back In, Then Return To This Point & Check Again ]'
B 'set | grep perl5'
elif [ $PERL_INSTALL_CHOICE == 'b' ] || [ $PERL_INSTALL_CHOICE == 'perlbrew' ]; then
echo '21b. [[[ LINUX, INSTALL SINGLE-USER PERLBREW & CPANM ]]]'
echo '[ You Should Use Ubuntu Or CentOS Instead Of curl Below, Unless You Are Not In Ubuntu Or CentOS, Or You Have No Choice ]'
echo '[ WARNING: Use Only ONE Of The Following Three Options, EITHER Ubuntu OR CentOS OR curl, But NOT More Than One! ]'
C 'Please read the warning above. Seriously.'
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
VERIFY_UBUNTU
echo '[ Install Perlbrew ]'
S apt-get install perlbrew
echo '[ Check Install, Confirm No Errors ]'
S apt-get -f install
# OR
elif [[ "$OS_CHOICE" == "centos" ]]; then
VERIFY_CENTOS
echo '[ WARNING: Use Only ONE Of The Following Two CentOS Options, EITHER CPAN OR perlbrew_install.sh, But NOT More Than One! ]'
C 'Please read the warning above. Seriously.'
echo '[ CENTOS & CPAN ONLY: Install Perl & CPAN ]'
S yum install perl perl-core perl-CPAN perl-CPAN-Meta
# DEV NOTE: create Perl lib dirs due to CentOS bug, dirs should already exist but do not, checked by CPAN::FirstTime::_can_write_to_libdirs()
echo '[ CENTOS & CPAN ONLY: Ensure Perl Library Directories Exist ]'
S "perl -e 'use Config; use File::Path qw(make_path); foreach my \$dir_key (qw(installprivlib installarchlib installsitelib installsitearch)) { if (not -e \$Config{\$dir_key}) { my \$success = make_path(\$Config{\$dir_key}); if (\$success) { print q{Created directory: }, \$Config{\$dir_key}, qq{\\n}; } else { print q{Error, could not create directory: }, \$Config{\$dir_key}, qq{\\n}, \$!, qq{\\n}; } } else { print q{Directory already exists: }, \$Config{\$dir_key}, qq{\\n}; } }'"
echo '[ CENTOS & CPAN ONLY: Install CPANM ]'
S cpan App::cpanminus
echo '[ CENTOS & CPAN ONLY: Install Perlbrew ]'
S cpanm -v --notest App::perlbrew
# OR
echo '[ CENTOS & perlbrew_install.sh ONLY: Install GCC Compiler & Other Requirements ]'
S yum install gcc bzip2 patch
echo '[ CENTOS & perlbrew_install.sh ONLY: Download perlbrew_install.sh Script ]'
B curl -L https://install.perlbrew.pl -o perlbrew_install.sh
echo '[ CENTOS & perlbrew_install.sh ONLY: Run perlbrew_install.sh Script ]'
B chmod a+x ./perlbrew_install.sh && ./perlbrew_install.sh
if [ $DEVELOPER_CHOICE == 'yes' ]; then
echo '[ Check Install, Confirm No Errors; WARNING! MAY TAKE HOURS TO RUN! ]'
S yum check
fi
fi
# OR
echo '[ CURL ONLY: Install Perlbrew; DO NOT USE IF apt-get OR yum WAS SUCCESSFUL! ]'
S 'curl -L http://install.perlbrew.pl | bash'
echo '[ Configure Perlbrew ]'
B perlbrew init
echo '[ In Texas, The Following Perlbrew Mirror Is Recommended: Arlington, TX #222 http://mirror.uta.edu/CPAN/ ]'
B perlbrew mirror
B 'echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.bashrc'
SOURCE ~/.bashrc
echo '[ Ensure The Following 3 Environmental Variables Now Include ~/perl5: PERLBREW_MANPATH, PERLBREW_PATH, PERLBREW_ROOT ]'
B 'set | grep perl5'
echo '[ Build Perlbrew Perl v5.24.0 ]'
B perlbrew install perl-5.24.0
echo '[ Temporaily Enable Perlbrew Perl v5.24.0 ]'
B perlbrew use perl-5.24.0
echo '[ Permanently Enable Perlbrew Perl v5.24.0 ]'
B perlbrew switch perl-5.24.0
echo '[ Install Perlbrew CPANM ]'
B perlbrew install-cpanm
echo '[ ExtUtils::MakeMaker v7.04 Or Newer Is Required By Inline::C, May Need To Re-Install In Single-User Mode ]'
echo '[ Check Version Of ExtUtils::MakeMaker, Re-Install If Older Than v7.04 ]'
B 'perl -MExtUtils::MakeMaker\ 999'
echo '[ Re-Install ExtUtils::MakeMaker Via CPAN, Because Perlbrew Acts As System-Wide Perl In Single-User Mode ]'
echo '[ NOTE: You MUST Have v7.04 Or Newer Installed System-Wide (And Also Single-User) For RPerl ]'
B cpanm -v --notest ExtUtils::MakeMaker
echo '[ Re-Check Version Of ExtUtils::MakeMaker, Must Be v7.04 Or Newer ]'
B 'perl -MExtUtils::MakeMaker\ 999'
elif [ $PERL_INSTALL_CHOICE == 'c' ] || [ $PERL_INSTALL_CHOICE == 'source' ]; then
echo '21c. [[[ LINUX, INSTALL SYSTEM-WIDE PERL FROM SOURCE & CPANM ]]]'
echo '[ WARNING: Choose ONLY ONE Of The Following Two Methods: Manual Build, Or Tokuhirom Perl-Build ]'
C 'Please read the warning above. Seriously.'
# NEED ANSWER: does this actually work?
echo '[ MANUAL BUILD ONLY: Download Perl Source Code ]'
B 'wget http://www.cpan.org/src/5.0/perl-5.24.0.tar.bz2; tar -xjvf perl-5.24.0.tar.bz2'
echo '[ MANUAL BUILD ONLY: Build Perl Source Code ]'
B 'cd perl-5.24.0; ./Configure -des; make; make test'
echo '[ MANUAL BUILD ONLY: Install Perl Build ]'
S 'cd perl-5.24.0; make install'
# OR
echo '[ TOKUHIROM PERL-BUILD ONLY: Download, Build, Install Perl ]'
# NEED ANSWER: does this actually work?
S 'curl https://raw.githubusercontent.com/tokuhirom/Perl-Build/master/perl-build | perl - 5.24.0 /usr/local/bin/perl-5.24.0/'
echo '[ EITHER OPTION: Install cpanminus ]'
S perl -MCPAN -e 'install App::cpanminus'
elif [ $PERL_INSTALL_CHOICE == 'd' ] || [ $PERL_INSTALL_CHOICE == 'system' ]; then
echo '21d. [[[ LINUX, INSTALL SYSTEM-WIDE SYSTEM PERL & CPANM ]]]'
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
VERIFY_UBUNTU
echo '[ Install Perl & CPANM ]'
S apt-get install perl cpanminus
echo '[ Check Install, Confirm No Errors ]'
S apt-get -f install
# OR
elif [[ "$OS_CHOICE" == "centos" ]]; then
VERIFY_CENTOS
echo '[ Install Perl & CPANM Dependencies ]'
S yum install perl-core perl-libs perl-devel perl-CPAN curl
echo '[ Install CPANM System-Wide ]'
S 'curl -L http://cpanmin.us | perl - --sudo App::cpanminus'
if [ $DEVELOPER_CHOICE == 'yes' ]; then
echo '[ Check Install, Confirm No Errors; WARNING! MAY TAKE HOURS TO RUN! ]'
S yum check
fi
fi
else
echo "ERROR: Unrecognized value for PERL_INSTALL_CHOICE, '${PERL_INSTALL_CHOICE}', please see '--help' option for valid values"
fi
elif [ $MACHINE_CHOICE == '1' ] || [ $MACHINE_CHOICE == 'existing' ]; then
echo "Nothing To Do On Existing Machine!"
fi
CURRENT_SECTION_COMPLETE
fi
# SECTION 22 VARIABLES
# overwrites previous settings, makes it easier to copy-and-paste from LAMP_installer.sh to rperl_installer.sh
EDITOR='__EMPTY__'
USERNAME='__EMPTY__'
if [ $SECTION_CHOICE -le 22 ] && [ $DEVELOPER_CHOICE != 'yes' ]; then
echo '22. [[[ LINUX, PACKAGE RPERL DEPENDENCIES ]]]'
echo
echo 'SKIPPING! Developer Sections Disabled'
echo
CURRENT_SECTION_COMPLETE
elif [ $SECTION_CHOICE -le 22 ]; then
echo '22. [[[ LINUX, PACKAGE RPERL DEPENDENCIES ]]]'
echo
if [ $MACHINE_CHOICE == '0' ] || [ $MACHINE_CHOICE == 'new' ]; then
# [[[ FPM ]]]
# [[[ FPM ]]]
# [[[ FPM ]]]
# fpm, install deps
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
VERIFY_UBUNTU
S apt-get install ruby ruby-dev rubygems build-essential
elif [[ "$OS_CHOICE" == "centos" ]]; then
VERIFY_CENTOS
S yum install ruby-devel gcc make rpm-build rubygems perl-generators
fi
S gem update --system # must have RubyGems >= v2.7.5 to avoid "Errno::EPERM: Operation not permitted @ chown_internal" on `bundle install` for fpm dev version
S cpan App::cpanminus
# fpm, install release version
S gem install --no-ri --no-rdoc fpm
B which fpm
B fpm --version
B fpm --verbose -s cpan -t rpm ExtUtils::MakeMaker
# SRPM START HERE: to build source packages, figure out which parts to insert into spec file via --edit, BuildRequires & Obsoletes %build & %install & %check https://src.fedoraproject.org/cgit/rpms/perl-IO-Compress.git/tree/perl-IO-Compress.spec
# SRPM START HERE: to build source packages, figure out which parts to insert into spec file via --edit, BuildRequires & Obsoletes %build & %install & %check https://src.fedoraproject.org/cgit/rpms/perl-IO-Compress.git/tree/perl-IO-Compress.spec
# SRPM START HERE: to build source packages, figure out which parts to insert into spec file via --edit, BuildRequires & Obsoletes %build & %install & %check https://src.fedoraproject.org/cgit/rpms/perl-IO-Compress.git/tree/perl-IO-Compress.spec
B fpm --verbose --debug-workspace --edit --no-cpan-test -s cpan -t rpm IO::Compress::Gzip
B rpm -qp --whatprovides ./perl-IO-Compress-2.081-1.noarch.rpm # package not installed
B rpm -q --whatprovides perl-IO-Compress # package installed
B repoquery --provides perl-IO-Compress # package installed or not
# fpm, install dev version
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
S apt-get install bsdtar
elif [[ "$OS_CHOICE" == "centos" ]]; then
S yum install bsdtar
elif [[ "$OS_CHOICE" == "macosx" ]]; then
VERIFY_MACOSX
S xcode-select --install # Mac OS 10.9 (Mavericks)
fi
S gem install bundler
B mkdir -p ~/repos_github
# B git clone git@github.com:jordansissel/fpm.git ~/repos_github/fpm-latest
B git clone https://github.com/wbraswell/fpm.git ~/repos_github/fpm-fork-latest
CD ~/repos_github/fpm-fork-latest
S bundle install
# OUTPUT: ... Using FOO (X.Y.Z) Using fpm (X.Y.Z) from source at `.` Using BAR (X.Y.Z) ...
B make
# ERRORS MAY OCCUR, it should work anyway
B export PATH=~/repos_github/fpm-fork-latest/bin:$PATH
B which fpm
B fpm --version
# fpm, build RPerl package w/out deps
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
B reset; rm -Rf ~/cpantofpm_tmp/* ~/cpantofpm_packages/*; cd ~/cpantofpm_packages/; time fpm --no-cpan-test --cpan-verbose --verbose --debug-workspace --maintainer 'William N. Braswell, Jr. <william.braswell@NOSPAM.autoparallel.com>' --workdir ~/cpantofpm_tmp/ -s cpan -t deb --deb-?? RPerl
elif [[ "$OS_CHOICE" == "centos" ]]; then
B reset; rm -Rf ~/cpantofpm_tmp/* ~/cpantofpm_packages/*; cd ~/cpantofpm_packages/; time fpm --no-cpan-test --cpan-verbose --verbose --debug-workspace --maintainer 'William N. Braswell, Jr. <william.braswell@NOSPAM.autoparallel.com>' --workdir ~/cpantofpm_tmp/ -s cpan -t rpm --rpm-ba RPerl
fi
# [[[ FPM-Cookery ]]]
# [[[ FPM-Cookery ]]]
# [[[ FPM-Cookery ]]]
S gem install bundler
B mkdir -p ~/repos_github
B git clone https://github.com/bernd/fpm-cookery.git ~/repos_github/fpm-cookery-latest
CD ~/repos_github/fpm-cookery-latest
S bundle install # ignore warning about not running as root, must run as root for `sudo fpm-cook install-deps` to find facter.rb & other fpm-cookery runtime deps
B rake spec --trace # run tests, may seem frozen for 5 - 10 minutes
B export PATH=~/repos_github/fpm-cookery-latest/bin:$PATH
B which fpm-cook
B fpm-cook --version
B mkdir -p ~/fpm_cookery_tmp
CD ~/fpm_cookery_tmp
B vi recipe.rb
#class Tmux < FPM::Cookery::Recipe
# description 'terminal multiplexer'
# name 'tmux'
# version '1.9a'
# homepage 'http://tmux.github.io'
# source 'https://github.com/tmux/tmux/releases/download/1.9a/tmux-1.9a.tar.gz'
# build_depends 'libevent-devel', 'ncurses-devel'
# depends 'libevent-2.0*'
# def build
# configure :prefix => prefix
# make
# end
# def install
# make :install, 'DESTDIR' => destdir
# end
#end
S ~/repos_github/fpm-cookery-latest/bin/fpm-cook install-deps
B fpm-cook
# [[[ CPANtoFPM ]]]
# [[[ CPANtoFPM ]]]
# [[[ CPANtoFPM ]]]
# cpantofpm, install deps
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
S apt-get install expect # for unbuffer
elif [[ "$OS_CHOICE" == "centos" ]]; then
S yum install expect # for unbuffer
fi
S cpan Module::CoreList
S cpan Alien::Build
B cpanm -v --notest MetaCPAN::Client
# FPM THEN START HERE: FPM CPAN pull request pacman test failures; DEB support; RPM mock support
# FPM THEN START HERE: FPM CPAN pull request pacman test failures; DEB support; RPM mock support
# FPM THEN START HERE: FPM CPAN pull request pacman test failures; DEB support; RPM mock support
# FPM THEN START HERE: merge FPM & FPM-Cookery to enable SPEC/SRPM output;; __OR__;; get fpm to accept SPEC file as input; rebuild libbson & mongo-c-driver & mongo-cxx-driver using SPEC files & fpm; manually build SPEC files for PCRE2 & JPCRE2 & PLUTO
# FPM THEN START HERE: merge FPM & FPM-Cookery to enable SPEC/SRPM output;; __OR__;; get fpm to accept SPEC file as input; rebuild libbson & mongo-c-driver & mongo-cxx-driver using SPEC files & fpm; manually build SPEC files for PCRE2 & JPCRE2 & PLUTO
# FPM THEN START HERE: merge FPM & FPM-Cookery to enable SPEC/SRPM output;; __OR__;; get fpm to accept SPEC file as input; rebuild libbson & mongo-c-driver & mongo-cxx-driver using SPEC files & fpm; manually build SPEC files for PCRE2 & JPCRE2 & PLUTO
# FPM THEN START HERE: remove comments in lib/fpm/package/cpan.rb; save all deps files in correct DEPS folder; skip processing if rpm/srpm/spec/dep files already present, else run fpm w/ force option to overwrite existing file(s); save file names in $distributions_processed & use to make tarball
# FPM THEN START HERE: remove comments in lib/fpm/package/cpan.rb; save all deps files in correct DEPS folder; skip processing if rpm/srpm/spec/dep files already present, else run fpm w/ force option to overwrite existing file(s); save file names in $distributions_processed & use to make tarball
# FPM THEN START HERE: remove comments in lib/fpm/package/cpan.rb; save all deps files in correct DEPS folder; skip processing if rpm/srpm/spec/dep files already present, else run fpm w/ force option to overwrite existing file(s); save file names in $distributions_processed & use to make tarball
# cpantofpm, set hostname to be embedded in packages
S vi /etc/hostname && hostname -F /etc/hostname && hostname # packages.rperl.org
# cpantofpm, set path to executable
B export PATH=~/repos_gitlab/app-cpantofpm-latest/bin/:$PATH # NEED FIX, HARD-CODED SHORTCUTS TO ~/cpantofpm BELOW
# __OR__
B cd; rm ./cpantofpm ; vi ./cpantofpm ; chmod a+x ./cpantofpm
# cpantofpm, build RPerl package w/ deps
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
B reset; rm -Rf ~/cpantofpm_tmp/* ~/cpantofpm_packages/*; cd ~/cpantofpm_packages/; time ~/cpantofpm -t deb RPerl
elif [[ "$OS_CHOICE" == "centos" ]]; then
B reset; rm -Rf ~/cpantofpm_tmp/* ~/cpantofpm_packages/*; cd ~/cpantofpm_packages/; time ~/cpantofpm -t rpm RPerl
fi
# [[[ AStyle ]]]
# [[[ AStyle ]]]
# [[[ AStyle ]]]
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
# DEB START HERE: create packages
# DEB START HERE: create packages
# DEB START HERE: create packages
echo 'NEED DEB COMMANDS HERE'
elif [[ "$OS_CHOICE" == "centos" ]]; then
CD ~/cpantofpm_packages/x86_64/
B wget https://github.com/wbraswell/astyle-mirror/raw/master/backup/astyle-2.05.1-1.el7.centos.x86_64.rpm
CD ~/cpantofpm_packages/SRPMS/
B wget https://github.com/wbraswell/astyle-mirror/raw/master/backup/astyle-2.05.1-1.el7.centos.src.rpm
# NEED UPGRADE: copy spec file out of srpm into SPECS/ directory
fi
# [[[ PCRE2 ]]]
# [[[ PCRE2 ]]]
# [[[ PCRE2 ]]]
CD ~/
B wget https://ftp.pcre.org/pub/pcre/pcre2-10.31.tar.gz
B tar -xzvf pcre2-10.31.tar.gz
CD pcre2-10.31
B ./configure --enable-pcre2-16 --enable-pcre2-32 --disable-shared --enable-jit
B make
B make check
B mkdir -p ~/fpm_tmp_install && rm -Rf ~/fpm_tmp_install/*
B make install DESTDIR=~/fpm_tmp_install
CD ~/
B mkdir -p ~/fpm_tmp_work && rm -Rf ~/fpm_tmp_work/*
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
# DEB START HERE: create packages
# DEB START HERE: create packages
# DEB START HERE: create packages
echo 'NEED DEB COMMANDS HERE'
elif [[ "$OS_CHOICE" == "centos" ]]; then
B reset; time fpm --verbose --debug-workspace --maintainer 'William N. Braswell, Jr. <william.braswell@NOSPAM.autoparallel.com>' --workdir ~/fpm_tmp_work/ -s dir -t rpm --rpm-ba -p libpcre2-VERSION_ARCH.rpm -n libpcre2 -v 10.31 -C ~/fpm_tmp_install usr/local/lib usr/local/bin usr/local/share
B rm libpcre2-10.31_x86_64.rpm # prefer file naming uniformity with '-1' in all file names
B cp ~/fpm_tmp_work/package-rpm-build-*/RPMS/x86_64/libpcre2-10.31-1.x86_64.rpm ~/cpantofpm_packages/x86_64/
B cp ~/fpm_tmp_work/package-rpm-build-*/SRPMS/libpcre2-10.31-1.src.rpm ~/cpantofpm_packages/SRPMS/
B cp ~/fpm_tmp_work/package-rpm-build-*/SPECS/libpcre2.spec ~/cpantofpm_packages/SPECS/
B mkdir -p ~/fpm_tmp_work && rm -Rf ~/fpm_tmp_work/*
B reset; time fpm --verbose --debug-workspace --maintainer 'William N. Braswell, Jr. <william.braswell@NOSPAM.autoparallel.com>' --workdir ~/fpm_tmp_work/ -s dir -t rpm --rpm-ba -p libpcre2-dev_VERSION_ARCH.rpm -n libpcre2-dev -v 10.31 -C ~/fpm_tmp_install usr/local/include
B rm libpcre2-dev_10.31_x86_64.rpm # prefer file naming uniformity with '-1' in all file names
B cp ~/fpm_tmp_work/package-rpm-build-*/RPMS/x86_64/libpcre2-dev-10.31-1.x86_64.rpm ~/cpantofpm_packages/x86_64/
B cp ~/fpm_tmp_work/package-rpm-build-*/SRPMS/libpcre2-dev-10.31-1.src.rpm ~/cpantofpm_packages/SRPMS/
B cp ~/fpm_tmp_work/package-rpm-build-*/SPECS/libpcre2-dev.spec ~/cpantofpm_packages/SPECS/
fi
B rm -Rf pcre2-10.31.tar.gz pcre2-10.31 ~/fpm_tmp_work ~/fpm_tmp_install
# [[[ JPCRE2 ]]]
# [[[ JPCRE2 ]]]
# [[[ JPCRE2 ]]]
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
# DEB START HERE: create packages
# DEB START HERE: create packages
# DEB START HERE: create packages
echo 'NEED DEB COMMANDS HERE'
elif [[ "$OS_CHOICE" == "centos" ]]; then
S rpm -i ~/cpantofpm_packages/x86_64/libpcre2-10.31-1.x86_64.rpm
S rpm -i ~/cpantofpm_packages/x86_64/libpcre2-dev-10.31-1.x86_64.rpm
fi
CD ~/
B wget https://github.com/jpcre2/jpcre2/archive/10.31.02-2.tar.gz -O jpcre2-10.31.02-2.tar.gz
B tar -xzvf jpcre2-10.31.02-2.tar.gz
CD jpcre2-10.31.02-2
B ./configure --disable-cpp11 --enable-test
B make
B make check
B mkdir -p ~/fpm_tmp_install && rm -Rf ~/fpm_tmp_install/*
B make install DESTDIR=~/fpm_tmp_install
CD ~/
B mkdir -p ~/fpm_tmp_work && rm -Rf ~/fpm_tmp_work/*
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
# DEB START HERE: create packages
# DEB START HERE: create packages
# DEB START HERE: create packages
echo 'NEED DEB COMMANDS HERE'
elif [[ "$OS_CHOICE" == "centos" ]]; then
B reset; time fpm --verbose --debug-workspace --maintainer 'William N. Braswell, Jr. <william.braswell@NOSPAM.autoparallel.com>' --workdir ~/fpm_tmp_work/ -s dir -t rpm --rpm-ba -p libjpcre2-dev_VERSION_ARCH.rpm -n libjpcre2-dev -v 10.31.02-2 -d "libpcre2 >= 10.31" -d "libpcre2-dev >= 10.31" -C ~/fpm_tmp_install usr/local/include usr/local/share/doc
B rm libjpcre2-dev_10.31.02_2_x86_64.rpm # prefer file naming uniformity with '-1' in all file names
B cp ~/fpm_tmp_work/package-rpm-build-*/RPMS/x86_64/libjpcre2-dev-10.31.02_2-1.x86_64.rpm ~/cpantofpm_packages/x86_64/
B cp ~/fpm_tmp_work/package-rpm-build-*/SRPMS/libjpcre2-dev-10.31.02_2-1.src.rpm ~/cpantofpm_packages/SRPMS/
B cp ~/fpm_tmp_work/package-rpm-build-*/SPECS/libjpcre2-dev.spec ~/cpantofpm_packages/SPECS/
S rpm -e libpcre2 libpcre2-dev
fi
B rm -Rf jpcre2-10.31.02-2.tar.gz jpcre2-10.31.02-2 ~/fpm_tmp_work/ ~/fpm_tmp_install/
# [[[ Pluto ]]]
# [[[ Pluto ]]]
# [[[ Pluto ]]]
CD ~/
B wget https://github.com/bondhugula/pluto/files/737550/pluto-0.11.4.tar.gz
B tar -xzvf pluto-0.11.4.tar.gz
CD pluto-0.11.4
B ./configure
B make
B make test
B mkdir -p ~/fpm_tmp_install && rm -Rf ~/fpm_tmp_install/*
B make install DESTDIR=~/fpm_tmp_install
CD ~/
B mkdir -p ~/fpm_tmp_work && rm -Rf ~/fpm_tmp_work/*
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
# DEB START HERE: create packages
# DEB START HERE: create packages
# DEB START HERE: create packages
echo 'NEED DEB COMMANDS HERE'
elif [[ "$OS_CHOICE" == "centos" ]]; then
B reset; time fpm --verbose --debug-workspace --maintainer 'William N. Braswell, Jr. <william.braswell@NOSPAM.autoparallel.com>' --workdir ~/fpm_tmp_work/ -s dir -t rpm --rpm-ba -p pluto-polycc-VERSION_ARCH.rpm -n pluto-polycc -v 0.11.4 -C ~/fpm_tmp_install usr/local/lib usr/local/bin usr/local/share
B rm pluto-polycc-0.11.4_x86_64.rpm # prefer file naming uniformity with '-1' in all file names
B cp ~/fpm_tmp_work/package-rpm-build-*/RPMS/x86_64/pluto-polycc-0.11.4-1.x86_64.rpm ~/cpantofpm_packages/x86_64/
B cp ~/fpm_tmp_work/package-rpm-build-*/SRPMS/pluto-polycc-0.11.4-1.src.rpm ~/cpantofpm_packages/SRPMS/
B cp ~/fpm_tmp_work/package-rpm-build-*/SPECS/pluto-polycc.spec ~/cpantofpm_packages/SPECS/
B mkdir -p ~/fpm_tmp_work && rm -Rf ~/fpm_tmp_work/*
B reset; time fpm --verbose --debug-workspace --maintainer 'William N. Braswell, Jr. <william.braswell@NOSPAM.autoparallel.com>' --workdir ~/fpm_tmp_work/ -s dir -t rpm --rpm-ba -p pluto-polycc-dev-VERSION_ARCH.rpm -n pluto-polycc-dev -v 0.11.4 -C ~/fpm_tmp_install usr/local/include
B rm pluto-polycc-dev-0.11.4_x86_64.rpm # prefer file naming uniformity with '-1' in all file names
B cp ~/fpm_tmp_work/package-rpm-build-*/RPMS/x86_64/pluto-polycc-dev-0.11.4-1.x86_64.rpm ~/cpantofpm_packages/x86_64/
B cp ~/fpm_tmp_work/package-rpm-build-*/SRPMS/pluto-polycc-dev-0.11.4-1.src.rpm ~/cpantofpm_packages/SRPMS/
B cp ~/fpm_tmp_work/package-rpm-build-*/SPECS/pluto-polycc-dev.spec ~/cpantofpm_packages/SPECS/
fi
B rm -Rf pluto-0.11.4.tar.gz pluto-0.11.4 ~/fpm_tmp_work/ ~/fpm_tmp_install/
# [[[ BSON ]]]
# [[[ BSON ]]]
# [[[ BSON ]]]
if [[ "$OS_CHOICE" == "ubuntu" ]]; then
# DEB START HERE: create packages
# DEB START HERE: create packages
# DEB START HERE: create packages
echo 'NEED DEB COMMANDS HERE'
elif [[ "$OS_CHOICE" == "centos" ]]; then
echo '[ Build RPerl Dependencies, MongoDB C++ Driver Prerequisites, BSON libbson ]'
# perl-interpreter is a dummy package for CentOS 7 compatibility with Fedora source packages libbson & mongo-c-driver
S yum install rpm-build libtool cyrus-sasl-lib cyrus-sasl-devel snappy-devel perl-interpreter python-sphinx
# B wget http://dl.fedoraproject.org/pub/fedora/linux/updates/27/SRPMS/Packages/l/libbson-1.9.3-1.fc27.src.rpm # DEV NOTE: prefer GitHub mirror below
B wget https://github.com/wbraswell/libbson-mirror/raw/master/libbson-1.9.3-1.fc27.src.rpm # DEV NOTE: prefer our own GitHub mirror for uniformity
S rpm -i -vv ./libbson-1.9.3-1.fc27.src.rpm
B wget https://github.com/wbraswell/libbson-mirror/raw/master/libbson.spec
S mv ./libbson.spec /root/rpmbuild/SPECS/libbson.spec
S rpmbuild -ba /root/rpmbuild/SPECS/libbson.spec
S rpm -i -vv /root/rpmbuild/RPMS/x86_64/libbson-1.9.3-1.el7.centos.x86_64.rpm
S rpm -i -vv /root/rpmbuild/RPMS/x86_64/libbson-devel-1.9.3-1.el7.centos.x86_64.rpm # provides pkgconfig(libbson-1.0) to satisfy mongodb-c-driver requirements
# DEV NOTE: check if SRPM can be rebuilt
# B wget https://github.com/wbraswell/libbson-mirror/raw/master/libbson-1.9.3-1.el7.centos.src.rpm
# B rpm -ivh ./libbson-1.9.3-1.el7.centos.src.rpm
# S yum-builddep libbson
# B rpmbuild -v -ba ~/rpmbuild/SPECS/libbson.spec
# DEV NOTE: copy our own pre-built packages into CPANtoFPM directory structure
CD ~/cpantofpm_packages/SPECS/
B wget https://github.com/wbraswell/libbson-mirror/raw/master/libbson.spec