Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to use WINETRICKS_LIB #2252

Open
userx14 opened this issue Aug 3, 2024 · 0 comments
Open

Trying to use WINETRICKS_LIB #2252

userx14 opened this issue Aug 3, 2024 · 0 comments

Comments

@userx14
Copy link

userx14 commented Aug 3, 2024

I'm trying to use specific functions of winetricks in another bash file:

export WINETRICKS_LIB=0
source winetricks

The problem is that multiple calls on top level to the w_metadata() function will try to create files in subfolders in $W_TMP_EARLY. But for the subfolders corresponding to the categories to exist, winetricks_init must be run first:

winetricks/src/winetricks

Lines 5393 to 5396 in a41ce69

WINETRICKS_CATEGORIES="apps benchmarks dlls fonts settings mkprefix"
for _W_cat in ${WINETRICKS_CATEGORIES}; do
w_try_mkdir -q "${WINETRICKS_METADATA}/${_W_cat}"
done

It is however not run when WINETRICKS_LIB=0:

winetricks/src/winetricks

Lines 5802 to 5830 in a41ce69

if ! test "${WINETRICKS_LIB}"; then
WINETRICKS_SRCDIR=$(dirname "$0")
WINETRICKS_SRCDIR=$(w_try_cd "${WINETRICKS_SRCDIR}"; pwd)
# Which GUI helper to use (none/zenity/kdialog). See winetricks_detect_gui.
WINETRICKS_GUI=none
# Default to a shared prefix:
WINETRICKS_OPT_SHAREDPREFIX=${WINETRICKS_OPT_SHAREDPREFIX:-1}
# Handle options before init, to avoid starting wine for --help or --version
while winetricks_handle_option "$1"; do
shift
done
# Super gross, but I couldn't find a cleaner way. This needs to be set for the list verbs (maybe others)
# while also supporting `dlls list` (etc.)
# This used by w_metadata() to skip checking installed files if wine isn't available/needed
if echo "$*" | grep -v list-installed | grep -q -w list; then
export _W_wine_not_needed=1
fi
# Workaround for https://github.com/Winetricks/winetricks/issues/599
# If --isolate is used, pass verb to winetricks_init, so it can set the wineprefix using winetricks_set_wineprefix()
# Otherwise, an arch mismatch between ${WINEPREFIX:-$HOME/.wine} and the prefix to be made for the isolated app would cause it to fail
case ${WINETRICKS_OPT_SHAREDPREFIX} in
0) winetricks_init "$1" ;;
*) winetricks_init ;;
esac
fi

Would there be another solution instead of duplicating the functionality of the winetricks_init function in my script?

What I need the use as library for, is making winetricks compatible with nixos flakes. Since winetricks does use wget to download it's installers, it is incompatible to the dependency management. I would like to overwrite the w_download() function with a function that uses results from the nix.fetchurl feature, and just copies the installers to the correct location.

@userx14 userx14 changed the title Trying to use WINETRICKS_LIB, Trying to use WINETRICKS_LIB Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant