Scripts: Cleanups and POSIX compliance

- Makes all scripts POSIX-compliant
- General formatting and such
- shellcheck :)

Shell script is love. Shell script is life.

Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter committed 2026-01-26 23:53:33 -05:00
1 parent 1b18f85e42
commit 14791ce7eb
7 files changed
+57 -66

No files matched your search

+8 -18
View File
@@ -1,26 +1,16 @@
#!/bin/sh
for binfmt in "$@"
do
for binfmt in "$@"; do
result=0
if command -v update-binfmts>/dev/null; then
update-binfmts --find "$binfmt" 1>&- 2>&-
if [ $? -eq 0 ]
then
# If we found the binfmt_misc file passed in then error
result=1
fi
if command -v update-binfmts >/dev/null; then
# If we found the binfmt_misc file passed in then error
update-binfmts --find "$binfmt" 1>&- 2>&- && result=1
fi
if [ $result -eq 0 ]
then
if [ -f "$binfmt" ]; then
# If the binfmt_misc file exists then error
result=1
fi
fi
# If the binfmt_misc file exists then error
[ -f "$binfmt" ] && result=1
if [ $result -eq 1 ]
then
if [ $result -eq 1 ]; then
echo "==============================================================="
echo "$binfmt binfmt file is installed!"
echo "This conflicts with FEX-Emu's binfmt_misc!"
+23 -21
View File
@@ -1,31 +1,33 @@
#!/bin/bash
#!/bin/sh
FEX=${1:-FEXLoader}
echo Using $FEX
echo "Using $FEX"
for fileid in ~/.fex-emu/aotir/*.path; do
filename=`cat "$fileid"`
filename=$(cat "$fileid")
args=""
if [ "${fileid: -6 : 1}" == "L" ]; then
args="$args --abilocalflags"
else
args="$args --no-abilocalflags"
fi
if [ "${fileid: -7 : 1}" == "T" ]; then
args="$args --tsoenabled"
else
args="$args --no-tsoenabled"
fi
# if L is 6 chars from the end, use localflags
case $fileid in
*L?????) _abi=--abilocalflags ;;
*) _abi=--no-abilocalflags ;;
esac
if [ "${fileid: -8 : 1}" == "S" ]; then
args="$args --smc=full"
else
args="$args --smc=mman"
fi
# if T is 7 chars from the end, use tso
case $fileid in
*T??????) _tso=--tsoenabled ;;
*) _tso=--no-tsoenabled ;;
esac
# if S is 8 chars from the end, use full smc
case $fileid in
*S???????) _smc=full ;;
*) _smc=mman ;;
esac
if [ -f "${fileid%.path}.aotir" ]; then
echo "`basename $fileid` has already been generated"
echo "$(basename "$fileid") has already been generated"
else
echo "Processing `basename $fileid` ($filename) with $args"
$FEX --aotirgenerate $args "$filename"
echo "Processing $(basename "$fileid") ($filename) with $args"
$FEX --aotirgenerate "$_abi" "$_tso" --smc="$_smc" "$filename"
fi
done
+6 -5
View File
@@ -1,7 +1,8 @@
#!/bin/env bash
if [ "$#" -ne 2 ];
then
echo "$0: <PEV-TAG> <NEXT-TAG>"
exit -1
#!/bin/sh
if [ "$#" -ne 2 ]; then
echo "$0: <PEV-TAG> <NEXT-TAG>"
exit 255
fi
git log "$1..HEAD" --pretty="%b (%h)" --abbrev-commit --merges | Scripts/changelog_generator.py "$2"
+7 -6
View File
@@ -1,11 +1,12 @@
#!/bin/env bash
echo \# `git describe --always`
#!/bin/sh
echo "# $(git describe --always)"
echo
./Scripts/doc_outline_generator.py "`pwd`" "`pwd`/FEXCore" "../"
./Scripts/doc_outline_generator.py "`pwd`" "`pwd`/ThunkLibs" "../"
./Scripts/doc_outline_generator.py "`pwd`" "`pwd`/Source/Tests" "../"
./Scripts/doc_outline_generator.py "`pwd`" "`pwd`/unittests" "../"
./Scripts/doc_outline_generator.py "$(pwd)" "$(pwd)/FEXCore" "../"
./Scripts/doc_outline_generator.py "$(pwd)" "$(pwd)/ThunkLibs" "../"
./Scripts/doc_outline_generator.py "$(pwd)" "$(pwd)/Source/Tests" "../"
./Scripts/doc_outline_generator.py "$(pwd)" "$(pwd)/unittests" "../"
# These don't have useful documentation at this point
#./Scripts/doc_outline_generator.py "`pwd`" "`pwd`/Scripts" "../"
+7 -9
View File
@@ -1,30 +1,28 @@
#!/bin/env bash
#!/bin/sh
# Allow release maintainer to override PREVIOUS and CURRENT by setting it before launching the script
PREVIOUS=${PREVIOUS:-FEX-$(date --date='-1 month' +%y%m)}
CURRENT=${CURRENT:-FEX-$(date +%y%m)}
if ! git rev-list $PREVIOUS > /dev/null 2>&1 ;
then
if ! git rev-list "$PREVIOUS" > /dev/null 2>&1 ; then
echo "$PREVIOUS tag doesn't exist"
exit
fi
if git rev-list $CURRENT > /dev/null 2>&1 ;
then
if git rev-list "$CURRENT" > /dev/null 2>&1 ; then
echo "$CURRENT tag already exists!"
exit
fi
echo "Tagging $CURRENT, previous release $PREVIOUS"
echo "Press cltr-c to cancel within 10 seconds"
echo "Press Ctrl-C to cancel within 10 seconds"
sleep 10
git tag $CURRENT -a -m "temporary"
git tag "$CURRENT" -a -m "temporary"
Scripts/generate_doc_outline.sh > docs/SourceOutline.md
git commit docs/SourceOutline.md -m "Docs: Update for release $CURRENT"
git tag -d $CURRENT
git tag -a $CURRENT -m "$(Scripts/generate_changelog.sh $PREVIOUS $CURRENT)" --edit
git tag -d "$CURRENT"
git tag -a "$CURRENT" -m "$(Scripts/generate_changelog.sh "$PREVIOUS" "$CURRENT")" --edit
echo "Inspect if everything went smoothly via 'git log -6 $CURRENT' "
echo "if all is good, do 'git push upstream $CURRENT'"
+5 -5
View File
@@ -1,4 +1,4 @@
#! /bin/bash
#!/bin/sh -e
# Save current directory
DIR=$(pwd)
@@ -7,7 +7,7 @@ DIR=$(pwd)
CHANGED_ONLY=false
TARGET_DIR=""
while [[ $# -gt 0 ]]; do
while [ $# -gt 0 ]; do
case $1 in
--changed) # Only reformat changed files (staged and unstaged)
CHANGED_ONLY=true
@@ -35,13 +35,13 @@ if [ "$CHANGED_ONLY" = true ]; then
CHANGED_FILES=$(git ls-files -m '*.cpp' '*.h' '*.inl')
if [ -n "$CHANGED_FILES" ]; then
echo "$CHANGED_FILES" | xargs -d '\n' -n 1 -P $(nproc) clang-format-19 -i
echo "$CHANGED_FILES" | xargs -d '\n' -n 1 -P "$(nproc)" clang-format-19 -i
else
echo "No changed files to format."
fi
else
# Reformat whole tree (original behavior)
git ls-files -z '*.cpp' '*.h' '*.inl' | xargs -0 -n 1 -P $(nproc) clang-format-19 -i
git ls-files -z '*.cpp' '*.h' '*.inl' | xargs -0 -n 1 -P "$(nproc)" clang-format-19 -i
fi
cd $DIR
cd "$DIR"
+1 -2
View File
@@ -1,5 +1,4 @@
#! /bin/bash
set -e
#!/bin/sh -e
# Make sure we actually build
ninja