aboutsummaryrefslogtreecommitdiff
path: root/bin/plmu
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-09-07 17:37:33 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-09-07 17:37:33 +1200
commit070320458eb2927b9e13ccb7e64da61707ff134c (patch)
treeb3f73318c3869134cd22a272e4461f8fc2508b83 /bin/plmu
parentMerge branch 'release/v10.5.0' into develop (diff)
downloaddotfiles-070320458eb2927b9e13ccb7e64da61707ff134c.tar.gz
dotfiles-070320458eb2927b9e13ccb7e64da61707ff134c.zip
Remove `plmu(1df)`
App::cpanoutdated does this better.
Diffstat (limited to 'bin/plmu')
-rwxr-xr-xbin/plmu28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/plmu b/bin/plmu
new file mode 100755
index 00000000..bac2e434
--- /dev/null
+++ b/bin/plmu
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Upgrade plenv modules with cpanm(1)
+
+# Set up exceptions file if it exists
+def="$HOME"/.plenv/non-cpanm-modules
+if [ -e "$def" ] ; then
+ ef=$def
+else
+ ef=/dev/null
+fi
+
+# Check that exceptions file is sorted
+if ! LC_COLLATE=C sort -c -- "$ef" ; then
+ printf >&2 '%s not sorted\n' "$ef"
+ exit 1
+fi
+
+# Get the list of modules; sort them in case our current locale disagrees on
+# the existing sorting
+plenv list-modules | LC_COLLATE=C sort |
+
+# Exclude any modules in ~/.plenv/non-cpanm-modules if it exists
+LC_COLLATE=C comm -23 -- - "$ef" |
+
+# Read that list of modules to upgrade and upgrade them one by one
+while read -r module ; do
+ cpanm --notest --quiet -- "$module"
+done