slackbuilds/_unmaintained/d/yarn/SlackBuild
2024-02-08 12:59:23 +01:00

55 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
CWD=$(pwd)
PRGNAM=$(basename $CWD)
TMP=${TMP:-/tmp/$TAG}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
ARCH="noarch"
VERSION=${VERSION:-$(curl -s https://api.github.com/repos/yarnpkg/yarn/releases/latest | grep tag_name | grep -o "v[0-9.]*" | tr -d v)}
BUILD=${BUILD:-1}
TAG=${TAG:-gwh}
rm -rf $PKG
mkdir -p $PKG/opt $PKG/usr/bin $OUTPUT
cd $PKG/opt/
wget -c https://github.com/yarnpkg/yarn/releases/download/v${VERSION}/yarn-v${VERSION}.tar.gz -O yarn.tar.gz
tar xvf yarn.tar.gz
rm yarn.tar.gz
mv $PKG/opt/dist $PKG/opt/$PRGNAM
rm $PKG/opt/$PRGNAM/bin/*.cmd
ln -s /opt/$PRGNAM/bin/yarn $PKG/usr/bin/yarn
ln -s /opt/$PRGNAM/bin/yarnpkg $PKG/usr/bin/yarnpkg
# Make sure top-level perms are correct:
chmod 0755 $PKG/usr/bin/yarn*
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler----------------------------------------------------|
$PRGNAM: $PRGNAM (package management for JS)
$PRGNAM:
$PRGNAM: Fast, reliable, and secure dependency management for Javascript.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: Homepage: https://yarnpkg.com/
$PRGNAM:
EOF
cd $PKG
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz