ayaports/user/nodejs/nodejs.post-upgrade

26 lines
831 B
Bash

#!/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