Commit 38f0db7c authored by Vladislav's avatar Vladislav

Fixed LSBash when the directory is empty and revert ls to lsbash

parent 6fd26a21
...@@ -419,8 +419,10 @@ lsbash () { ...@@ -419,8 +419,10 @@ lsbash () {
fi fi
grep_find_file2 () { grep_find_file2 () {
if [[ -z $1 ]] ; then if [[ -z $1 ]] ; then
echo "$find_file_old" if [[ $find_file_old != "*" ]] ; then
found_successfully=1 echo "$find_file_old"
found_successfully=1
fi
else else
find_file_old_array+=("$find_file_old") find_file_old_array+=("$find_file_old")
fi fi
...@@ -1625,7 +1627,7 @@ init_wine_ver () { ...@@ -1625,7 +1627,7 @@ init_wine_ver () {
else else
if [[ -d "${PORT_WINE_PATH}/data/dist" ]] ; then if [[ -d "${PORT_WINE_PATH}/data/dist" ]] ; then
IFS=$'\n' IFS=$'\n'
for dist_dir in $(ls -1 "${PORT_WINE_PATH}/data/dist") ; do for dist_dir in $(lsbash "${PORT_WINE_PATH}/data/dist") ; do
dist_dir_new=$(echo "${dist_dir}" | awk '$1=$1' | sed -e s/[[:blank:]]/_/g) dist_dir_new=$(echo "${dist_dir}" | awk '$1=$1' | sed -e s/[[:blank:]]/_/g)
if [[ ! -d "${PORT_WINE_PATH}/data/dist/${dist_dir_new^^}" ]] ; then if [[ ! -d "${PORT_WINE_PATH}/data/dist/${dist_dir_new^^}" ]] ; then
mv -- "${PORT_WINE_PATH}/data/dist/$dist_dir" "${PORT_WINE_PATH}/data/dist/${dist_dir_new^^}" mv -- "${PORT_WINE_PATH}/data/dist/$dist_dir" "${PORT_WINE_PATH}/data/dist/${dist_dir_new^^}"
...@@ -1633,7 +1635,7 @@ init_wine_ver () { ...@@ -1633,7 +1635,7 @@ init_wine_ver () {
done done
IFS="$orig_IFS" IFS="$orig_IFS"
fi fi
if [[ -z $(ls "${PORT_WINE_PATH}/data/dist/" | grep "${PW_WINE_USE}") ]] ; then if [[ -z $(lsbash "${PORT_WINE_PATH}/data/dist/" --grep "${PW_WINE_USE}") ]] ; then
if [[ "$PW_WINE_USE" =~ PROTON_LG* ]] if [[ "$PW_WINE_USE" =~ PROTON_LG* ]]
then export PW_WINE_USE=PROTON_LG then export PW_WINE_USE=PROTON_LG
else export PW_WINE_USE=WINE_LG else export PW_WINE_USE=WINE_LG
...@@ -1650,20 +1652,20 @@ init_wine_ver () { ...@@ -1650,20 +1652,20 @@ init_wine_ver () {
export WINELOADER="${WINEDIR}/bin/wine" export WINELOADER="${WINEDIR}/bin/wine"
export WINESERVER="${WINEDIR}/bin/wineserver" export WINESERVER="${WINEDIR}/bin/wineserver"
if [[ -d "${WINEDIR}/files" && ! -d "${WINEDIR}/dist" ]] ; then if [[ -d "${WINEDIR}/files" && ! -d "${WINEDIR}/dist" ]] ; then
for clear_dist_files in $(ls "${WINEDIR}" | sed -r "s/^(files|version)$//g") ; do for clear_dist_files in $(lsbash "$WINEDIR" | sed -r "s/^(files|version)$//g") ; do
rm -fr "${WINEDIR}/$clear_dist_files" rm -fr "${WINEDIR}/$clear_dist_files"
done done
mv -f "${WINEDIR}/files"/* "${WINEDIR}/" mv -f "${WINEDIR}/files"/* "${WINEDIR}/"
rm -fr "${WINEDIR}/files" rm -fr "${WINEDIR}/files"
elif [[ ! -d "${WINEDIR}/files" && -d "${WINEDIR}/dist" ]] ; then elif [[ ! -d "${WINEDIR}/files" && -d "${WINEDIR}/dist" ]] ; then
for clear_dist_files in $(ls "${WINEDIR}" | sed -r "s/^(dist|version)$//g") ; do for clear_dist_files in $(lsbash "$WINEDIR" | sed -r "s/^(dist|version)$//g") ; do
rm -fr "${WINEDIR}/$clear_dist_files" rm -fr "${WINEDIR}/$clear_dist_files"
done done
mv -f "${WINEDIR}/dist"/* "${WINEDIR}/" mv -f "${WINEDIR}/dist"/* "${WINEDIR}/"
rm -fr "${WINEDIR}/dist" rm -fr "${WINEDIR}/dist"
elif [[ -f "${WINEDIR}/proton_dist.tar" ]] ; then elif [[ -f "${WINEDIR}/proton_dist.tar" ]] ; then
unpack "${WINEDIR}/proton_dist.tar" "${WINEDIR}/" unpack "${WINEDIR}/proton_dist.tar" "${WINEDIR}/"
for clear_dist_files in $(ls "${WINEDIR}" | sed -r "s/^(bin|lib|lib64|share|version)$//g") ; do for clear_dist_files in $(lsbash "$WINEDIR" | sed -r "s/^(bin|lib|lib64|share|version)$//g") ; do
rm -fr "${WINEDIR}/$clear_dist_files" rm -fr "${WINEDIR}/$clear_dist_files"
done done
fi fi
...@@ -1952,7 +1954,7 @@ pw_kill_autostart () { ...@@ -1952,7 +1954,7 @@ pw_kill_autostart () {
fi fi
done done
if [[ -n "$(ls "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}"/drive_c/ | grep -m 1 ".tmp")" ]] ; then if [[ -n "$(lsbash "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}"/drive_c/ | grep -m 1 ".tmp")" ]] ; then
rm -f "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}"/drive_c/*.tmp rm -f "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}"/drive_c/*.tmp
fi fi
...@@ -2043,8 +2045,8 @@ pw_download_libs () { ...@@ -2043,8 +2045,8 @@ pw_download_libs () {
"${PORT_WINE_TMP_PATH}/libs${PW_LIBS_VER}.tar.xz" ; then "${PORT_WINE_TMP_PATH}/libs${PW_LIBS_VER}.tar.xz" ; then
if unpack "${PORT_WINE_TMP_PATH}/libs${PW_LIBS_VER}.tar.xz" "${PORT_WINE_TMP_PATH}/" ; then if unpack "${PORT_WINE_TMP_PATH}/libs${PW_LIBS_VER}.tar.xz" "${PORT_WINE_TMP_PATH}/" ; then
try_remove_file "${PORT_WINE_TMP_PATH}/libs${PW_LIBS_VER}.tar.xz" try_remove_file "${PORT_WINE_TMP_PATH}/libs${PW_LIBS_VER}.tar.xz"
if ls "${PORT_WINE_TMP_PATH}" | grep libs_v | grep -v libs"${PW_LIBS_VER}" ; then if lsbash "${PORT_WINE_TMP_PATH}" --grep libs_v --grep -v libs"${PW_LIBS_VER}" ; then
for RM_LIBS in $(ls "${PORT_WINE_TMP_PATH}" | grep libs_v | grep -v libs"${PW_LIBS_VER}") for RM_LIBS in $(lsbash "${PORT_WINE_TMP_PATH}" --grep libs_v --grep -v libs"${PW_LIBS_VER}")
do try_remove_dir "${PORT_WINE_TMP_PATH}/${RM_LIBS}" do try_remove_dir "${PORT_WINE_TMP_PATH}/${RM_LIBS}"
done done
fi fi
...@@ -2194,9 +2196,9 @@ pw_check_and_download_plugins () { ...@@ -2194,9 +2196,9 @@ pw_check_and_download_plugins () {
try_remove_file "${PORT_WINE_TMP_PATH}/plugins${PW_PLUGINS_VER}.tar.xz" try_remove_file "${PORT_WINE_TMP_PATH}/plugins${PW_PLUGINS_VER}.tar.xz"
# TODO: drop clear prefix, and add update prefix from new plugins # TODO: drop clear prefix, and add update prefix from new plugins
pw_clear_pfx pw_clear_pfx
if ls "${PORT_WINE_TMP_PATH}" | grep plugins_v | grep -v "plugins${PW_PLUGINS_VER}" if lsbash "${PORT_WINE_TMP_PATH}" --grep plugins_v --grep -v "plugins${PW_PLUGINS_VER}"
then then
for RM_PLUGINS in $(ls "${PORT_WINE_TMP_PATH}" | grep plugins_v | grep -v "plugins${PW_PLUGINS_VER}") for RM_PLUGINS in $(lsbash "${PORT_WINE_TMP_PATH}" --grep plugins_v --grep -v "plugins${PW_PLUGINS_VER}")
do try_remove_dir "${PORT_WINE_TMP_PATH}/${RM_PLUGINS}" do try_remove_dir "${PORT_WINE_TMP_PATH}/${RM_PLUGINS}"
done done
fi fi
...@@ -2227,9 +2229,9 @@ pw_check_and_download_plugins () { ...@@ -2227,9 +2229,9 @@ pw_check_and_download_plugins () {
try_remove_file "${PORT_WINE_TMP_PATH}/plugins${PW_PLUGINS_VER}.tar.xz" try_remove_file "${PORT_WINE_TMP_PATH}/plugins${PW_PLUGINS_VER}.tar.xz"
# TODO: drop clear prefix, and add update prefix from new plugins # TODO: drop clear prefix, and add update prefix from new plugins
pw_clear_pfx pw_clear_pfx
if ls "${PORT_WINE_TMP_PATH}" | grep plugins_v | grep -v "plugins${PW_PLUGINS_VER}" if lsbash "${PORT_WINE_TMP_PATH}" --grep plugins_v --grep -v "plugins${PW_PLUGINS_VER}"
then then
for RM_PLUGINS in $(ls "${PORT_WINE_TMP_PATH}" | grep plugins_v | grep -v "plugins${PW_PLUGINS_VER}") for RM_PLUGINS in $(lsbash "${PORT_WINE_TMP_PATH}" --grep plugins_v --grep -v "plugins${PW_PLUGINS_VER}")
do try_remove_dir "${PORT_WINE_TMP_PATH}/${RM_PLUGINS}" do try_remove_dir "${PORT_WINE_TMP_PATH}/${RM_PLUGINS}"
done done
fi fi
...@@ -2356,7 +2358,7 @@ pw_init_db () { ...@@ -2356,7 +2358,7 @@ pw_init_db () {
# shellcheck source=/dev/null # shellcheck source=/dev/null
source "${PORTWINE_DB_FILE}" source "${PORTWINE_DB_FILE}"
if echo "${portwine_exe}" | grep "/prefixes/" &>/dev/null ; then if echo "${portwine_exe}" | grep "/prefixes/" &>/dev/null ; then
if [[ -z $(ls "${PORT_WINE_PATH}/prefixes/" | grep -e ^"${PW_PREFIX_NAME}"$) ]] \ if [[ -z $(lsbash "${PORT_WINE_PATH}/prefixes/" --grep ^"${PW_PREFIX_NAME}"$) ]] \
|| [[ -z $(grep -e ^"export PW_PREFIX_NAME=" "${PORTWINE_DB_FILE}" 2>/dev/null) ]] || [[ -z $(grep -e ^"export PW_PREFIX_NAME=" "${PORTWINE_DB_FILE}" 2>/dev/null) ]]
then then
PW_PREFIX_NAME=$(echo "${portwine_exe}" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}') PW_PREFIX_NAME=$(echo "${portwine_exe}" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}')
...@@ -2396,7 +2398,7 @@ pw_init_db () { ...@@ -2396,7 +2398,7 @@ pw_init_db () {
try_copy_file "${PW_FIND_DB_FILE}" "${portwine_exe}".ppdb try_copy_file "${PW_FIND_DB_FILE}" "${portwine_exe}".ppdb
PORTWINE_DB_FILE="${portwine_exe}".ppdb PORTWINE_DB_FILE="${portwine_exe}".ppdb
if echo "${portwine_exe}" | grep "/prefixes/" &>/dev/null ; then if echo "${portwine_exe}" | grep "/prefixes/" &>/dev/null ; then
if [[ -z $(ls "${PORT_WINE_PATH}/prefixes/" | grep -e ^"${PW_PREFIX_NAME}"$) ]] \ if [[ -z $(lsbash "${PORT_WINE_PATH}/prefixes/" --grep ^"${PW_PREFIX_NAME}"$) ]] \
|| [[ -z $(grep -e ^"export PW_PREFIX_NAME=" "${PORTWINE_DB_FILE}" 2>/dev/null) ]] || [[ -z $(grep -e ^"export PW_PREFIX_NAME=" "${PORTWINE_DB_FILE}" 2>/dev/null) ]]
then then
PW_PREFIX_NAME=$(echo "${portwine_exe}" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}') PW_PREFIX_NAME=$(echo "${portwine_exe}" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}')
...@@ -2445,7 +2447,7 @@ pw_init_db () { ...@@ -2445,7 +2447,7 @@ pw_init_db () {
if [[ "${PW_WINE_CPU_TOPOLOGY}" == "disabled" ]] && [[ -n "${WINE_CPU_TOPOLOGY}" ]] ; then if [[ "${PW_WINE_CPU_TOPOLOGY}" == "disabled" ]] && [[ -n "${WINE_CPU_TOPOLOGY}" ]] ; then
export PW_WINE_CPU_TOPOLOGY="${WINE_CPU_TOPOLOGY}" export PW_WINE_CPU_TOPOLOGY="${WINE_CPU_TOPOLOGY}"
fi fi
if ls "${PATH_TO_GAME}"/*_Data/Resources/ 2>/dev/null | grep "unity" &>/dev/null \ if lsbash "${PATH_TO_GAME}"/*_Data/Resources/ --grep "unity" &>/dev/null \
&& [[ "${PW_WINE_CPU_TOPOLOGY}" == "disabled" ]] \ && [[ "${PW_WINE_CPU_TOPOLOGY}" == "disabled" ]] \
&& [[ $(grep -c ^"processor" /proc/cpuinfo) -gt "8" ]] && [[ $(grep -c ^"processor" /proc/cpuinfo) -gt "8" ]]
then then
......
...@@ -121,7 +121,7 @@ echo "" > "${PW_TMPFS_PATH}/tmp_yad_form_vulkan" ...@@ -121,7 +121,7 @@ echo "" > "${PW_TMPFS_PATH}/tmp_yad_form_vulkan"
create_new_dir "${PORT_WINE_PATH}/data/dist" create_new_dir "${PORT_WINE_PATH}/data/dist"
IFS=$'\n' IFS=$'\n'
for dist_dir in $(ls -1 "${PORT_WINE_PATH}/data/dist") ; do for dist_dir in $(lsbash "${PORT_WINE_PATH}/data/dist/") ; do
dist_dir_new=$(echo "${dist_dir}" | awk '$1=$1' | sed -e s/[[:blank:]]/_/g) dist_dir_new=$(echo "${dist_dir}" | awk '$1=$1' | sed -e s/[[:blank:]]/_/g)
if [[ ! -d "${PORT_WINE_PATH}/data/dist/${dist_dir_new^^}" ]] ; then if [[ ! -d "${PORT_WINE_PATH}/data/dist/${dist_dir_new^^}" ]] ; then
mv -- "${PORT_WINE_PATH}/data/dist/$dist_dir" "${PORT_WINE_PATH}/data/dist/${dist_dir_new^^}" mv -- "${PORT_WINE_PATH}/data/dist/$dist_dir" "${PORT_WINE_PATH}/data/dist/${dist_dir_new^^}"
......
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