├── .gitignore ├── bootstrap.sh ├── README.md └── setup /.gitignore: -------------------------------------------------------------------------------- 1 | /bundle/ 2 | /local/ 3 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SCRIPT=$(perl -MCwd -le 'print Cwd::abs_path(shift)' $0) 3 | DIR=$(dirname $SCRIPT) 4 | export PERL_CPANM_OPT='' 5 | $DIR/cpanm --mirror-only --mirror file://$DIR/cache --notest __ARGS__ $* 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## cpan-module-bootstrap 2 | 3 | Creates a shell script and cpanm bundle to install modules on a remote machine without cpanm installed _and_ no network connection. 4 | 5 | ## How to Use 6 | 7 | On a local machine: 8 | 9 | ``` 10 | > ./setup Module 11 | ``` 12 | 13 | Copy `./bundle` directory to a remote machine, then run `./bootstrap` within that directory. 14 | 15 | ## See Also 16 | 17 | App::cpackage 18 | -------------------------------------------------------------------------------- /setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "---> Creating CPAN module bootstrap bundle" 4 | perl -v 5 | 6 | echo "---> Checking if you have OrePAN2" 7 | cpanm OrePAN2 8 | 9 | mkdir ./bundle 10 | 11 | echo "---> Installing modules and its dependencies" 12 | cpanm -L ./local --save-dists ./bundle/cache --notest $* 13 | 14 | echo "---> Creating CPAN mirror out of cache" 15 | orepan2-indexer ./bundle/cache 16 | 17 | echo "---> Copying cpanm and bootstrap script" 18 | ARGS="$*" 19 | cp $(perldoc -l cpanm) ./bundle 20 | cat ./bootstrap.sh | perl -nlpe "s/__ARGS__/$ARGS/" > ./bundle/bootstrap 21 | chmod +x ./bundle/bootstrap 22 | 23 | echo "---> All done!" 24 | echo 25 | echo "Copy bundle directory to remote, and run bootstrap command from there" 26 | --------------------------------------------------------------------------------