source: genapp/sbin/install

Last change on this file was 1660, checked in by ehb, 3 years ago

disallow install as root

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/bash
2
3if [[ $EUID -eq 0 ]]; then
4   echo "This script can not be run as root" 
5   exit 1
6fi
7
8export GENAPP="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
9echo genapp base directory is $GENAPP
10
11# is perl installed
12
13PERL=`which perl`
14if [ -z $PERL ]; then 
15  printf "you must install perl\nfor RedHat/Centos: sudo yum -y install perl\nor for Ubuntu: sudo apt-get -y install perl\n"
16  exit
17fi
18
19PV=`$PERL -e 'print $];'`
20if (( $(echo "$PV < 5.018" | bc -l) )); then
21  if [ -x $GENAPP/perl/bin/perl ]; then
22     PERL=$GENAPP/perl/bin/perl
23     NOSUDO=1
24     echo nosudo set to 1
25  fi
26fi
27
28PV=`$PERL -e 'print $];'`
29if (( $(echo "$PV < 5.018" | bc -l) )); then
30  printf "you need at least perl version 5.18 to continue\nyou can try the script:\n$GENAPP/sbin/install-perl-stable\nand then retry:
31$GENAPP/sbin/install\n";
32  exit;
33fi
34
35echo perl version is $PV
36
37echo '*** installing required perl modules ***'
38
39export PERL_MM_USE_DEFAULT=1
40
41if [ -z "$NOSUDO" ]; then
42    sudo -E $PERL -MCPAN -eshell <<_EOF
43o conf urllist http://www.cpan.org
44install JSON
45install Hash::Merge
46install Data::Dumper
47install Try::Tiny
48install LWP::UserAgent
49install MIME::Lite
50install MIME::Base64
51notest install LWP::Protocol::https
52_EOF
53#    sudo -E bash -c "$PERL -MCPAN -e 'install \"JSON\";install \"Hash::Merge\";install \"Data::Dumper\";install \"Try::Tiny\";install \"LWP::UserAgent\";install \"MIME::Lite\";install \"MIME::Base64\";install \"LWP::Protocol::https\";'"
54else
55    $PERL -MCPAN -eshell <<_EOF
56o conf urllist http://www.cpan.org
57install JSON
58install Hash::Merge
59install Data::Dumper
60install Try::Tiny
61install LWP::UserAgent
62install MIME::Lite
63install MIME::Base64
64notest install LWP::Protocol::https
65_EOF
66#    $PERL -MCPAN -e "install \"JSON\";install \"Hash::Merge\";install \"Data::Dumper\";install \"Try::Tiny\";install \"LWP::UserAgent\";install \"MIME::Lite\";install \"MIME::Base64\";install \"LWP::Protocol::https\";"
67fi 
68exec $PERL $GENAPP/sbin/install.pl
Note: See TracBrowser for help on using the repository browser.