diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-06-21 09:31:28 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-06-21 09:31:28 +1200 |
commit | 24b2d4c8e3cb9ce9cccf810777674c7bce43620e (patch) | |
tree | 304872a962a8084062257b95492f55be64c2d4c7 /bin/plenv-modules-update | |
parent | Move locale export to top of script (diff) | |
download | dotfiles-24b2d4c8e3cb9ce9cccf810777674c7bce43620e.tar.gz dotfiles-24b2d4c8e3cb9ce9cccf810777674c7bce43620e.zip |
Add comments
Diffstat (limited to 'bin/plenv-modules-update')
-rwxr-xr-x | bin/plenv-modules-update | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/plenv-modules-update b/bin/plenv-modules-update index 504cf13f..7c7a144b 100755 --- a/bin/plenv-modules-update +++ b/bin/plenv-modules-update @@ -1,23 +1,34 @@ #!/usr/bin/env bash +# Export a sensible locale so that sort(1) behaves LANG=C.UTF-8 export LANG +# Check we have required programs hash cpanm plenv || exit +# Create required temporary files mf=$(mktemp) || exit ef=$(mktemp) || exit cf=$(mktemp) || exit +# Clean up temporary files on exit cleanup() { rm -f -- "$mf" "$ef" "$cf" } trap cleanup EXIT +# Get the list of modules, sort them, write them to a file plenv list-modules | sort > "$mf" + +# Sort the non-CPAN modules from ~/.plenv and write them to a file sort "$HOME"/.plenv/non-cpanm-modules > "$ef" + +# Write out the list of modules that appear in the first file, but not the +# second comm -23 -- "$mf" "$ef" > "$cf" +# Read the list of modules to upgrade and upgrade them one by one while read -r module ; do cpanm --from http://cpan.inspire.net.nz --notest --quiet -- "$module" done < "$cf" |