diff --git a/.ci/android/build.sh b/.ci/android/build.sh index 1fb721b3b2..352e9b8b3f 100755 --- a/.ci/android/build.sh +++ b/.ci/android/build.sh @@ -1,11 +1,12 @@ #!/bin/bash -e -# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-FileCopyrightText: 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later -export NDK_CCACHE=$(which ccache) +NDK_CCACHE=$(which ccache) +export NDK_CCACHE -if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then +if [ -n "${ANDROID_KEYSTORE_B64}" ]; then export ANDROID_KEYSTORE_FILE="${GITHUB_WORKSPACE}/ks.jks" base64 --decode <<< "${ANDROID_KEYSTORE_B64}" > "${ANDROID_KEYSTORE_FILE}" fi @@ -16,6 +17,6 @@ chmod +x ./gradlew ./gradlew assembleRelease ./gradlew bundleRelease -if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then +if [ -n "${ANDROID_KEYSTORE_B64}" ]; then rm "${ANDROID_KEYSTORE_FILE}" fi diff --git a/.ci/android/package.sh b/.ci/android/package.sh index c2eb975a02..427d6cd365 100755 --- a/.ci/android/package.sh +++ b/.ci/android/package.sh @@ -1,6 +1,6 @@ #!/bin/sh -# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-FileCopyrightText: 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later GITDATE="$(git show -s --date=short --format='%ad' | sed 's/-//g')" diff --git a/.ci/license-header.sh b/.ci/license-header.sh index 3d4929d1c1..6cd62a3bbc 100755 --- a/.ci/license-header.sh +++ b/.ci/license-header.sh @@ -1,24 +1,48 @@ #!/bin/sh -e +# SPDX-FileCopyrightText: 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then + echo + echo "license-header.sh: Eden License Headers Accreditation Script" + echo + echo "This script checks and optionally fixes license headers in source and CMake files." + echo + echo "Environment Variables:" + echo " FIX=true Automatically add the correct license headers to offending files." + echo " COMMIT=true If FIX=true, commit the changes automatically." + echo + echo "Usage Examples:" + echo " # Just check headers (will fail if headers are missing)" + echo " .ci/license-header.sh" + echo + echo " # Fix headers only" + echo " FIX=true .ci/license-header.sh" + echo + echo " # Fix headers and commit changes" + echo " FIX=true COMMIT=true .ci/license-header.sh" + exit 0 +fi + HEADER="$(cat "$PWD/.ci/license/header.txt")" HEADER_HASH="$(cat "$PWD/.ci/license/header-hash.txt")" -echo "Getting branch changes" +echo +echo "license-header.sh: Getting branch changes" -# BRANCH=`git rev-parse --abbrev-ref HEAD` -# COMMITS=`git log ${BRANCH} --not master --pretty=format:"%h"` -# RANGE="${COMMITS[${#COMMITS[@]}-1]}^..${COMMITS[0]}" -# FILES=`git diff-tree --no-commit-id --name-only ${RANGE} -r` - -BASE=`git merge-base master HEAD` -FILES=`git diff --name-only $BASE` - -#FILES=$(git diff --name-only master) - -echo "Done" +BRANCH=$(git rev-parse --abbrev-ref HEAD) +COMMITS=$(git log "${BRANCH}" --not master --pretty=format:"%h") +if [ -z "$COMMITS" ]; then + echo + echo "license-header.sh: No commits on this branch different from master." + exit 0 +fi +RANGE="$(echo "$COMMITS" | tail -n1)^..$(echo "$COMMITS" | head -n1)" +FILES=$(git diff-tree --no-commit-id --name-only "${RANGE}" -r) check_header() { - CONTENT="`head -n3 < $1`" + CONTENT=$(head -n3 < "$1") case "$CONTENT" in "$HEADER"*) ;; *) BAD_FILES="$BAD_FILES $1" ;; @@ -26,18 +50,17 @@ check_header() { } check_cmake_header() { - CONTENT="`head -n3 < $1`" - + CONTENT=$(head -n3 < "$1") case "$CONTENT" in "$HEADER_HASH"*) ;; - *) - BAD_CMAKE="$BAD_CMAKE $1" ;; + *) BAD_CMAKE="$BAD_CMAKE $1" ;; esac } + for file in $FILES; do [ -f "$file" ] || continue - if [ `basename -- "$file"` = "CMakeLists.txt" ]; then + if [ "$(basename -- "$file")" = "CMakeLists.txt" ]; then check_cmake_header "$file" continue fi @@ -53,18 +76,20 @@ for file in $FILES; do esac done -if [ "$BAD_FILES" = "" ] && [ "$BAD_CMAKE" = "" ]; then +if [ -z "$BAD_FILES" ] && [ -z "$BAD_CMAKE" ]; then echo - echo "All good." - - exit + echo "license-header.sh: All good!" + exit 0 fi -if [ "$BAD_FILES" != "" ]; then - echo "The following source files have incorrect license headers:" +if [ -n "$BAD_FILES" ]; then echo + echo "license-header.sh: The following source files have incorrect license headers:" - for file in $BAD_FILES; do echo $file; done + echo + for file in $BAD_FILES; do + echo " - $file" + done cat << EOF @@ -78,11 +103,14 @@ EOF fi -if [ "$BAD_CMAKE" != "" ]; then - echo "The following CMake files have incorrect license headers:" +if [ -n "$BAD_CMAKE" ]; then echo + echo "license-header.sh: The following CMake files have incorrect license headers:" - for file in $BAD_CMAKE; do echo $file; done + echo + for file in $BAD_CMAKE; do + echo " - $file" + done cat << EOF @@ -104,42 +132,41 @@ EOF if [ "$FIX" = "true" ]; then echo - echo "FIX set to true. Fixing headers." - echo + echo "license-header.sh: FIX set to true, fixing headers..." for file in $BAD_FILES; do - cat $file > $file.bak + cp -- "$file" "$file.bak" - cat .ci/license/header.txt > $file - echo >> $file - cat $file.bak >> $file + cat .ci/license/header.txt > "$file" + echo >> "$file" + cat "$file.bak" >> "$file" - rm $file.bak - - git add $file + rm -- "$file.bak" + git add "$file" done for file in $BAD_CMAKE; do - cat $file > $file.bak + cp -- "$file" "$file.bak" - cat .ci/license/header-hash.txt > $file - echo >> $file - cat $file.bak >> $file + cat .ci/license/header-hash.txt > "$file" + echo >> "$file" + cat "$file.bak" >> "$file" - rm $file.bak - - git add $file + rm -- "$file.bak" + git add "$file" done - echo "License headers fixed." + + echo + echo "license-header.sh: License headers fixed!" if [ "$COMMIT" = "true" ]; then echo - echo "COMMIT set to true. Committing changes." + echo "license-header.sh: COMMIT set to true, committing changes..." + + git commit -m "[license] Fix license headers" + echo - - git commit -m "Fix license headers" - - echo "Changes committed. You may now push." + echo "license-header.sh: Changes committed. You may now push." fi else exit 1 diff --git a/.ci/linux/build.sh b/.ci/linux/build.sh index 8e3a452809..014e83db2d 100755 --- a/.ci/linux/build.sh +++ b/.ci/linux/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-FileCopyrightText: 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later case "$1" in @@ -87,7 +87,7 @@ if [ -z "$BUILD_TYPE" ]; then export BUILD_TYPE="Release" fi -export EXTRA_CMAKE_FLAGS=("${EXTRA_CMAKE_FLAGS[@]}" $@) +export EXTRA_CMAKE_FLAGS=("${EXTRA_CMAKE_FLAGS[@]}" "$@") mkdir -p build && cd build cmake .. -G Ninja \ @@ -107,7 +107,7 @@ cmake .. -G Ninja \ -DDYNARMIC_ENABLE_LTO=ON \ "${EXTRA_CMAKE_FLAGS[@]}" -ninja -j${NPROC} +ninja -j"${NPROC}" if [ -d "bin/Release" ]; then strip -s bin/Release/* diff --git a/.ci/linux/package.sh b/.ci/linux/package.sh index 837cfe07ef..71c87e1248 100755 --- a/.ci/linux/package.sh +++ b/.ci/linux/package.sh @@ -1,12 +1,13 @@ #!/bin/sh -e -# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-FileCopyrightText: 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later # This script assumes you're in the source directory export APPIMAGE_EXTRACT_AND_RUN=1 -export BASE_ARCH="$(uname -m)" +BASE_ARCH="$(uname -m)" +export BASE_ARCH SHARUN="https://github.com/VHSgunzo/sharun/releases/latest/download/sharun-${BASE_ARCH}-aio" URUNTIME="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-${BASE_ARCH}" @@ -36,24 +37,26 @@ case "$1" in echo "Packaging armv9-a build of Eden" ARCH=armv9 ;; - native) + native) echo "Packaging native build of Eden" ARCH="$BASE_ARCH" ;; - + *) + echo "Unknown target: $1" + exit 1 + ;; esac export BUILDDIR="$2" -if [ "$BUILDDIR" = '' ] -then - BUILDDIR=build +if [ -z "$BUILDDIR" ]; then + BUILDDIR=build fi EDEN_TAG=$(git describe --tags --abbrev=0) echo "Making \"$EDEN_TAG\" build" # git checkout "$EDEN_TAG" -VERSION="$(echo "$EDEN_TAG")" +VERSION="$EDEN_TAG" # NOW MAKE APPIMAGE mkdir -p ./AppDir @@ -67,21 +70,19 @@ ln -sf ./dev.eden_emu.eden.svg ./.DirIcon UPINFO='gh-releases-zsync|eden-emulator|Releases|latest|*.AppImage.zsync' if [ "$DEVEL" = 'true' ]; then - sed -i 's|Name=Eden|Name=Eden Nightly|' ./dev.eden_emu.eden.desktop - UPINFO="$(echo "$UPINFO" | sed 's|Releases|nightly|')" + sed -i 's|Name=Eden|Name=Eden Nightly|' ./dev.eden_emu.eden.desktop + UPINFO="$(echo "$UPINFO" | sed 's|Releases|nightly|')" fi LIBDIR="/usr/lib" # Workaround for Gentoo -if [ ! -d "$LIBDIR/qt6" ] -then - LIBDIR="/usr/lib64" +if [ ! -d "$LIBDIR/qt6" ]; then + LIBDIR="/usr/lib64" fi # Workaround for Debian -if [ ! -d "$LIBDIR/qt6" ] -then +if [ ! -d "$LIBDIR/qt6" ]; then LIBDIR="/usr/lib/${BASE_ARCH}-linux-gnu" fi @@ -90,40 +91,38 @@ fi wget --retry-connrefused --tries=30 "$SHARUN" -O ./sharun-aio chmod +x ./sharun-aio xvfb-run -a ./sharun-aio l -p -v -e -s -k \ - ../$BUILDDIR/bin/eden* \ - $LIBDIR/lib*GL*.so* \ - $LIBDIR/dri/* \ - $LIBDIR/vdpau/* \ - $LIBDIR/libvulkan* \ - $LIBDIR/libXss.so* \ - $LIBDIR/libdecor-0.so* \ - $LIBDIR/libgamemode.so* \ - $LIBDIR/qt6/plugins/audio/* \ - $LIBDIR/qt6/plugins/bearer/* \ - $LIBDIR/qt6/plugins/imageformats/* \ - $LIBDIR/qt6/plugins/iconengines/* \ - $LIBDIR/qt6/plugins/platforms/* \ - $LIBDIR/qt6/plugins/platformthemes/* \ - $LIBDIR/qt6/plugins/platforminputcontexts/* \ - $LIBDIR/qt6/plugins/styles/* \ - $LIBDIR/qt6/plugins/xcbglintegrations/* \ - $LIBDIR/qt6/plugins/wayland-*/* \ - $LIBDIR/pulseaudio/* \ - $LIBDIR/pipewire-0.3/* \ - $LIBDIR/spa-0.2/*/* \ - $LIBDIR/alsa-lib/* - -rm -f ./sharun-aio + ../"$BUILDDIR"/bin/eden* \ + "$LIBDIR"/lib*GL*.so* \ + "$LIBDIR"/dri/* \ + "$LIBDIR"/vdpau/* \ + "$LIBDIR"/libvulkan* \ + "$LIBDIR"/libXss.so* \ + "$LIBDIR"/libdecor-0.so* \ + "$LIBDIR"/libgamemode.so* \ + "$LIBDIR"/qt6/plugins/audio/* \ + "$LIBDIR"/qt6/plugins/bearer/* \ + "$LIBDIR"/qt6/plugins/imageformats/* \ + "$LIBDIR"/qt6/plugins/iconengines/* \ + "$LIBDIR"/qt6/plugins/platforms/* \ + "$LIBDIR"/qt6/plugins/platformthemes/* \ + "$LIBDIR"/qt6/plugins/platforminputcontexts/* \ + "$LIBDIR"/qt6/plugins/styles/* \ + "$LIBDIR"/qt6/plugins/xcbglintegrations/* \ + "$LIBDIR"/qt6/plugins/wayland-*/* \ + "$LIBDIR"/pulseaudio/* \ + "$LIBDIR"/pipewire-0.3/* \ + "$LIBDIR"/spa-0.2/*/* \ + "$LIBDIR"/alsa-lib/* # Prepare sharun if [ "$ARCH" = 'aarch64' ]; then - # allow the host vulkan to be used for aarch64 given the sad situation - echo 'SHARUN_ALLOW_SYS_VKICD=1' > ./.env + # allow the host vulkan to be used for aarch64 given the sad situation + echo 'SHARUN_ALLOW_SYS_VKICD=1' > ./.env fi # Workaround for Gentoo if [ -d "shared/libproxy" ]; then - cp shared/libproxy/* lib/ + cp shared/libproxy/* lib/ fi ln -f ./sharun ./AppRun @@ -134,20 +133,20 @@ cd .. wget -q "$URUNTIME" -O ./uruntime chmod +x ./uruntime -#Add udpate info to runtime +# Add update info to runtime echo "Adding update information \"$UPINFO\" to runtime..." ./uruntime --appimage-addupdinfo "$UPINFO" echo "Generating AppImage..." ./uruntime --appimage-mkdwarfs -f \ - --set-owner 0 --set-group 0 \ - --no-history --no-create-timestamp \ - --categorize=hotness --hotness-list=.ci/linux/eden.dwfsprof \ - --compression zstd:level=22 -S26 -B32 \ - --header uruntime \ + --set-owner 0 --set-group 0 \ + --no-history --no-create-timestamp \ + --categorize=hotness --hotness-list=.ci/linux/eden.dwfsprof \ + --compression zstd:level=22 -S26 -B32 \ + --header uruntime \ -N 4 \ - -i ./AppDir -o Eden-"$VERSION"-"$ARCH".AppImage + -i ./AppDir -o "Eden-$VERSION-$ARCH.AppImage" echo "Generating zsync file..." -zsyncmake *.AppImage -u *.AppImage -echo "All Done!" \ No newline at end of file +zsyncmake ./*.AppImage -u ./*.AppImage +echo "All Done!" diff --git a/.ci/source.sh b/.ci/source.sh index cbdacd1cd7..a1d602c61f 100755 --- a/.ci/source.sh +++ b/.ci/source.sh @@ -1,10 +1,13 @@ #!/bin/bash -ex +# SPDX-FileCopyrightText: 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + # git-archive-all export PATH="$PATH:/home/$USER/.local/bin" -GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" -GITREV="`git show -s --format='%h'`" +GITDATE="$(git show -s --date=short --format='%ad' | sed 's/-//g')" +GITREV="$(git show -s --format='%h')" REV_NAME="eden-unified-source-${GITDATE}-${GITREV}" COMPAT_LIST='dist/compatibility_list/compatibility_list.json' diff --git a/.ci/translate.sh b/.ci/translate.sh index 55104b7c76..d840cab652 100755 --- a/.ci/translate.sh +++ b/.ci/translate.sh @@ -1,11 +1,14 @@ #!/bin/sh +# SPDX-FileCopyrightText: 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + for i in dist/languages/*.ts; do SRC=en_US - TARGET=`head -n1 $i | awk -F 'language="' '{split($2, a, "\""); print a[1]}'` + TARGET=$(head -n1 "$i" | awk -F 'language="' '{split($2, a, "\""); print a[1]}') # requires fd - SOURCES=`fd . src/yuzu -tf -e ui -e cpp -e h -e plist` + SOURCES=$(fd . src/yuzu -tf -e ui -e cpp -e h -e plist) - lupdate -source-language $SRC -target-language $TARGET $SOURCES -ts /data/code/eden/$i + lupdate -source-language $SRC -target-language "$TARGET" "$SOURCES" -ts /data/code/eden/"$i" done diff --git a/.ci/update-icons.sh b/.ci/update-icons.sh index 4feb2abd24..f77bfce376 100755 --- a/.ci/update-icons.sh +++ b/.ci/update-icons.sh @@ -1,21 +1,35 @@ #!/bin/sh -e -# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-FileCopyrightText: 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later -which png2icns || [ which yay && yay libicns ] || exit -which magick || exit +# Check dependencies +for cmd in png2icns magick svgo; do + if ! which "$cmd" >/dev/null 2>&1; then + pkg="$cmd" + case "$cmd" in + png2icns) pkg="icnsutils" ;; + magick) pkg="imagemagick" ;; + esac + echo "Error: command '$cmd' not found. Install the package '$pkg'." + exit 1 + fi +done export EDEN_SVG_ICO="dist/dev.eden_emu.eden.svg" -svgo --multipass $EDEN_SVG_ICO +TMP_PNG="$(mktemp /tmp/eden-tmp-XXXXXX.png)" -magick -density 256x256 -background transparent $EDEN_SVG_ICO \ - -define icon:auto-resize -colors 256 dist/eden.ico || exit -convert -density 256x256 -resize 256x256 -background transparent $EDEN_SVG_ICO \ - dist/yuzu.bmp || exit +svgo --multipass "$EDEN_SVG_ICO" -export TMP_PNG="dist/eden-tmp.png" -magick -size 1024x1024 -background transparent $EDEN_SVG_ICO $TMP_PNG || exit -png2icns dist/eden.icns $TMP_PNG || exit -cp dist/eden.icns dist/yuzu.icns -rm $TMP_PNG +magick \ + -density 256x256 -background transparent "$EDEN_SVG_ICO" \ + -define icon:auto-resize -colors 256 "dist/eden.ico" + +magick "$EDEN_SVG_ICO" -resize 256x256 -background transparent "dist/yuzu.bmp" + +magick -size 1024x1024 -background transparent "$EDEN_SVG_ICO" "$TMP_PNG" + +png2icns "dist/eden.icns" "$TMP_PNG" + +cp "dist/eden.icns" "dist/yuzu.icns" +rm -f "$TMP_PNG" diff --git a/.ci/windows/build.sh b/.ci/windows/build.sh index a0ab69a440..51cbb82c0b 100644 --- a/.ci/windows/build.sh +++ b/.ci/windows/build.sh @@ -17,12 +17,12 @@ fi [ -z "$WINDEPLOYQT" ] && { echo "WINDEPLOYQT environment variable required."; exit 1; } -echo $EXTRA_CMAKE_FLAGS +echo "${EXTRA_CMAKE_FLAGS[@]}" mkdir -p build && cd build cmake .. -G Ninja \ -DCMAKE_BUILD_TYPE="${BUILD_TYPE:-Release}" \ - -DENABLE_QT_TRANSLATION=ON \ + -DENABLE_QT_TRANSLATION=ON \ -DUSE_DISCORD_PRESENCE=ON \ -DYUZU_USE_BUNDLED_SDL2=ON \ -DBUILD_TESTING=OFF \ @@ -30,14 +30,14 @@ cmake .. -G Ninja \ -DDYNARMIC_TESTS=OFF \ -DYUZU_CMD=OFF \ -DYUZU_ROOM_STANDALONE=OFF \ - -DYUZU_USE_QT_MULTIMEDIA=${USE_MULTIMEDIA:-false} \ - -DYUZU_USE_QT_WEB_ENGINE=${USE_WEBENGINE:-false} \ + -DYUZU_USE_QT_MULTIMEDIA="${USE_MULTIMEDIA:-false}" \ + -DYUZU_USE_QT_WEB_ENGINE="${USE_WEBENGINE:-false}" \ -DYUZU_ENABLE_LTO=ON \ - -DCMAKE_EXE_LINKER_FLAGS=" /LTCG" \ + -DCMAKE_EXE_LINKER_FLAGS=" /LTCG" \ -DDYNARMIC_ENABLE_LTO=ON \ - -DYUZU_USE_BUNDLED_QT=${BUNDLE_QT:-false} \ - -DUSE_CCACHE=${CCACHE:-false} \ - -DENABLE_QT_UPDATE_CHECKER=${DEVEL:-true} \ + -DYUZU_USE_BUNDLED_QT="${BUNDLE_QT:-false}" \ + -DUSE_CCACHE="${CCACHE:-false}" \ + -DENABLE_QT_UPDATE_CHECKER="${DEVEL:-true}" \ "${EXTRA_CMAKE_FLAGS[@]}" \ "$@" diff --git a/.ci/windows/package.sh b/.ci/windows/package.sh index 2d126dc5be..a1deb77ae5 100644 --- a/.ci/windows/package.sh +++ b/.ci/windows/package.sh @@ -1,3 +1,8 @@ +#!/bin/bash -e + +# SPDX-FileCopyrightText: 2025 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + GITDATE=$(git show -s --date=short --format='%ad' | tr -d "-") GITREV=$(git show -s --format='%h') @@ -15,4 +20,4 @@ cp LICENSE* README* "$TMP_DIR"/ 7z a -tzip "$ARTIFACTS_DIR/$ZIP_NAME" "$TMP_DIR"/* -rm -rf "$TMP_DIR" \ No newline at end of file +rm -rf "$TMP_DIR" diff --git a/tools/cpm-fetch-all.sh b/tools/cpm-fetch-all.sh index 66f55df94d..4f7ffc4354 100755 --- a/tools/cpm-fetch-all.sh +++ b/tools/cpm-fetch-all.sh @@ -8,4 +8,4 @@ LIBS=$(find . externals src/qt_common src/dynarmic -maxdepth 2 -name cpmfile.json -exec jq -j 'keys_unsorted | join(" ")' {} \; -printf " ") -tools/cpm-fetch.sh $LIBS \ No newline at end of file +tools/cpm-fetch.sh "$LIBS" diff --git a/tools/cpm-fetch.sh b/tools/cpm-fetch.sh index 996cf76a97..a8633e9ec8 100755 --- a/tools/cpm-fetch.sh +++ b/tools/cpm-fetch.sh @@ -8,7 +8,7 @@ [ -z "$CPM_SOURCE_CACHE" ] && CPM_SOURCE_CACHE=$PWD/.cache/cpm -mkdir -p $CPM_SOURCE_CACHE +mkdir -p "$CPM_SOURCE_CACHE" ROOTDIR="$PWD" @@ -25,7 +25,7 @@ download_package() { curl "$DOWNLOAD" -sS -L -o "$OUTFILE" - ACTUAL_HASH=$(${HASH_ALGO}sum "$OUTFILE" | cut -d" " -f1) + ACTUAL_HASH=$("${HASH_ALGO}"sum "$OUTFILE" | cut -d" " -f1) [ "$ACTUAL_HASH" != "$HASH" ] && echo "$FILENAME did not match expected hash; expected $HASH but got $ACTUAL_HASH" && exit 1 mkdir -p "$OUTDIR" @@ -46,10 +46,10 @@ download_package() { # basically if only one real item exists at the top we just move everything from there # since github and some vendors hate me - DIRS=$(find -maxdepth 1 -type d -o -type f) + DIRS=$(find . -maxdepth 1 -type d -o -type f) # thanks gnu - if [ $(wc -l <<< "$DIRS") -eq 2 ]; then + if [ "$(wc -l <<< "$DIRS")" -eq 2 ]; then SUBDIR=$(find . -maxdepth 1 -type d -not -name ".") mv "$SUBDIR"/* . mv "$SUBDIR"/.* . 2>/dev/null || true @@ -59,7 +59,7 @@ download_package() { if grep -e "patches" <<< "$JSON" > /dev/null; then PATCHES=$(jq -r '.patches | join(" ")' <<< "$JSON") for patch in $PATCHES; do - patch --binary -p1 < "$ROOTDIR"/.patch/$package/$patch + patch --binary -p1 < "$ROOTDIR"/.patch/"$package"/"$patch" done fi @@ -102,7 +102,7 @@ ci_package() { done } -for package in $@ +for package in "$@" do # prepare for cancer # TODO(crueter): Fetch json once? @@ -145,12 +145,11 @@ do fi TAG=$(jq -r ".tag" <<< "$JSON") - - TAG=$(sed "s/%VERSION%/$VERSION_REPLACE/" <<< $TAG) + TAG="${TAG//%VERSION%/$VERSION_REPLACE}" ARTIFACT=$(jq -r ".artifact" <<< "$JSON") - ARTIFACT=$(sed "s/%VERSION%/$VERSION_REPLACE/" <<< $ARTIFACT) - ARTIFACT=$(sed "s/%TAG%/$TAG/" <<< $ARTIFACT) + ARTIFACT="${ARTIFACT//%VERSION%/$VERSION_REPLACE}" + ARTIFACT="${ARTIFACT//%TAG%/$TAG}" if [ "$URL" != "null" ]; then DOWNLOAD="$URL" @@ -219,4 +218,4 @@ do download_package done -rm -rf $TMP \ No newline at end of file +rm -rf "$TMP" diff --git a/tools/cpm-hash.sh b/tools/cpm-hash.sh index da0fb395db..84cd94b41b 100755 --- a/tools/cpm-hash.sh +++ b/tools/cpm-hash.sh @@ -1,4 +1,4 @@ #!/bin/sh -SUM=`wget -q https://github.com/$1/archive/$2.zip -O - | sha512sum` +SUM=$(wget -q https://github.com/"$1"/archive/"$2".zip -O - | sha512sum) echo "$SUM" | cut -d " " -f1 diff --git a/tools/reset-submodules.sh b/tools/reset-submodules.sh deleted file mode 100755 index 6fdfe0bcdb..0000000000 --- a/tools/reset-submodules.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -ex - -# SPDX-FileCopyrightText: 2024 yuzu Emulator Project -# SPDX-License-Identifier: MIT - -git submodule sync -git submodule foreach --recursive git reset --hard -git submodule update --init --recursive diff --git a/tools/url-hash.sh b/tools/url-hash.sh index a54dec8bb2..d3ef88df86 100755 --- a/tools/url-hash.sh +++ b/tools/url-hash.sh @@ -1,4 +1,4 @@ #!/bin/sh -SUM=`wget -q $1 -O - | sha512sum` +SUM=$(wget -q "$1" -O - | sha512sum) echo "$SUM" | cut -d " " -f1