perl - Installing cpanm in a bash script -
i'm writing script installs , configures nagios requirements. requires cpanm , perl modules.
it's using step/try/next function here: https://stackoverflow.com/a/5196220
step "downloading cpanm installer" try `wget -q http://cpanmin.us -o $swrepo/cpanm.install` next step "installing cpanm" try echo '{ exec </dev/tty; cat $swrepo/cpanm.install | perl - app::cpanminus; }' | bash # try bash -c "$(cat $swrepo/cpanm.install | perl - app::cpanminus)" # try cat $swrepo/cpanm.install | perl - app::cpanminus next step "installing perl module nagios config" try `cpanm nagios::config` next
my problems here are:
whichever way attempt run install cpanminus, fails script, , won't install properly. can't seem make function outside of step/try/next functions (not want to.)
the cpanm command fails too. if isolate , run part of script, still fails, "cpanm command not found." can run manually @ command line.
any pointers frustrated?
update
i pulled cpanm setup out separate file: step "installing cpanm" try sh conf_cpanm.sh next
which works, , i'll try , pull in @ later date, far functions. can stay.
however, doing same try cpanm nagios::config won't work. file looks this:
#!/bin/bash cpanm nagios::config
...and if run calling sh conf_nagcpanm.sh
works fine.
i think using backticks
try `cpanm nagios::config`
is mistake. bash
take expression in backticks, execute it, , substitute output of command expression. output of cpanm
not going shell commands, not work. should be
try cpanm nagios::config
Comments
Post a Comment