mirror of
https://github.com/gwenhael-le-moine/npm2tgz.git
synced 2024-12-27 09:58:57 +01:00
get installation path from $()npm root)
This commit is contained in:
parent
af78d38375
commit
b7665b2df1
1 changed files with 7 additions and 6 deletions
11
npm2tgz
11
npm2tgz
|
@ -39,8 +39,7 @@ OUTPUT=${OUTPUT:=/tmp}
|
||||||
ARCH=${ARCH:=npmjs}
|
ARCH=${ARCH:=npmjs}
|
||||||
PREFIX=${PREFIX:=/usr}
|
PREFIX=${PREFIX:=/usr}
|
||||||
NPMBIN=${NPMBIN:=/usr/bin/npm}
|
NPMBIN=${NPMBIN:=/usr/bin/npm}
|
||||||
|
NPMROOT=${NPMROOT:-$(NPMBIN -g root)}
|
||||||
PKG=/tmp/$TAG/pkg-$PRGNAM
|
|
||||||
|
|
||||||
[ ! -x $NPMBIN ] && echo "npm missing" && exit 1
|
[ ! -x $NPMBIN ] && echo "npm missing" && exit 1
|
||||||
if [ "x$1" == "x" ] || [ "x$1" == "x--help" ] || [ "x$1" == "x-h" ]; then
|
if [ "x$1" == "x" ] || [ "x$1" == "x--help" ] || [ "x$1" == "x-h" ]; then
|
||||||
|
@ -54,20 +53,22 @@ if [ "x$1" == "x" ] || [ "x$1" == "x--help" ] || [ "x$1" == "x-h" ]; then
|
||||||
echo " ARCH=<value> (currently: $ARCH)"
|
echo " ARCH=<value> (currently: $ARCH)"
|
||||||
echo " PREFIX=<value> (currently: $PREFIX)"
|
echo " PREFIX=<value> (currently: $PREFIX)"
|
||||||
echo " NPMBIN=<value> (currently: $NPMBIN)"
|
echo " NPMBIN=<value> (currently: $NPMBIN)"
|
||||||
|
echo " NPMROOT=<value> (currently: $NPMROOT)"
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PRGNAM=$1
|
PRGNAM=$1
|
||||||
|
PKG=/tmp/$TAG/pkg-$PRGNAM
|
||||||
|
|
||||||
[ -e $PKG ] && rm -fr $PKG
|
[ -e $PKG ] && rm -fr $PKG
|
||||||
mkdir -p $PKG
|
mkdir -p $PKG
|
||||||
|
|
||||||
DESTDIR=$PKG npm install -g $PRGNAM
|
DESTDIR=$PKG npm install -g $PRGNAM
|
||||||
|
|
||||||
VERSION=$(grep -i "\"version\": \"\(.*\)\"," $PKG/usr/lib$(uname -m | grep -o "64")/node_modules/$PRGNAM/package.json | sed 's|^[ ]*"version": "\(.*\)",$|\1|g')
|
VERSION=$(grep -i "\"version\": \"\(.*\)\"," $PKG${NPMROOT}/$PRGNAM/package.json | sed 's|^[ ]*"version": "\(.*\)",$|\1|g')
|
||||||
DESCRIPTION=$(grep -i "\"description\": \"\(.*\)\"," $PKG/usr/lib$(uname -m | grep -o "64")/node_modules/$PRGNAM/package.json | sed 's|^[ ]*"description": "\(.*\)",$|\1|g')
|
DESCRIPTION=$(grep -i "\"description\": \"\(.*\)\"," $PKG${NPMROOT}/$PRGNAM/package.json | sed 's|^[ ]*"description": "\(.*\)",$|\1|g')
|
||||||
HOMEPAGE=$(grep -i "\"homepage\": \"\(.*\)\"," $PKG/usr/lib$(uname -m | grep -o "64")/node_modules/$PRGNAM/package.json | sed 's|^[ ]*"homepage": "\(.*\)",$|\1|g')
|
HOMEPAGE=$(grep -i "\"homepage\": \"\(.*\)\"," $PKG${NPMROOT}/$PRGNAM/package.json | sed 's|^[ ]*"homepage": "\(.*\)",$|\1|g')
|
||||||
|
|
||||||
mkdir -p $PKG/install
|
mkdir -p $PKG/install
|
||||||
cat <<EOF > $PKG/install/slack-desc
|
cat <<EOF > $PKG/install/slack-desc
|
||||||
|
|
Loading…
Reference in a new issue