aboutsummaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-01-20 09:14:41 -0800
committerJohn MacFarlane <[email protected]>2023-01-20 09:14:41 -0800
commitadf9e9088d08fa00c0b560240b83327724b78846 (patch)
treec803b38a2ae4f3c8672148713e6960e3bde920bb /linux
parente680aa18e274d422a662dc919a3cefc3c1bea505 (diff)
Apply shellcheck improvements to make_artifacts.sh.
Diffstat (limited to 'linux')
-rw-r--r--linux/make_artifacts.sh76
1 files changed, 32 insertions, 44 deletions
diff --git a/linux/make_artifacts.sh b/linux/make_artifacts.sh
index d90516958..cda402e2c 100644
--- a/linux/make_artifacts.sh
+++ b/linux/make_artifacts.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
set -e
CABALOPTS="-f-export-dynamic -fembed_data_files --enable-executable-static -j4"
@@ -15,14 +16,6 @@ esac
ARTIFACTS="${ARTIFACTS:-/artifacts}"
-# This is our sentinel that tells us when we're done.
-rm -f $ARTIFACTS/DONE
-
-clean_up() {
- echo "All done!" > "$ARTIFACTS/DONE"
-}
-trap clean_up EXIT
-
# build binaries
cabal --version
@@ -30,15 +23,14 @@ ghc --version
cabal update
cabal clean
-cabal build $CABALOPTS --ghc-options="$GHCOPTS" all
-cabal test $CABALOPTS --ghc-options="$GHCOPTS" all
-for f in $(find dist-newstyle -name 'pandoc' -type f -perm /400); do cp $f $ARTIFACTS/; done
+cabal test "$CABALOPTS" --ghc-options="$GHCOPTS" all
+cabal install "$CABALOPTS" --ghc-options="$GHCOPTS" --install-method=copy --installdir="$ARTIFACTS" pandoc-cli
# Confirm that we have static builds
-file $ARTIFACTS/pandoc | grep "statically linked"
+file "$ARTIFACTS/pandoc" | grep "statically linked"
make_deb() {
- VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
+ VERSION=$("$ARTIFACTS"/pandoc --version | awk '{print $2; exit;}')
REVISION=${REVISION:-1}
DEBVER=$VERSION-$REVISION
BASE=pandoc-$DEBVER-$ARCHITECTURE
@@ -47,60 +39,56 @@ make_deb() {
COPYRIGHT=$DEST/share/doc/pandoc/copyright
cd /mnt
- mkdir -p $DEST/bin
- mkdir -p $DEST/share/man/man1
- mkdir -p $DEST/share/doc/pandoc
+ mkdir -p "$DEST/bin"
+ mkdir -p "$DEST/share/man/man1"
+ mkdir -p "$DEST/share/doc/pandoc"
- find $DIST -type d | xargs chmod 755
- cp $ARTIFACTS/pandoc $DEST/bin/
- cd $DEST/bin
+ find "$DIST" -type d -exec chmod 755 {} \;
+ cp "$ARTIFACTS/pandoc" "$DEST/bin/"
+ cd "$DEST/bin"
strip pandoc
ln -s pandoc pandoc-server
ln -s pandoc pandoc-lua
cd /mnt
for manpage in pandoc.1 pandoc-lua.1 pandoc-server.1
do
- cp /mnt/man/$manpage $DEST/share/man/man1/$manpage
- gzip -9 $DEST/share/man/man1/$manpage
+ cp /mnt/man/$manpage "$DEST/share/man/man1/$manpage"
+ gzip -9 "$DEST/share/man/man1/$manpage"
done
- cp /mnt/COPYRIGHT $COPYRIGHT
- echo "" >> $COPYRIGHT
+ cp /mnt/COPYRIGHT "$COPYRIGHT"
+ echo "" >> "$COPYRIGHT"
- INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}')
- mkdir $DIST/DEBIAN
+ INSTALLED_SIZE=$(du -k -s "$DEST" | awk '{print $1}')
+ mkdir "$DIST/DEBIAN"
perl -pe "s/VERSION/$DEBVER/" /mnt/linux/control.in | \
perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \
perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
- > $DIST/DEBIAN/control
+ > "$DIST/DEBIAN/control"
# we limit compression to avoid OOM error
- fakeroot dpkg-deb -Zgzip -z9 --build $DIST
- rm -rf $DIST
- cp $BASE.deb $ARTIFACTS/
+ fakeroot dpkg-deb -Zgzip -z9 --build "$DIST"
+ rm -rf "$DIST"
+ cp "$BASE.deb" "$ARTIFACTS/"
}
# Make tarball for pandoc
make_tarball() {
TARGET=pandoc-$VERSION
- cd $ARTIFACTS
- rm -rf $TARGET
- mkdir $TARGET
- mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
- cp /mnt/man/pandoc.1 $TARGET/share/man/man1
- cp /mnt/man/pandoc-server.1 $TARGET/share/man/man1
- cp /mnt/man/pandoc-lua.1 $TARGET/share/man/man1
- mv pandoc $TARGET/bin
- cd $TARGET/bin
+ cd "$ARTIFACTS"
+ rm -rf "$TARGET"
+ mkdir "$TARGET"
+ mkdir "$TARGET/bin" "$TARGET/share" "$TARGET/share/man" "$TARGET/share/man/man1"
+ cp /mnt/man/pandoc.1 /mnt/man/pandoc-server.1 /mnt/man/pandoc-lua.1 "$TARGET/share/man/man1"
+ gzip -9 "$TARGET/share/man/man1/*.1"
+ mv pandoc "$TARGET/bin"
+ cd "$TARGET/bin"
strip pandoc
ln -s pandoc pandoc-server
ln -s pandoc pandoc-lua
- cd $ARTIFACTS
- gzip -9 $TARGET/share/man/man1/pandoc.1
- gzip -9 $TARGET/share/man/man1/pandoc-server.1
- gzip -9 $TARGET/share/man/man1/pandoc-lua.1
+ cd "$ARTIFACTS"
- tar cvzf $TARGET-linux-$ARCHITECTURE.tar.gz $TARGET
- rm -r $TARGET
+ tar cvzf "$TARGET-linux-$ARCHITECTURE.tar.gz" "$TARGET"
+ rm -r "$TARGET"
}
make_deb