forked from CastroFidel/PortWINE
		
	Scripts version 2328
This commit is contained in:
		| @@ -994,65 +994,7 @@ stop_portwine () { | ||||
|     if [[ ! -z "$(pgrep -a yad_gui_pp | grep "\--notification" | awk '{print $1}')" ]] ; then | ||||
|         kill -s SIGUSR1 "$(pgrep -a yad_gui_pp | grep "\--notification" | awk '{print $1}')" 2>/dev/null | ||||
|     fi | ||||
|  | ||||
|     for prefix_dir in "${PORT_WINE_PATH}"/prefixes/* ; do | ||||
|         DESKTOP_DIRS+=( | ||||
|             "${prefix_dir}/drive_c/users/steamuser/Desktop" | ||||
|             "${prefix_dir}/drive_c/users/Public/Desktop" | ||||
|         ) | ||||
|     done | ||||
|  | ||||
|     for dir in "${DESKTOP_DIRS[@]}" ; do | ||||
|         while IFS= read -r -d '' link_file; do | ||||
|             LINKS+=("$link_file") | ||||
|         done < <(find "$dir" -type f -iname "*.lnk" -print0 2>/dev/null | sort -u) | ||||
|     done | ||||
|  | ||||
|     for link_file in "${LINKS[@]}"; do | ||||
|         if timeout 3 exiftool "$link_file" 2>/dev/null > "${PW_TMPFS_PATH}/exiftool.tmp" ; then | ||||
|             prefix_name=$(echo "$link_file" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}') | ||||
|             if fix_icon_name=$(grep -i "Icon File Name" "${PW_TMPFS_PATH}/exiftool.tmp" 2>/dev/null) \ | ||||
|             && [[ "${fix_icon_name//*.exe/true}" == "true" ]] ; then | ||||
|                 link_drive=$(sed -n 's/^Icon File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | cut -d: -f1 | awk '{print tolower($0)}') | ||||
|                 link_path=$(sed -n 's/^Icon File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|%ProgramFiles(x86)%|C:\\Program Files (x86)|gi;s|%ProgramFiles%|C:\\Program Files|gi' | sed "s|^.|${PORT_WINE_PATH}/data/prefixes/$prefix_name/dosdevices/$link_drive|g" | sed 's/\\/\//g') | ||||
|             else | ||||
|                 link_drive=$(sed -n 's/^Local Base Path\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | cut -d: -f1 | awk '{print tolower($0)}') | ||||
|                 link_path=$(sed -n 's/^Local Base Path\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|%ProgramFiles(x86)%|C:\\Program Files (x86)|gi;s|%ProgramFiles%|C:\\Program Files|gi' | sed "s|^.|${PORT_WINE_PATH}/data/prefixes/$prefix_name/dosdevices/$link_drive|g" | sed 's/\\/\//g') | ||||
|             fi | ||||
|             link_name=$(sed -n 's/^File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|\.lnk||') | ||||
|             link_cmd=$(sed -n 's/^Command Line Arguments\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp") | ||||
|         else | ||||
|             if ! command -v exiftool &>/dev/null ; then | ||||
|                 print_warning "use portable exiftool" | ||||
|                 env PERL5LIB="${PW_PLUGINS_PATH}/portable/lib/perl5" "${PW_PLUGINS_PATH}/portable/bin/exiftool" "$link_file" 2>/dev/null > "${PW_TMPFS_PATH}/exiftool.tmp" | ||||
|                 prefix_name=$(echo "$link_file" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}') | ||||
|                 if fix_icon_name=$(grep -i "Icon File Name" "${PW_TMPFS_PATH}/exiftool.tmp" 2>/dev/null) \ | ||||
|                 && [[ "${fix_icon_name//*.exe/true}" == "true" ]] ; then | ||||
|                     link_drive=$(sed -n 's/^Icon File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | cut -d: -f1 | awk '{print tolower($0)}') | ||||
|                     link_path=$(sed -n 's/^Icon File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|%ProgramFiles(x86)%|C:\\Program Files (x86)|gi;s|%ProgramFiles%|C:\\Program Files|gi' | sed "s|^.|${PORT_WINE_PATH}/data/prefixes/$prefix_name/dosdevices/$link_drive|g" | sed 's/\\/\//g') | ||||
|                 else | ||||
|                     link_drive=$(sed -n 's/^Local Base Path\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | cut -d: -f1 | awk '{print tolower($0)}') | ||||
|                     link_path=$(sed -n 's/^Local Base Path\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|%ProgramFiles(x86)%|C:\\Program Files (x86)|gi;s|%ProgramFiles%|C:\\Program Files|gi' | sed "s|^.|${PORT_WINE_PATH}/data/prefixes/$prefix_name/dosdevices/$link_drive|g" | sed 's/\\/\//g') | ||||
|                 fi | ||||
|                 link_name=$(sed -n 's/^File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|\.lnk||') | ||||
|                 link_cmd=$(sed -n 's/^Command Line Arguments\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp") | ||||
|             else | ||||
|                 yad_error "exiftool - broken!" | ||||
|             fi | ||||
|         fi | ||||
|         if ! exe_path="$(realpath "${link_path}")" ; then | ||||
|             try_remove_file "$link_file" | ||||
|             print_warning "Removed broken link for: $link_name" | ||||
|         else | ||||
|             create_shortcut_from_link | ||||
|             if [[ "${SHORTCUT_DUPLICATE}" == "true" ]] ; then | ||||
|                 print_info "Created link for duplicate: $link_name - $prefix_name [$number_duplication]" | ||||
|             else | ||||
|                 print_info "Created link for: $link_name" | ||||
|             fi | ||||
|         fi | ||||
|     done | ||||
|  | ||||
|     pw_auto_create_shortcut | ||||
|     add_in_stop_portwine | ||||
|     unset SKIP_CHECK_UPDATES | ||||
|     exit 0 | ||||
| @@ -1376,8 +1318,6 @@ create_shortcut_from_link () { | ||||
|     PORTPROTON_NAME="$link_name" | ||||
|     PW_RESIZE_TO=128 | ||||
|  | ||||
|     try_remove_file "${PORT_WINE_PATH}/data/img/setup.png" | ||||
|     try_remove_file "${PORT_WINE_PATH}/data/img/Setup.png" | ||||
|     try_remove_file "${PORT_WINE_PATH}/data/img/launcher.png" | ||||
|     try_remove_file "${PORT_WINE_PATH}/data/img/Launcher.png" | ||||
|  | ||||
| @@ -1397,7 +1337,6 @@ create_shortcut_from_link () { | ||||
|         fi | ||||
|     fi | ||||
|  | ||||
|     rm -f "${link_file}" | ||||
|     if [[ -f "${PORT_WINE_PATH}/${PORTPROTON_NAME}.desktop" ]] ; then | ||||
|         if ! grep -i "${exe_path}" "${PORT_WINE_PATH}/${PORTPROTON_NAME}.desktop" &>/dev/null ; then | ||||
|             create_new_dir "${PORT_WINE_PATH}/duplicate" | ||||
| @@ -1484,6 +1423,68 @@ create_shortcut_from_link () { | ||||
|     fi | ||||
| } | ||||
|  | ||||
| pw_auto_create_shortcut () { | ||||
|     [[ "${PW_CHECK_AUTOINSTALL}" == 1 ]] && return 0 | ||||
|     unset LINKS | ||||
|     orig_IFS="$IFS" && IFS=$'\n' | ||||
|     for link_file in "${PORT_WINE_PATH}"/prefixes/*/drive_c/users/steamuser/Desktop/*.lnk | ||||
|     do | ||||
|         if echo "$link_file" | grep "\*.lnk" &>/dev/null | ||||
|         then continue | ||||
|         else LINKS+=("$link_file") | ||||
|         fi | ||||
|     done | ||||
|     IFS="$orig_IFS" | ||||
|     [[ -z "$LINKS" ]] && return 0 | ||||
|  | ||||
|     for link_file in "${LINKS[@]}"; do | ||||
|         if timeout 3 exiftool "$link_file" 2>/dev/null > "${PW_TMPFS_PATH}/exiftool.tmp" ; then | ||||
|             prefix_name=$(echo "$link_file" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}') | ||||
|             if fix_icon_name=$(grep -i "Icon File Name" "${PW_TMPFS_PATH}/exiftool.tmp" 2>/dev/null) \ | ||||
|             && [[ "${fix_icon_name//*.exe/true}" == "true" ]] ; then | ||||
|                 link_drive=$(sed -n 's/^Icon File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | cut -d: -f1 | awk '{print tolower($0)}') | ||||
|                 link_path=$(sed -n 's/^Icon File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|%ProgramFiles(x86)%|C:\\Program Files (x86)|gi;s|%ProgramFiles%|C:\\Program Files|gi' | sed "s|^.|${PORT_WINE_PATH}/data/prefixes/$prefix_name/dosdevices/$link_drive|g" | sed 's/\\/\//g') | ||||
|             else | ||||
|                 link_drive=$(sed -n 's/^Local Base Path\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | cut -d: -f1 | awk '{print tolower($0)}') | ||||
|                 link_path=$(sed -n 's/^Local Base Path\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|%ProgramFiles(x86)%|C:\\Program Files (x86)|gi;s|%ProgramFiles%|C:\\Program Files|gi' | sed "s|^.|${PORT_WINE_PATH}/data/prefixes/$prefix_name/dosdevices/$link_drive|g" | sed 's/\\/\//g') | ||||
|             fi | ||||
|             link_name=$(sed -n 's/^File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|\.lnk||') | ||||
|             link_cmd=$(sed -n 's/^Command Line Arguments\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp") | ||||
|         else | ||||
|             if ! command -v exiftool &>/dev/null ; then | ||||
|                 print_warning "use portable exiftool" | ||||
|                 env PERL5LIB="${PW_PLUGINS_PATH}/portable/lib/perl5" "${PW_PLUGINS_PATH}/portable/bin/exiftool" "$link_file" 2>/dev/null > "${PW_TMPFS_PATH}/exiftool.tmp" | ||||
|                 prefix_name=$(echo "$link_file" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}') | ||||
|                 if fix_icon_name=$(grep -i "Icon File Name" "${PW_TMPFS_PATH}/exiftool.tmp" 2>/dev/null) \ | ||||
|                 && [[ "${fix_icon_name//*.exe/true}" == "true" ]] ; then | ||||
|                     link_drive=$(sed -n 's/^Icon File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | cut -d: -f1 | awk '{print tolower($0)}') | ||||
|                     link_path=$(sed -n 's/^Icon File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|%ProgramFiles(x86)%|C:\\Program Files (x86)|gi;s|%ProgramFiles%|C:\\Program Files|gi' | sed "s|^.|${PORT_WINE_PATH}/data/prefixes/$prefix_name/dosdevices/$link_drive|g" | sed 's/\\/\//g') | ||||
|                 else | ||||
|                     link_drive=$(sed -n 's/^Local Base Path\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | cut -d: -f1 | awk '{print tolower($0)}') | ||||
|                     link_path=$(sed -n 's/^Local Base Path\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|%ProgramFiles(x86)%|C:\\Program Files (x86)|gi;s|%ProgramFiles%|C:\\Program Files|gi' | sed "s|^.|${PORT_WINE_PATH}/data/prefixes/$prefix_name/dosdevices/$link_drive|g" | sed 's/\\/\//g') | ||||
|                 fi | ||||
|                 link_name=$(sed -n 's/^File Name\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp" | sed 's|\.lnk||') | ||||
|                 link_cmd=$(sed -n 's/^Command Line Arguments\s*:\s*//p' "${PW_TMPFS_PATH}/exiftool.tmp") | ||||
|             else | ||||
|                 yad_error "exiftool - broken!" | ||||
|             fi | ||||
|         fi | ||||
|          | ||||
|         try_remove_file "$link_file" | ||||
|  | ||||
|         if ! exe_path="$(realpath "${link_path}")" ; then | ||||
|             print_warning "Removed broken link for: $link_name" | ||||
|         else | ||||
|             if [[ "${SHORTCUT_DUPLICATE}" == "true" ]] ; then | ||||
|                 print_info "Created link for duplicate: $link_name - $prefix_name [$number_duplication]" | ||||
|             else | ||||
|                 print_info "Created link for: $link_name" | ||||
|             fi | ||||
|             create_shortcut_from_link | ||||
|         fi | ||||
|     done | ||||
| } | ||||
|  | ||||
| pw_init_db () { | ||||
|     if [[ -f "${portwine_exe}" ]] ; then | ||||
|         PORTWINE_DB="$(basename "${portwine_exe}" .exe)" | ||||
| @@ -2093,6 +2094,7 @@ start_portwine () { | ||||
|             pw_wineboot -r | ||||
|         fi | ||||
|     fi | ||||
|     rm -f "${PORT_WINE_PATH}"/prefixes/*/drive_c/users/*/Desktop/*.lnk | ||||
|  | ||||
|     echo "${PW_WINE_USE}" > "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/.wine_ver" | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| #!/usr/bin/env bash | ||||
| #Author: Castro-Fidel (linux-gaming.ru) | ||||
| #SCRIPTS_NEXT_VERSION=2327 | ||||
| #SCRIPTS_NEXT_VERSION=2328 | ||||
| #SCRIPTS_STABLE_VERSION=2327 | ||||
| ######################################################################## | ||||
| export LANGUAGES_LIST="ru es" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user