Skip to content

Commit

Permalink
Make mkdist.sh more portable
Browse files Browse the repository at this point in the history
  • Loading branch information
jangler committed Mar 27, 2024
1 parent 3f7cb28 commit 4046583
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions misc/mkdist.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env bash

# puts together a release folder for a target GOOS.
# requires dos2unix and either util-linux rename or perl rename.
# requires dos2unix.
# cross-compilation not currently supported.

set -euo pipefail
IFS=$'\t\n'

if [ "$(basename $(pwd))" == misc ]; then
echo "error: run this script from the parent directory."
Expand Down Expand Up @@ -34,13 +35,12 @@ mkdir -p "$dir"
mv ftone* "$dir"
cp -r assets docs faunatone/config README.md "$dir"
cd "$dir"
if [[ $(rename --version) == *util-linux* ]]; then
rename ftone faunatone ftone*
rename .md .txt *.md docs/*.md
else
rename s/ftone/faunatone/ ftone*
rename s/.md/.txt/ *.md docs/*.md
fi
for f in ftone*; do
mv "$f" "${f/ftone/faunatone}"
done
for f in *.md docs/*.md; do
mv "$f" "${f%.md}.txt"
done
if [ "$GOOS" == windows ]; then
unix2dos *.txt docs/*.txt config/* config/keymaps/*
fi
Expand Down

0 comments on commit 4046583

Please sign in to comment.