projects/aports·blob master · refs

26 lines · 831 B

1#!/bin/sh
2
3# This file is not provided since splitting npm into a separate aport,
4# so we use it to quickly detect presence of the old npm package.
5if [ -f /usr/lib/node_modules/npm/configure ]; then
6 pkg_ver=$(apk info -W /usr/bin/npm 2>/dev/null \
7 | sed -En 's/.*owned by npm-([^-]+).*/\1/p' \
8 | grep .) || exit 0
9
10 npm_ver=$(/usr/bin/npm --version 2>/dev/null) || exit 0
11
12 [ "$pkg_ver" = "$npm_ver" ] && exit 0
13
14 cat >&2 <<-EOF
15 *
16 * You have an old version of the 'npm' package installed
17 * (pkg version: $pkg_ver, real version: $npm_ver). The newer package
18 * has a *lower* version number that now corresponds to the actual
19 * version of the 'npm' program. You have to reinstall the npm package
20 * (apk del npm; apk add npm) or upgrade all packages to the available
21 * versions (apk upgrade -a).
22 *
23 EOF
24fi
25
26exit 0