Flynt + shellcheck (#1473)

* quote variables in src/gam-install.sh + fix typos

* flynt src (auto f-string conversion)

* quote all shell variables
This commit is contained in:
Janosh Riebesell
2022-01-23 16:08:23 +00:00
committed by GitHub
parent a4f09c02e8
commit f5c95d2ba0
16 changed files with 53 additions and 57 deletions

View File

@@ -46,16 +46,16 @@ if [ $SSLRESULT -ne 0 ] || [[ "$SSLVER" != "OpenSSL $BUILD_OPENSSL_VERSION "* ]]
sudo apt-get -qq --yes update > /dev/null
sudo apt-get -qq --yes build-dep python3 > /dev/null
fi
# Compile latest OpenSSL
curl -O --silent "https://www.openssl.org/source/openssl-${BUILD_OPENSSL_VERSION}.tar.gz"
echo "Extracting OpenSSL..."
tar xf openssl-$BUILD_OPENSSL_VERSION.tar.gz
cd openssl-$BUILD_OPENSSL_VERSION
tar xf openssl-"$BUILD_OPENSSL_VERSION".tar.gz
cd openssl-"$BUILD_OPENSSL_VERSION"
echo "Compiling OpenSSL $BUILD_OPENSSL_VERSION..."
./Configure --libdir=lib --prefix=$HOME/ssl
./Configure --libdir=lib --prefix="$HOME"/ssl
echo "Running make for OpenSSL..."
make -j$cpucount -s
make -j"$cpucount" -s
echo "Running make install for OpenSSL..."
make install > /dev/null
cd ~
@@ -65,22 +65,21 @@ if [ $SSLRESULT -ne 0 ] || [[ "$SSLVER" != "OpenSSL $BUILD_OPENSSL_VERSION "* ]]
curl -O --silent "https://www.python.org/ftp/python/${BUILD_PYTHON_VERSION}/Python-${BUILD_PYTHON_VERSION}.tar.xz"
echo "Extracting Python..."
tar xf "Python-${BUILD_PYTHON_VERSION}.tar.xz"
cd Python-$BUILD_PYTHON_VERSION
cd Python-"$BUILD_PYTHON_VERSION"
echo "Compiling Python $BUILD_PYTHON_VERSION..."
export flags="--with-openssl=${HOME}/ssl --enable-shared --prefix=${HOME}/python --with-ensurepip=upgrade --enable-optimizations --with-lto"
./configure $flags > /dev/null
make -j$cpucount -s
./configure "$flags" > /dev/null
make -j"$cpucount" -s
echo "Installing Python..."
make install > /dev/null
cd ~
fi
python="${HOME}/python/bin/python3"
pip="${HOME}/python/bin/pip3"
if ([ "${ImageOS}" == "ubuntu20" ]) && [ "${HOSTTYPE}" == "x86_64" ]; then
"${python}" -m pip install --upgrade patchelf-wrapper
"${python}" -m pip install --upgrade staticx
fi
cd $whereibelong
cd "$whereibelong"

View File

@@ -6,14 +6,14 @@ rm -rf $gampath
$pip install wheel
$python -OO -m PyInstaller --clean --noupx --strip --distpath $gampath gam.spec
export gam="${gampath}/gam"
export GAMVERSION=`$gam version simple`
export GAMVERSION=$($gam version simple)
cp LICENSE $gampath
cp GamCommands.txt $gampath
this_glibc_ver=$(ldd --version | awk '/ldd/{print $NF}')
GAM_ARCHIVE="gam-${GAMVERSION}-${GAMOS}-${PLATFORM}-glibc${this_glibc_ver}.tar.xz"
rm $gampath/lastupdatecheck.txt
# tar will cd to dist and tar up gam/
tar -C ${distpath} --create --file $GAM_ARCHIVE --xz gam
tar -C ${distpath} --create --file "$GAM_ARCHIVE" --xz gam
echo "PyInstaller GAM info:"
du -h $gam
time $gam version extended
@@ -25,7 +25,7 @@ if ([ "${ImageOS}" == "ubuntu20" ]) && [ "${HOSTTYPE}" == "x86_64" ]; then
mv $gam-staticx $gam
chmod 755 $gam
rm $gampath/lastupdatecheck.txt
tar -C dist/ --create --file $GAM_LEGACY_ARCHIVE --xz gam
tar -C dist/ --create --file "$GAM_LEGACY_ARCHIVE" --xz gam
echo "Legacy StaticX GAM info:"
du -h $gam
time $gam version extended

View File

@@ -24,9 +24,9 @@ cd ~
# with older MacOS versions
export pyfile=python-$BUILD_PYTHON_VERSION-macos11.pkg
wget https://www.python.org/ftp/python/$BUILD_PYTHON_VERSION/$pyfile
wget https://www.python.org/ftp/python/"$BUILD_PYTHON_VERSION"/"$pyfile"
echo "installing Python $BUILD_PYTHON_VERSION..."
sudo installer -pkg ./$pyfile -target /
sudo installer -pkg ./"$pyfile" -target /
# This fixes https://github.com/pyinstaller/pyinstaller/issues/5062
#codesign --remove-signature /Library/Frameworks/Python.framework/Versions/3.10/Python
@@ -128,4 +128,4 @@ $pip install pyscard
$python -V
cd $whereibelong
cd "$whereibelong"

View File

@@ -1,6 +1,6 @@
echo "MacOS Version Info According to Python:"
macver=$(python -c "import platform; print(platform.mac_ver()[0])")
echo $macver
echo "$macver"
echo "Xcode version:"
xcodebuild -version
export distpath="dist/"
@@ -10,10 +10,10 @@ export specfile="gam.spec"
$python -OO -m PyInstaller --distpath "${gampath}" "${specfile}"
export gam="${gampath}/gam"
$gam version extended
export GAMVERSION=`$gam version simple`
export GAMVERSION=$($gam version simple)
cp LICENSE "${gampath}"
cp GamCommands.txt "${gampath}"
GAM_ARCHIVE="gam-${GAMVERSION}-${GAMOS}-${PLATFORM}.tar.xz"
rm "${gampath}/lastupdatecheck.txt"
# tar will cd to dist/ and tar up gam/
tar -C dist/ --create --file $GAM_ARCHIVE --xz gam
tar -C dist/ --create --file "$GAM_ARCHIVE" --xz gam

View File

@@ -48,10 +48,10 @@ $pip install pyscard
# cp -v /c/python/DLLs/libcrypto-1_1-x64.dll /c/python/DLLs/libcrypto-1_1.dll
#fi
cd $mypath
cd "$mypath"
echo "PATH: $PATH"
cd ..
$python setup.py install
echo "cd to $mypath"
cd $mypath
cd "$mypath"

View File

@@ -19,13 +19,13 @@ cp gam-setup.bat $gampath
GAM_ARCHIVE=gam-$GAMVERSION-$GAMOS-$PLATFORM.zip
cwd=$(pwd)
cd "${distpath}"
/c/Program\ Files/7-Zip/7z.exe a -tzip $GAM_ARCHIVE gam -xr!.svn
/c/Program\ Files/7-Zip/7z.exe a -tzip "$GAM_ARCHIVE" gam -xr!.svn
mv "${GAM_ARCHIVE}" "${cwd}"
cd "${cwd}"
echo "Running WIX candle $WIX_BITS..."
/c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/candle.exe -arch $WIX_BITS gam.wxs
echo "Done with WIX candle..."
echo "Running WIX light..."
/c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/light.exe -ext /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/WixUIExtension.dll gam.wixobj -o gam-$GAMVERSION-$GAMOS-$PLATFORM.msi || true;
/c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/light.exe -ext /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/WixUIExtension.dll gam.wixobj -o gam-"$GAMVERSION"-"$GAMOS"-"$PLATFORM".msi || true;
echo "Done with WIX light..."
rm *.wixpdb