aboutsummaryrefslogtreecommitdiffstats
path: root/main/nodejs/nodejs.post-upgrade
diff options
context:
space:
mode:
Diffstat (limited to 'main/nodejs/nodejs.post-upgrade')
-rw-r--r--main/nodejs/nodejs.post-upgrade26
1 files changed, 26 insertions, 0 deletions
diff --git a/main/nodejs/nodejs.post-upgrade b/main/nodejs/nodejs.post-upgrade
new file mode 100644
index 0000000000..764aa17ff3
--- /dev/null
+++ b/main/nodejs/nodejs.post-upgrade
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# This file is not provided since splitting npm into a separate aport,
+# so we use it to quickly detect presence of the old npm package.
+if [ -f /usr/lib/node_modules/npm/configure ]; then
+ pkg_ver=$(apk info -W /usr/bin/npm 2>/dev/null \
+ | sed -En 's/.*owned by npm-([^-]+).*/\1/p' \
+ | grep .) || exit 0
+
+ npm_ver=$(/usr/bin/npm --version 2>/dev/null) || exit 0
+
+ [ "$pkg_ver" = "$npm_ver" ] && exit 0
+
+ cat >&2 <<-EOF
+ *
+ * You have an old version of the 'npm' package installed
+ * (pkg version: $pkg_ver, real version: $npm_ver). The newer package
+ * has a *lower* version number that now corresponds to the actual
+ * version of the 'npm' program. You have to reinstall the npm package
+ * (apk del npm; apk add npm) or upgrade all packages to the available
+ * versions (apk upgrade -a).
+ *
+ EOF
+fi
+
+exit 0