diff --git a/Scripts/CheckBinfmtNotInstall.sh b/Scripts/CheckBinfmtNotInstall.sh index f40660146..ab2ca70af 100755 --- a/Scripts/CheckBinfmtNotInstall.sh +++ b/Scripts/CheckBinfmtNotInstall.sh @@ -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!" diff --git a/Scripts/FEXUpdateAOTIRCache.sh b/Scripts/FEXUpdateAOTIRCache.sh index f674a5182..70fbeef2c 100755 --- a/Scripts/FEXUpdateAOTIRCache.sh +++ b/Scripts/FEXUpdateAOTIRCache.sh @@ -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 diff --git a/Scripts/generate_changelog.sh b/Scripts/generate_changelog.sh index 49cb400a4..74dd28054 100755 --- a/Scripts/generate_changelog.sh +++ b/Scripts/generate_changelog.sh @@ -1,7 +1,8 @@ -#!/bin/env bash -if [ "$#" -ne 2 ]; -then -echo "$0: " -exit -1 +#!/bin/sh + +if [ "$#" -ne 2 ]; then + echo "$0: " + exit 255 fi + git log "$1..HEAD" --pretty="%b (%h)" --abbrev-commit --merges | Scripts/changelog_generator.py "$2" diff --git a/Scripts/generate_doc_outline.sh b/Scripts/generate_doc_outline.sh index 40bdec606..a6eabe663 100755 --- a/Scripts/generate_doc_outline.sh +++ b/Scripts/generate_doc_outline.sh @@ -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" "../" diff --git a/Scripts/generate_release.sh b/Scripts/generate_release.sh index ca7fc2ce9..11dd27217 100755 --- a/Scripts/generate_release.sh +++ b/Scripts/generate_release.sh @@ -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'" diff --git a/Scripts/reformat.sh b/Scripts/reformat.sh index 7eb6bc01a..41087a072 100755 --- a/Scripts/reformat.sh +++ b/Scripts/reformat.sh @@ -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" diff --git a/Scripts/update_instcountci.sh b/Scripts/update_instcountci.sh index f03872d2d..31213df43 100755 --- a/Scripts/update_instcountci.sh +++ b/Scripts/update_instcountci.sh @@ -1,5 +1,4 @@ -#! /bin/bash -set -e +#!/bin/sh -e # Make sure we actually build ninja