-
Notifications
You must be signed in to change notification settings - Fork 1
/
perl-install.sh
executable file
·70 lines (54 loc) · 1.75 KB
/
perl-install.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
#!/usr/bin/env bash
set -e
#
# Copyright (C) 2018-2024 Joelle Maslak
# All Rights Reserved - See License
#
CURRENTPERL=perl-5.40.0
PERLBREW_MAJOR=0
PERLBREW_MINOR=98
doit() {
# Defensive umask
if [ "$(umask)" == '0000' ] ; then
umask 0002
fi
# Check for installation of curl
if ! command -v curl >/dev/null ; then
echo "" >&2
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >&2
echo "Please install curl first" >&2
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >&2
echo "" >&2
exit 1
fi
if [ ! -d ~/perl5/perlbrew ] ; then
echo " --->> Installing perlbrew"
curl -L https://install.perlbrew.pl | \
sed -e s_/usr/local/bin/perl_/run/current-system/sw/bin/perl_ | \
bash
exit
fi
# Source the bashrc
# shellcheck source=/home/jmaslak/perl5/perlbrew/etc/bashrc
. ~/perl5/perlbrew/etc/bashrc
MAJOR=$(perlbrew --version | sed -e 's/.*\///' | sed -e 's/\..*//' )
MINOR=$(perlbrew --version | sed -e 's/.*\/0\.//')
if [ "$MAJOR" -lt "$PERLBREW_MAJOR" ] ; then
echo " --->> Upgrading perlbrew"
perlbrew self-upgrade
elif [ "$MAJOR" -gt "$PERLBREW_MAJOR" ] ; then
# We're new enough
true
elif [ "$MINOR" -lt "$PERLBREW_MINOR" ] ; then
echo " --->> Upgrading perlbrew"
perlbrew self-upgrade
fi
if [ ! -d ~/perl5/perlbrew/perls/$CURRENTPERL ] ; then
echo " --->> Installing perl"
perlbrew install --notest $CURRENTPERL -Accflags=-fPIC -j 8
echo " --->> Activating perl"
perlbrew switch $CURRENTPERL
echo " !!!>> You will need to log out and back in to switch versions"
fi
}
doit "$@"