Commit 5b344720 authored by Vladislav's avatar Vladislav

I made double square brackets everywhere (they work faster), ! -z passed to -n, ! -n to z

parent fabbc18d
......@@ -72,12 +72,12 @@ function setGameArt {
GAMEARTBASE="$( basename "$GAMEARTSOURCE" )"
GAMEARTDEST="${SGGRIDDIR}/${GAMEARTAPPID}${GAMEARTSUFFIX}.${GAMEARTBASE#*.}" # path to filename in grid e.g. turns "/home/gaben/GamesArt/cs2_hero.png" into "~/.local/share/Steam/userdata/1234567/config/grid/4440654_hero.png"
if [ -n "$GAMEARTSOURCE" ]; then
if [ -f "$GAMEARTDEST" ]; then
if [[ -n "$GAMEARTSOURCE" ]] ; then
if [[ -f "$GAMEARTDEST" ]] ; then
rm "$GAMEARTDEST"
fi
if [ -f "$GAMEARTSOURCE" ]; then
if [[ -f "$GAMEARTSOURCE" ]] ; then
$GAMEARTCMD "$GAMEARTSOURCE" "$GAMEARTDEST"
fi
fi
......@@ -143,12 +143,12 @@ function downloadArtFromSteamGridDB {
SGDB_ENDPOINT_STR="${SEARCHENDPOINT}/$(echo "$SEARCHID" | awk '{print $1}' | paste -s -d, -)?"
[ -n "$SEARCHSTYLES" ] && SGDB_ENDPOINT_STR+="&styles=${SEARCHSTYLES}"
[ -n "$SEARCHDIMS" ] && SGDB_ENDPOINT_STR+="&dimensions=${SEARCHDIMS}"
[ -n "$SEARCHTYPES" ] && SGDB_ENDPOINT_STR+="&types=${SEARCHTYPES}"
[ -n "$SEARCHNSFW" ] && SGDB_ENDPOINT_STR+="&nsfw=${SEARCHNSFW}"
[ -n "$SEARCHHUMOR" ] && SGDB_ENDPOINT_STR+="&humor=${SEARCHHUMOR}"
[ -n "$SEARCHEPILEPSY" ] && SGDB_ENDPOINT_STR+="&epilepsy=${SEARCHEPILEPSY}"
[[ -n "$SEARCHSTYLES" ]] && SGDB_ENDPOINT_STR+="&styles=${SEARCHSTYLES}"
[[ -n "$SEARCHDIMS" ]] && SGDB_ENDPOINT_STR+="&dimensions=${SEARCHDIMS}"
[[ -n "$SEARCHTYPES" ]] && SGDB_ENDPOINT_STR+="&types=${SEARCHTYPES}"
[[ -n "$SEARCHNSFW" ]] && SGDB_ENDPOINT_STR+="&nsfw=${SEARCHNSFW}"
[[ -n "$SEARCHHUMOR" ]] && SGDB_ENDPOINT_STR+="&humor=${SEARCHHUMOR}"
[[ -n "$SEARCHEPILEPSY" ]] && SGDB_ENDPOINT_STR+="&epilepsy=${SEARCHEPILEPSY}"
set -o pipefail
RESPONSE=$(curl -H "Authorization: Bearer $SGDBAPIKEY" -s "$SGDB_ENDPOINT_STR" 2> >(grep -v "SSL_INIT"))
......@@ -193,17 +193,17 @@ function downloadArtFromSteamGridDB {
DLDST="${GRIDDLDIR}/${SGDBFILENAME}.${GRIDDLURL##*.}"
STARTDL=1
if [ -f "$DLDST" ]; then
if [ "$SGDBHASFILE" == "backup" ]; then
if [[ -f "$DLDST" ]] ; then
if [[ "$SGDBHASFILE" == "backup" ]] ; then
BACKDIR="${GRIDDLDIR}/backup"
mkdir -p "$BACKDIR"
mv "$DLDST" "$BACKDIR"
elif [ "$SGDBHASFILE" == "replace" ]; then
elif [[ "$SGDBHASFILE" == "replace" ]] ; then
rm "$DLDST" 2>/dev/null
fi
fi
if [ "$STARTDL" -eq 1 ]; then
if [[ "$STARTDL" -eq 1 ]] ; then
filename="$(basename "$DLDST")"
curl -f -# -A 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)' -H 'Cache-Control: no-cache, no-store' -H 'Pragma: no-cache' -L "$DLSRC" -o "$DLDST" 2>&1 | \
tr '\r' '\n' | sed -ur 's|[# ]+||g;s|.*=.*||g;s|.*|#Downloading at &\n&|g' | \
......@@ -217,7 +217,7 @@ function downloadArtFromSteamGridDB {
done
}
if [ -f "$SCPATH" ]; then
if [[ -f "$SCPATH" ]] ; then
cp "$SCPATH" "${SCPATH//.vdf}_${PROGNAME}_backup.vdf" 2>/dev/null
truncate -s-2 "$SCPATH"
OLDSET="$(grep -aPo '\x00[0-9]\x00\x02appid' "$SCPATH" | tail -n1 | tr -dc '0-9')"
......@@ -231,11 +231,11 @@ fi
function getSGDBGameIDFromTitle {
SGDBSEARCHNAME="$1"
if [ -n "$SGDBSEARCHNAME" ]; then
if [[ -n "$SGDBSEARCHNAME" ]] ; then
SGDBSEARCHENDPOINT="${BASESTEAMGRIDDBAPI}/search/autocomplete/${SGDBSEARCHNAME}"
SGDBSEARCHNAMERESP="$(curl -H "Authorization: Bearer $SGDBAPIKEY" -s "$SGDBSEARCHENDPOINT" 2> >(grep -v "SSL_INIT") )"
if jq -e '.success' 1> /dev/null <<< "$SGDBSEARCHNAMERESP"; then
if [ "$(jq '.data | length' <<< "$SGDBSEARCHNAMERESP" )" -gt 0 ]; then
if [[ "$(jq '.data | length' <<< "$SGDBSEARCHNAMERESP" )" -gt 0 ]] ; then
SGDBSEARCH_FOUNDNAME="$(jq '.data[0].name' <<< "$SGDBSEARCHNAMERESP" )"
SGDBSEARCH_FOUNDGAID="$(jq '.data[0].id' <<< "$SGDBSEARCHNAMERESP" )"
......@@ -280,10 +280,10 @@ function commandlineGetSteamGridDBArtwork {
done
# If we pass a name to search on and we get a Game ID back from SteamGridDB, set this as the ID to search for artwork on
if [ -n "$GSGDBA_SEARCHNAME" ]; then
if [ -n "$GSGDBA_FILENAME" ]; then
if [[ -n "$GSGDBA_SEARCHNAME" ]] ; then
if [[ -n "$GSGDBA_FILENAME" ]] ; then
GSGDBA_FOUNDGAMEID="$( getSGDBGameIDFromTitle "$GSGDBA_SEARCHNAME" )"
if [ -n "$GSGDBA_FOUNDGAMEID" ]; then
if [[ -n "$GSGDBA_FOUNDGAMEID" ]] ; then
GSGDBA_APPID="$GSGDBA_FOUNDGAMEID"
SGDBENDPOINTTYPE="game"
fi
......@@ -327,7 +327,7 @@ NOSTSEARCHID="" # ID to search for the SteamGridDB artwork on (either Steam App
NOSTSEARCHFLAG="--nonsteam" # Whether to search using a Steam AppID or SteamGridDB Game ID (will be set to --steam if we get an AppID)
# Only add NOSTAPPNAME as fallback if we don't have an ID to search on, because commandlineGetSteamGridDBArtwork will prefer name over ID, so if we have to fall back to Non-Steam Name (i.e. no entered custom name) then only do so if we don't have an ID given
if [ -n "$NOSTAPPNAME" ]; then
if [[ -n "$NOSTAPPNAME" ]] ; then
NOSTSEARCHNAME="$NOSTAPPNAME"
NOSTSEARCHNAME="${NOSTSEARCHNAME// /_}"
fi
......
......@@ -9,7 +9,7 @@ IFS=$'\n'
unset DUPLICATE
DUPLICATE="$(cat "$SELF_PATH/portwine_db/"* | grep -E ".exe" | grep '#' | uniq -D | sort -u)"
if [[ ! -z "$DUPLICATE" ]] ; then
if [[ -n "$DUPLICATE" ]] ; then
for duplicate_db in $DUPLICATE ; do
echo -e "\nDuplicate:"
grep -E "$duplicate_db" "$SELF_PATH/portwine_db/"* | awk -F"portwine_db/" '{print $2}'
......
......@@ -12,7 +12,7 @@ fi
export PW_VULKAN_USE=1
add_in_start_portwine () {
if [ -d "${WINEPREFIX}/drive_c/users/steamuser/AppData/Roaming/Ubisoft/Anno1404/Config/" ] ; then
if [[ -d "${WINEPREFIX}/drive_c/users/steamuser/AppData/Roaming/Ubisoft/Anno1404/Config/" ]] ; then
sed -i 's/<DirectXVersion>0<\/DirectXVersion>/<DirectXVersion>9<\/DirectXVersion>/' "${WINEPREFIX}/drive_c/users/steamuser/AppData/Roaming/Ubisoft/Anno1404/Config/Engine.ini"
fi
}
......@@ -5,6 +5,6 @@
################################################
export PW_VULKAN_USE=0
export LAUNCH_PARAMETERS=""
if [ -d "${PATH_TO_GAME}"/Movies ] ; then
if [[ -d "${PATH_TO_GAME}"/Movies ]] ; then
mv "${PATH_TO_GAME}"/Movies "${PATH_TO_GAME}"/Movies_bak
fi
......@@ -13,7 +13,7 @@ export PW_WINE_USE="WINE_LG"
add_in_start_portwine ()
{
if [ -e "${WINEPREFIX}/drive_c/users/${USER}/Local Settings/Application Data/GOG.com/Galaxy/Configuration/config.json" ] ; then
if [[ -e "${WINEPREFIX}/drive_c/users/${USER}/Local Settings/Application Data/GOG.com/Galaxy/Configuration/config.json" ]] ; then
sed -i 's/"featureOverlay" : true,/"featureOverlay" : false,/' "${WINEPREFIX}/drive_c/${USER}/Local Settings/Application Data/GOG.com/Galaxy/Configuration/config.json"
fi
}
......@@ -11,13 +11,13 @@
export PW_USE_D3D_EXTRAS=0
## export DXVK_HUD=fps,devinfo
#####################examples###########################
while [ `pidof -s dotNetFx40_Full_x86_x64.exe` ] ; do
if [ $? -eq 0 ] ; then
while [[ $(pidof -s dotNetFx40_Full_x86_x64.exe) ]] ; do
if [[ $? -eq 0 ]] ; then
sleep 1
else
export dotnet_pids=`ps -ax | grep mscorsvw.exe | awk '{print $1}' | uniq`
[ ! -z $dotnet_pids ]
kill -n 9 $dotnet_pids
dotnet_pids=$(ps -ax | grep mscorsvw.exe | awk '{print $1}' | uniq)
export dotnet_pids
[[ -n "$dotnet_pids" ]] && kill -n 9 "$dotnet_pids"
sleep 1
fi
done
......@@ -10,10 +10,10 @@ export WINEDLLOVERRIDES="gfclient0_msvc140=n;ucrtbase=b"
#add_in_start_portwine () {
#
#while true; do
# if [ -z "`pgrep GameforgeClient`" ]; then
# if [[ -z "`pgrep GameforgeClient`" ]] ; then
# sleep 1
# else
# while [ ! -z "`pgrep GameforgeClient`" ] ; do
# while [[ -n "`pgrep GameforgeClient`" ]] ; do
# killall -s KILL gfservice.exe
# done
# sleep 1
......
......@@ -12,7 +12,7 @@ export MESA_EXTENSION_MAX_YEAR=2002
export __GL_ExtensionStringVersion=17700
add_in_start_portwine ()
{
if [ ! -e "$PATH_TO_GAME/0_Proton_PW_MoHAA" ] ; then
if [[ ! -e "$PATH_TO_GAME/0_Proton_PW_MoHAA" ]] ; then
touch "$PATH_TO_GAME/0_Proton_PW_MoHAA" && mv "$PATH_TO_GAME/main/newconfig.cfg" "$PATH_TO_GAME/main/newconfig.cfg.bak" && mv "$PATH_TO_GAME/main/configs/unnamedsoldier.cfg" "$PATH_TO_GAME/main/configs/unnamedsoldier.cfg.bak" && mv "$PATH_TO_GAME/mainta/newconfig.cfg" "$PATH_TO_GAME/mainta/newconfig.cfg.bak" && mv "$PATH_TO_GAME/mainta/configs/unnamedsoldier.cfg" "$PATH_TO_GAME/mainta/configs/unnamedsoldier.cfg.bak" && mv "$PATH_TO_GAME/maintt/newconfig.cfg" "$PATH_TO_GAME/maintt/newconfig.cfg.bak" && mv "$PATH_TO_GAME/maintt/configs/unnamedsoldier.cfg" "$PATH_TO_GAME/maintt/configs/unnamedsoldier.cfg.bak" &&
echo '//
// Video Card Family: NVidia GeForce
......
......@@ -2,12 +2,12 @@
# Author: chal55rus (Sergey P.), cefeiko, Castro-Fidel (linux-gaming.ru)
##########################################################################
pw_shutdown_please () {
if [ "$PW_USE_RUNTIME" != 1 ]
if [[ "$PW_USE_RUNTIME" != 1 ]]
then echo "PW_USE_RUNTIME: `echo $PW_USE_RUNTIME`"
else
sleep 10
while true ; do
if [ -z "`ps aux | grep -v grep | grep -wm 1 "$1" | awk '{print $2}'`" ] && [ ! -z "`pgrep wrap | head -n 1`" ]; then
if [[ -z "`ps aux | grep -v grep | grep -wm 1 "$1" | awk '{print $2}'`" ]] && [[ -n "`pgrep wrap | head -n 1`" ]] ; then
echo -e "PID "$1" not found"
sleep 1
else
......
......@@ -12,7 +12,7 @@ export PW_AUTOINSTALL_EXE="${WINEPREFIX}/drive_c/Program Files (x86)/OSU/osu!.ex
if try_download "https://m1.ppy.sh/r/osu!install.exe" "${PW_AUTOINSTALL_EXE}" no_mirror
then
pw_start_progress_bar_install_game "OSU!."
if [ -f "${PORT_WINE_PATH}/data/pfx_dotnet/drive_c/Program Files (x86)/OSU/osu!install.exe" ]; then
if [[ -f "${PORT_WINE_PATH}/data/pfx_dotnet/drive_c/Program Files (x86)/OSU/osu!install.exe" ]] ; then
mv -f "${PORT_WINE_PATH}/data/pfx_dotnet/drive_c/Program Files (x86)/OSU/osu!install.exe" "${PORT_WINE_PATH}/data/pfx_dotnet/drive_c/Program Files (x86)/OSU/osu!.exe"
fi
export portwine_exe="$WINEPREFIX/drive_c/Program Files (x86)/OSU/osu!.exe"
......
......@@ -9,7 +9,7 @@ then
pw_start_progress_bar_install_game "Steam."
pw_kill_autostart steam.exe &
pw_run "${PW_AUTOINSTALL_EXE}"
if [ -f "$WINEPREFIX/drive_c/Program Files (x86)/Steam/Steam.exe" ]
if [[ -f "$WINEPREFIX/drive_c/Program Files (x86)/Steam/Steam.exe" ]]
then mv -f "$WINEPREFIX/drive_c/Program Files (x86)/Steam/Steam.exe" "$WINEPREFIX/drive_c/Program Files (x86)/Steam/steam.exe"
fi
portwine_exe="$WINEPREFIX/drive_c/Program Files (x86)/Steam/steam.exe"
......
......@@ -7,7 +7,7 @@ export PW_VULKAN_USE=1
export PW_AUTOINSTALL_EXE="${PW_USER_TEMP}/wos_client.exe"
WOSB_VERSION="$(curl -s --list-only --connect-timeout 3 https://www.worldofseabattle.com/download2 2>/dev/null | grep 'installer.exe' | awk -F'xsolla-launcher-update/' '{print $2}' | awk -F'/' '{print $1}')"
[[ ! -z "$WOSB_VERSION" ]] && print_info "Found version: $WOSB_VERSION" || yad_error "Error while get version of WOSB INSTALLER."
[[ -n "$WOSB_VERSION" ]] && print_info "Found version: $WOSB_VERSION" || yad_error "Error while get version of WOSB INSTALLER."
start_portwine
if try_download "https://installer.launcher.xsolla.com/xlauncher-builds/xsolla-launcher-update/${WOSB_VERSION}/bin/installer.exe" "${PW_AUTOINSTALL_EXE}" no_mirror
......
......@@ -177,7 +177,7 @@ try_remove_file "${PW_TMPFS_PATH}/update_pfx_log"
source "${USER_CONF}"
# check PortProton theme
if [[ ! -z "$GUI_THEME" ]] \
if [[ -n "$GUI_THEME" ]] \
&& [[ -f "$PW_GUI_THEMES_PATH/$GUI_THEME.pptheme" ]]
then
# shellcheck source=/dev/null
......@@ -247,7 +247,7 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then
export GAMESCOPE_INSTALLED="1"
else
print_error "gamescope - broken!"
if [[ -n $PW_DEBUG ]] ; then
if [[ -n "$PW_DEBUG" ]] ; then
debug_timer --start
timeout 5 gamescope --help
debug_timer --end "gamescope"
......@@ -264,7 +264,7 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then
export VULKAN_DRIVER_NAME GET_GPU_NAMES
else
print_error "vulkaninfo - broken!"
if [[ -n $PW_DEBUG ]] ; then
if [[ -n "$PW_DEBUG" ]] ; then
debug_timer --start
timeout 5 vulkaninfo
debug_timer --end "vulkaninfo"
......@@ -284,7 +284,7 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then
export LSPCI_VGA
else
print_error "lspci - broken!"
if [[ -n $PW_DEBUG ]] ; then
if [[ -n "$PW_DEBUG" ]] ; then
debug_timer --start
timeout 5 lspci -vv
debug_timer --end "lspci"
......@@ -303,7 +303,7 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then
print_var PW_SCREEN_RESOLUTION PW_SCREEN_PRIMARY
else
print_error "xrandr - broken!"
if [[ -n $PW_DEBUG ]] ; then
if [[ -n "$PW_DEBUG" ]] ; then
debug_timer --start
timeout 5 xrandr --verbose
debug_timer --end "xrandr"
......@@ -327,7 +327,7 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then
unset LOCALE_LIST
for LOCALE in $GET_LOCALE_LIST ; do
if grep -e "$LOCALE" "${PW_TMPFS_PATH}/locale.tmp" &>/dev/null ; then
if [[ ! -z "$LOCALE_LIST" ]]
if [[ -n "$LOCALE_LIST" ]]
then LOCALE_LIST+="!$(grep -e "$LOCALE" "${PW_TMPFS_PATH}/locale.tmp")"
else LOCALE_LIST="$(grep -e "$LOCALE" "${PW_TMPFS_PATH}/locale.tmp")"
fi
......@@ -336,7 +336,7 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then
export LOCALE_LIST
else
print_error "locale - broken!"
if [[ -n $PW_DEBUG ]] ; then
if [[ -n "$PW_DEBUG" ]] ; then
debug_timer --start
timeout 5 locale -a
debug_timer --end "locale"
......@@ -407,7 +407,7 @@ export SKIP_CHECK_UPDATES="1"
[[ "$MISSING_DESKTOP_FILE" == 1 ]] && portwine_missing_shortcut
if [[ ! -z $(basename "${portwine_exe}" | grep .ppack) ]] ; then
if [[ -n $(basename "${portwine_exe}" | grep .ppack) ]] ; then
unset PW_SANDBOX_HOME_PATH
pw_init_runtime
if check_flatpak
......@@ -540,8 +540,8 @@ case "${PW_VULKAN_USE}" in
*) PW_DEFAULT_VULKAN_USE="$SORT_NEWEST!$SORT_STABLE!$SORT_LEGACY!$SORT_G_ZINK!$SORT_G_NINE!$SORT_OPENGL!$SORT_VULKAN" ;;
esac
if [[ ! -z "${PW_COMMENT_DB}" ]] ; then :
elif [[ ! -z "${PORTPROTON_NAME}" ]] ; then
if [[ -n "${PW_COMMENT_DB}" ]] ; then :
elif [[ -n "${PORTPROTON_NAME}" ]] ; then
PW_COMMENT_DB="$(gettext "Launching") <b>${PORTPROTON_NAME}</b>"
else
PW_COMMENT_DB="$(gettext "Launching") <b>${PORTWINE_DB}</b>"
......@@ -572,8 +572,7 @@ if [[ -f "${portwine_exe}" ]] ; then
fi
if [[ "${PW_GUI_DISABLED_CS}" != 1 ]] ; then
pw_create_gui_png
grep -il "${portwine_exe}" "${HOME}/.local/share/applications"/*.desktop
if [[ "$?" != "0" ]] ; then
if ! grep -il "${portwine_exe}" "${HOME}/.local/share/applications"/*.desktop ; then
PW_SHORTCUT="$(gettext "CREATE SHORTCUT")!$PW_GUI_ICON_PATH/$BUTTON_SIZE.png!$(gettext "Create shortcut for select file..."):100"
else
PW_SHORTCUT="$(gettext "DELETE SHORTCUT")!$PW_GUI_ICON_PATH/$BUTTON_SIZE.png!$(gettext "Delete shortcut for select file..."):98"
......@@ -711,12 +710,12 @@ else
IFS="%"
"${pw_yad}" --plug=$KEY --tabnum="${PW_GUI_SORT_TABS[4]}" --form --columns="$MAIN_GUI_COLUMNS" --homogeneous-column \
--gui-type-layout=${MAIN_MENU_GUI_TYPE_LAYOUT} \
--gui-type-layout="${MAIN_MENU_GUI_TYPE_LAYOUT}" \
--align-buttons --scroll --separator=" " ${PW_GENERATE_BUTTONS} 2>/dev/null &
IFS="$orig_IFS"
"${pw_yad}" --plug=$KEY --tabnum="${PW_GUI_SORT_TABS[3]}" --form --columns=3 --align-buttons --separator=";" --homogeneous-column \
--gui-type-layout=${MAIN_MENU_GUI_TYPE_LAYOUT} \
--gui-type-layout="${MAIN_MENU_GUI_TYPE_LAYOUT}" \
--field=" $(gettext "Reinstall PortProton")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click --normal gui_pw_reinstall_pp"' \
--field=" $(gettext "Remove PortProton")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click --normal gui_rm_portproton"' \
--field=" $(gettext "Update PortProton")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click --normal gui_pw_update"' \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment