mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-22 01:41:54 +01:00
Fix scripts on Mac OS X by using the GNU variants
This commit is contained in:
parent
c669033ef3
commit
f737f5b185
39
filelist.sh
39
filelist.sh
@ -6,8 +6,17 @@
|
||||
outFile="./source/themes/filelist.h"
|
||||
count_old=$(cat $outFile 2>/dev/null | tr -d '\n\n' | sed 's/[^0-9]*\([0-9]*\).*/\1/')
|
||||
|
||||
# Need to use GNU find and echo on Mac OS X
|
||||
if [[ $(uname -s) == Darwin ]]; then
|
||||
ECHO=gecho
|
||||
FIND=gfind
|
||||
else
|
||||
ECHO=echo
|
||||
FIND=find
|
||||
fi
|
||||
|
||||
count=0
|
||||
for i in $(find ./data/images/ ./data/sounds/ ./data/fonts/ ./data/binary/ -maxdepth 1 -type f \( ! -printf "%f\n" \))
|
||||
for i in $($FIND ./data/images/ ./data/sounds/ ./data/fonts/ ./data/binary/ -maxdepth 1 -type f \( ! -printf "%f\n" \))
|
||||
do
|
||||
files[count]=$i
|
||||
count=$((count+1))
|
||||
@ -16,7 +25,7 @@ done
|
||||
if [ "$count_old" != "$count" ] || [ ! -f $outFile ]
|
||||
then
|
||||
|
||||
echo "Generating filelist.h for $count files." >&2
|
||||
$ECHO "Generating filelist.h for $count files." >&2
|
||||
cat <<EOF > $outFile
|
||||
/****************************************************************************
|
||||
* USB Loader GX resource files.
|
||||
@ -37,28 +46,28 @@ for i in ${files[@]}
|
||||
do
|
||||
filename=${i%.*}
|
||||
extension=${i##*.}
|
||||
echo 'extern const u8 '$filename'_'$extension'[];' >> $outFile
|
||||
echo 'extern const u32 '$filename'_'$extension'_size;' >> $outFile
|
||||
echo '' >> $outFile
|
||||
$ECHO 'extern const u8 '$filename'_'$extension'[];' >> $outFile
|
||||
$ECHO 'extern const u32 '$filename'_'$extension'_size;' >> $outFile
|
||||
$ECHO '' >> $outFile
|
||||
done
|
||||
|
||||
echo 'RecourceFile Resources::RecourceFiles[] =' >> $outFile
|
||||
echo '{' >> $outFile
|
||||
$ECHO 'RecourceFile Resources::RecourceFiles[] =' >> $outFile
|
||||
$ECHO '{' >> $outFile
|
||||
|
||||
for i in ${files[@]}
|
||||
do
|
||||
filename=${i%.*}
|
||||
extension=${i##*.}
|
||||
echo -e '\t{"'$i'", '$filename'_'$extension', '$filename'_'$extension'_size, NULL, 0},' >> $outFile
|
||||
$ECHO -e '\t{"'$i'", '$filename'_'$extension', '$filename'_'$extension'_size, NULL, 0},' >> $outFile
|
||||
done
|
||||
|
||||
echo -e '\t{"listBackground.png", NULL, 0, NULL, 0},\t// Optional' >> $outFile
|
||||
echo -e '\t{"carouselBackground.png", NULL, 0, NULL, 0},\t// Optional' >> $outFile
|
||||
echo -e '\t{"gridBackground.png", NULL, 0, NULL, 0},\t// Optional' >> $outFile
|
||||
echo -e '\t{NULL, NULL, 0, NULL, 0}' >> $outFile
|
||||
echo '};' >> $outFile
|
||||
$ECHO -e '\t{"listBackground.png", NULL, 0, NULL, 0},\t// Optional' >> $outFile
|
||||
$ECHO -e '\t{"carouselBackground.png", NULL, 0, NULL, 0},\t// Optional' >> $outFile
|
||||
$ECHO -e '\t{"gridBackground.png", NULL, 0, NULL, 0},\t// Optional' >> $outFile
|
||||
$ECHO -e '\t{NULL, NULL, 0, NULL, 0}' >> $outFile
|
||||
$ECHO '};' >> $outFile
|
||||
|
||||
echo '' >> $outFile
|
||||
echo '#endif' >> $outFile
|
||||
$ECHO '' >> $outFile
|
||||
$ECHO '#endif' >> $outFile
|
||||
|
||||
fi
|
||||
|
11
gitver.sh
11
gitver.sh
@ -1,5 +1,12 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Need to use GNU sed on Mac OS X
|
||||
if [[ $(uname -s) == Darwin ]]; then
|
||||
SED=gsed
|
||||
else
|
||||
SED=sed
|
||||
fi
|
||||
|
||||
# Correct the path on Windows so that git works correctly
|
||||
if [[ $(uname -s) == MSYS* ]]; then
|
||||
winpath=$(cmd //c REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -v PATH | grep '^ PATH'| sed 's/ PATH REG_SZ //')
|
||||
@ -9,9 +16,9 @@ fi
|
||||
|
||||
commit_id=$(git rev-parse HEAD 2>/dev/null | head -c 7)
|
||||
[ -z "$commit_id" ] && commit_id="0000001"
|
||||
commit_message=$(git show -s --format="%<(52,trunc)%s" $commit_id 2>/dev/null | sed -e 's/[[:space:]]*$//')
|
||||
commit_message=$(git show -s --format="%<(52,trunc)%s" $commit_id 2>/dev/null | $SED -e 's/[[:space:]]*$//')
|
||||
[ -z "$commit_message" ] && commit_message="unable to get the commit message"
|
||||
commit_id_old=$(cat ./source/gitver.c 2>/dev/null | tr -d '\n' | sed -r 's/.*([0-9a-f]{7}).*/\1/')
|
||||
commit_id_old=$(cat ./source/gitver.c 2>/dev/null | tr -d '\n' | $SED -r 's/.*([0-9a-f]{7}).*/\1/')
|
||||
|
||||
if [ "$commit_id" != "$commit_id_old" ] || [ ! -f ./source/gitver.c ]; then
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user