shellchecked

This commit is contained in:
Gwenhael Le Moine 2024-04-16 09:22:45 +02:00
parent 9fe3c03d28
commit 6f554d4036
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -3,13 +3,12 @@ set -x
CWD=$(pwd)
PRGNAM=$(basename $CWD)
PRGNAM=$(basename "$CWD")
BUILD=1
VERSION=${VERSION:-latest}
ARCH=$(uname -m)
LIBSUFFIX=$(echo $ARCH | grep -o "\(64\)")
TAG=gwh
OUTPUT=/tmp
@ -23,21 +22,21 @@ PREFIX=/usr
mkdir -p $TMP
# Cleaning
rm -fr $TMP/$PRGNAM $PKG
rm -fr "${TMP:?}"/"$PRGNAM" "$PKG"
# Fetching sources
[ ! -e $REPOSITORY ] && git clone https://codeberg.org/gwh/hpemung.git $REPOSITORY
cd $REPOSITORY
[ ! -e "$REPOSITORY" ] && git clone https://codeberg.org/gwh/hpemung.git "$REPOSITORY"
cd "$REPOSITORY" || exit 1
git pull --all
cp -R $REPOSITORY $TMP/$PRGNAM
cp -R "$REPOSITORY" "$TMP"/"$PRGNAM"
# Preparation
cd $TMP/$PRGNAM
cd "$TMP"/"$PRGNAM" || exit 1
[ "x$VERSION" == "xlatest" ] && VERSION=$(git describe --tags --abbrev=0)
[ "x$VERSION" == "x" ] && VERSION=trunk
[ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION
[ "$VERSION" == "latest" ] && VERSION=$(git describe --tags --abbrev=0)
[ "$VERSION" == "" ] && VERSION=trunk
[ "$VERSION" == "trunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout "$VERSION"
chown -R root:root .
find . \
@ -50,16 +49,16 @@ find . \
make all PREFIX=/usr
# Installation
make install DESTDIR=$PKG PREFIX=/usr
make install DESTDIR="$PKG" PREFIX=/usr
# # Cleaning
# cd $PKG
# find . | 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
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 .
find . \
@ -74,7 +73,7 @@ cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (HP48 emulator)
$PRGNAM:
$PRGNAM: hpemung is an emulator of the Saturn Processor and the I/O of an
$PRGNAM: HP48 calculator. There is a debugger for the Saturn Processor.
$PRGNAM: HP 48G/GX calculator.
$PRGNAM:
$PRGNAM: initialization:
$PRGNAM: $ $PREFIX/share/$PRGNAM/setup-hpemung-home.sh
@ -84,5 +83,4 @@ $PRGNAM: https://codeberg.org/gwh/hpemung.git
$PRGNAM:
EOF
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