diff --git a/winehelper b/winehelper index c3b485a..e148af3 100755 --- a/winehelper +++ b/winehelper @@ -88,7 +88,7 @@ check_variables () { [[ -z ${!1} ]] && export $1="$2" ;} ##### CHECK DEBUG ##### if [[ "$1" == "--debug" ]] ; then - check_variables WINEDEBUG "+loaddll,+seh" + check_variables WINEDEBUG "+loaddll" export DXVK_LOG_LEVEL="error" export VKD3D_DEBUG="error" export WINE_MONO_TRACE="E:System.NotImplementedException" @@ -139,7 +139,8 @@ check_variables WINEARCH "win64" # or "win32" check_variables WH_WINE_USE "wine_x_tkg_10-0_amd64" # or system check_variables WH_USE_CPCSP_PROXY "0" -check_variables CPCSP_PROXY_VER "0.6.1-alt1" +check_variables CPCSP_PROXY_X86_64_VER "0.6.1-alt1" +check_variables CPCSP_PROXY_WOW64_VER "0.7.3-alt5-wow64" check_variables WH_USE_EXTRA_FONTS "0" check_variables EXTRA_FONTS_VER "01" @@ -457,9 +458,12 @@ try_copy_wine_dll_to_pfx_64 () { } try_copy_wine_dll_to_pfx_32() { - if [[ -d "$WINEDIR/lib/wine/i386-windows" ]] - then WINE_BUILD_DLL_32="$WINEDIR/lib/wine/i386-windows" - else WINE_BUILD_DLL_32="$WINEDIR/lib/wine" + if [[ -d "$WINEDIR/lib/wine/i386-windows" ]] ; then + WINE_BUILD_DLL_32="$WINEDIR/lib/wine/i386-windows" + elif [[ -d "$WINEDIR/lib64/wine/i386-windows" ]] ; then + WINE_BUILD_DLL_32="$WINEDIR/lib64/wine/i386-windows" + else + WINE_BUILD_DLL_32="$WINEDIR/lib/wine" fi if [[ "$WINEARCH" == "win64" ]] ; then cmp -s "$WINE_BUILD_DLL_32/$1" "${WINEPREFIX}/drive_c/windows/syswow64/$1" && return 0 @@ -870,6 +874,10 @@ init_wine_ver () { fi [[ ! -f "$WINEDIR/version" ]] && echo "$WH_WINE_USE" > "$WINEDIR/version" + if [[ $WH_WINE_USE =~ wow64 ]] + then export WH_WINE_WOW64="1" + else export WH_WINE_WOW64="0" + fi export WINE="$WINEDIR/bin/wine" export WINELOADER="$WINEDIR/bin/wine" @@ -904,21 +912,32 @@ init_wine_ver () { fi fi - if [[ $WH_USE_CPCSP_PROXY == "1" ]] \ - && ! grep -q "$CPCSP_PROXY_VER" "$WINEDIR/cpcsp_proxy.ver" - then - CPCSP_PROXY_NAME="wine-cpcsp_proxy-$CPCSP_PROXY_VER" - CPCSP_PROXY_URL="$CLOUD_URL/$CPCSP_PROXY_NAME.tar.xz" - - try_download cloud "$CPCSP_PROXY_URL" "$WH_TMP_DIR/$CPCSP_PROXY_NAME.tar.xz" check256sum - unpack "$WH_TMP_DIR/$CPCSP_PROXY_NAME.tar.xz" "$WH_TMP_DIR" - - cp -fr "$WH_TMP_DIR/$CPCSP_PROXY_NAME/"i386-* "$WINEDIR/lib/wine/" - if [[ -d "$WINEDIR/lib64" ]] ; then - cp -fr "$WH_TMP_DIR/$CPCSP_PROXY_NAME/"x86_64-* "$WINEDIR/lib64/wine/" + if [[ $WH_USE_CPCSP_PROXY == "1" ]] ; then + local cpcsp_proxy_ver + if [[ $WH_WINE_WOW64 == "1" ]] + then cpcsp_proxy_ver="$CPCSP_PROXY_WOW64_VER" + else cpcsp_proxy_ver="$CPCSP_PROXY_X86_64_VER" + fi + if [[ ! -f "$WINEDIR/cpcsp_proxy.ver" ]] \ + || ! grep -q "$cpcsp_proxy_ver" "$WINEDIR/cpcsp_proxy.ver" + then + CPCSP_PROXY_NAME="wine-cpcsp_proxy-$cpcsp_proxy_ver" + CPCSP_PROXY_URL="$CLOUD_URL/$CPCSP_PROXY_NAME.tar.xz" + + try_download cloud "$CPCSP_PROXY_URL" "$WH_TMP_DIR/$CPCSP_PROXY_NAME.tar.xz" check256sum + unpack "$WH_TMP_DIR/$CPCSP_PROXY_NAME.tar.xz" "$WH_TMP_DIR" + + if [[ $WH_WINE_WOW64 == "1" ]] ; then + cp -fr "$WH_TMP_DIR/$CPCSP_PROXY_NAME/"* "$WINEDIR/lib64/wine/" + else + cp -fr "$WH_TMP_DIR/$CPCSP_PROXY_NAME/"i386-* "$WINEDIR/lib/wine/" + if [[ -d "$WINEDIR/lib64" ]] ; then + cp -fr "$WH_TMP_DIR/$CPCSP_PROXY_NAME/"x86_64-* "$WINEDIR/lib64/wine/" + fi + fi + try_remove_dir "$WH_TMP_DIR/$CPCSP_PROXY_NAME" + echo "$cpcsp_proxy_ver" > "$WINEDIR/cpcsp_proxy.ver" fi - try_remove_dir "$WH_TMP_DIR/$CPCSP_PROXY_NAME" - echo "$CPCSP_PROXY_VER" > "$WINEDIR/cpcsp_proxy.ver" fi else # use system WINE @@ -1244,38 +1263,70 @@ init_wineprefix () { # настраиваем префикс для работы с cpcsp_proxy if [[ $WH_USE_CPCSP_PROXY == "1" ]] ; then - for cpcsp_proxy_file in "cpcsp_proxy.dll" "cpcsp_proxy_setup.exe" ; do - try_copy_wine_dll_to_pfx_64 "$cpcsp_proxy_file" - try_copy_wine_dll_to_pfx_32 "$cpcsp_proxy_file" - done + + local cades_ver="release_2_0_14892" + local url_cades_dll="https://cryptopro.ru/sites/default/files/products/cades/$cades_ver" + + if [[ ! -d "$DRIVE_C/Program Files (x86)/Common Files/Crypto Pro/Shared/" ]] + then + local msi_cades32="cades-win32.msi" + try_download cloud "$url_cades_dll/$msi_cades32" "$WH_TMP_DIR/$msi_cades32" + print_info "Установка КриптоПро ЭЦП Runtime ($msi_cades32)" + WINEDLLOVERRIDES="msxml3=b" wine_run "$WH_TMP_DIR/$msi_cades32" /q + fi + + if [[ "$WINEARCH" == "win64" ]] \ + && [[ ! -d "$DRIVE_C/Program Files/Common Files/Crypto Pro/Shared" ]] + then + local msi_cades64="cades-x64.msi" + try_download cloud "$url_cades_dll/$msi_cades64" "$WH_TMP_DIR/$msi_cades64" + print_info "Установка КриптоПро ЭЦП Runtime ($msi_cades64)" + WINEDLLOVERRIDES="msxml3=b" wine_run "$WH_TMP_DIR/$msi_cades64" /q + fi if ! grep -q "cpcsp_proxy.dll" "$WINEPREFIX/system.reg" ; then - if [[ "$WINEARCH" == "win32" ]] - then cpcsp_proxy_cmd=("$WINELOADER" "cpcsp_proxy_setup.exe") - else cpcsp_proxy_cmd=("${WINELOADER}64" "cpcsp_proxy_setup.exe") + print_info "Запускаем настройку cpcsp_proxy..." + CPCSP_PROXY_OK="0" + + try_copy_wine_dll_to_pfx_64 "cpcsp_proxy.dll" + try_copy_wine_dll_to_pfx_32 "cpcsp_proxy.dll" + + if [[ $WH_WINE_WOW64 == "1" ]] ; then + env WINEDEBUG="fixme-all" "$WINE" "C:\\windows\\system32\\regsvr32.exe" \ + /s /n /i cpcsp_proxy.dll 2>&1 | tee "$WINEPREFIX/cpcsp_setup.log" + + env WINEDEBUG="fixme-all" "$WINE" "C:\\windows\\syswow64\\regsvr32.exe" \ + /s /n /i cpcsp_proxy.dll 2>&1 | tee -a "$WINEPREFIX/cpcsp_setup.log" + else + try_copy_wine_dll_to_pfx_64 "cpcsp_proxy_setup.exe" + try_copy_wine_dll_to_pfx_32 "cpcsp_proxy_setup.exe" + + if [[ "$WINEARCH" == "win32" ]] + then cpcsp_proxy_cmd=("$WINELOADER" "cpcsp_proxy_setup.exe") + else cpcsp_proxy_cmd=("${WINELOADER}64" "cpcsp_proxy_setup.exe") + fi + + set -o pipefail + for ((i=2; i < 6; i++)) ; do + "${cpcsp_proxy_cmd[@]}" | tee "$WINEPREFIX/cpcsp_setup.log" + [[ "${PIPESTATUS[0]}" == "0" ]] && break + print_warning "Попытка $i из 5..." + wait_wineserver + done fi - print_info "Запускаем настройку cpcsp_proxy..." - unset CPCSP_PROXY_OK - set -o pipefail - for ((i=2; i < 6; i++)) ; do - "${cpcsp_proxy_cmd[@]}" | tee "$WINEPREFIX/cpcsp_setup.log" - local CPCSP_EXIT_STATUS="${PIPESTATUS[0]}" - if grep -q "failed to load /opt/cprocsp/" "$WINEPREFIX/cpcsp_setup.log" ; then - fatal "Проверьте правильность установки КриптоПро в системе.\n Инструкция: https://www.altlinux.org/CryptoPro" - fi - - if [[ $CPCSP_EXIT_STATUS == "0" ]] ; then - print_info "Настройка cpcsp_proxy успешно завершена." - CPCSP_PROXY_OK="1" - break - fi - print_warning "Попытка $i из 5..." - wait_wineserver - done - wait_wineserver + if grep -q "failed to load /opt/cprocsp/" "$WINEPREFIX/cpcsp_setup.log" ; then + print_error "Проверьте правильность установки КриптоПро в системе.\n Инструкция: https://www.altlinux.org/CryptoPro" + else + CPCSP_PROXY_OK="1" + fi try_remove_file "$WINEPREFIX/cpcsp_setup.log" - [[ $CPCSP_PROXY_OK != "1" ]] && fatal "Ошибка во время настройки cpcsp_proxy." + + wait_wineserver + if [[ $CPCSP_PROXY_OK == "1" ]] + then print_info "Настройка cpcsp_proxy успешно завершена." + else fatal "Ошибка во время настройки cpcsp_proxy." + fi fi fi