shellcheck

This commit is contained in:
Gwenhael Le Moine 2024-05-21 22:26:47 +02:00
parent f16d4ed1ed
commit 16125498b5
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -3,14 +3,13 @@ set -x
CWD=$(pwd) CWD=$(pwd)
PRGNAM=$(basename $CWD) PRGNAM=$(basename "$CWD")
BUILD=1 BUILD=1
GITHUB_REPO=gwenhael-le-moine/x48ng GITHUB_REPO=gwenhael-le-moine/x48ng
VERSION=${VERSION:-latest} VERSION=${VERSION:-latest}
ARCH=$(uname -m) ARCH=$(uname -m)
LIBSUFFIX=$(echo $ARCH | grep -o "\(64\)")
TAG=gwh TAG=gwh
OUTPUT=/tmp OUTPUT=/tmp
@ -24,21 +23,25 @@ PREFIX=/usr
mkdir -p $TMP mkdir -p $TMP
# Cleaning # Cleaning
rm -fr $TMP/$PRGNAM $PKG rm -fr "${TMP:?}"/"$PRGNAM" "$PKG"
# Fetching sources # Fetching sources
[ ! -e $REPOSITORY ] && git clone https://github.com/${GITHUB_REPO}.git $REPOSITORY [ ! -e "$REPOSITORY" ] && git clone https://github.com/${GITHUB_REPO}.git "$REPOSITORY"
cd $REPOSITORY cd "$REPOSITORY" || exit 1
git pull --all git pull --all
cp -R $REPOSITORY $TMP/$PRGNAM cp -R "$REPOSITORY" $TMP/"$PRGNAM"
# Preparation # Preparation
cd $TMP/$PRGNAM cd $TMP/"$PRGNAM" || exit 1
[ "x$VERSION" == "xlatest" ] && VERSION=$(git describe --tags --abbrev=0) [ "$VERSION" == "latest" ] && VERSION=$(git describe --tags --abbrev=0)
[ "x$VERSION" == "x" ] && VERSION=trunk [ "$VERSION" == "" ] && VERSION=trunk
[ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION if [ "$VERSION" == "trunk" ]; then
VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
else
git checkout "$VERSION"
fi
chown -R root:root . chown -R root:root .
find . \ find . \
@ -51,16 +54,16 @@ find . \
make all PREFIX=/usr make all PREFIX=/usr
# Installation # Installation
make install DESTDIR=$PKG PREFIX=/usr make install DESTDIR="$PKG" PREFIX=/usr
# # Cleaning # Cleaning
# cd $PKG cd "$PKG" || exit 1
# find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find -0 . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
# find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find -0 . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
cd $PKG cd "$PKG" || exit 1
[ -d $PKG$PREFIX/man ] && find $PKG$PREFIX/man -type f -name "*.?" -exec gzip -9 {} \; [ -d "$PKG$PREFIX"/man ] && find "$PKG$PREFIX"/man -type f -name "*.?" -exec gzip -9 {} \;
chown -R root:root . chown -R root:root .
find . \ find . \
@ -86,4 +89,4 @@ $PRGNAM: https://github.com/${GITHUB_REPO}
EOF EOF
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz /sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PRGNAM-$(echo "$VERSION" | tr -d '-')-$ARCH-$BUILD$TAG.txz"