Commit | Line | Data |
865241ea |
1 | #!/bin/bash |
2 | |
3 | function clean_up { |
4 | kill $PROG |
5 | wait 2>/dev/null |
6 | } |
7 | |
8 | export PERL_CPANM_OPT="--mirror http://www.cpan.org/" |
9 | |
10 | function cpanm_install { |
11 | local dep="$1" |
12 | printf "Installing (without testing) $dep ..." |
13 | ( |
14 | while true; do |
15 | sleep 3 |
16 | printf '.' |
17 | done |
18 | ) & |
19 | local PROG=$! |
20 | trap "clean_up $PROG; exit 1" SIGHUP SIGINT SIGTERM |
21 | local OUT=$(cpanm --verbose --no-interactive --no-man-pages --notest $dep 2>&1 ) |
22 | local STATUS=$? |
23 | kill $PROG |
24 | wait $PROG 2>/dev/null |
25 | trap - SIGHUP SIGINT SIGTERM |
26 | if [ $STATUS != 0 ]; then |
27 | echo ' Failed!' |
28 | echo "$OUT" |
29 | exit $? |
30 | fi |
31 | echo ' Done' |
32 | } |
33 | |
34 | for arg; do |
35 | case $arg in |
36 | --deps) |
37 | AUTHOR_OPTS='' |
38 | if [ -z "$AUTHOR_TESTING" ] || [ "$AUTHOR_TESTING" -ne 0 ]; then |
39 | AUTHOR_OPTS='--with-recommends' |
40 | fi |
41 | DEPS="$DEPS $(cpanm --showdeps -q . --with-develop $AUTHOR_OPTS)" |
42 | for dep in $DEPS; do |
43 | case $dep in |
44 | perl*) ;; |
45 | *) |
46 | cpanm_install $dep |
47 | ;; |
48 | esac |
49 | done |
50 | ;; |
51 | *) |
52 | cpanm_install $arg |
53 | ;; |
54 | esac |
55 | done |