brezerk / q4wine

Q4Wine is a Qt GUI for W.I.N.E. It will help you manage wine prefixes and installed applications.
http://q4wine.brezblock.org.ua/
GNU General Public License v3.0
207 stars 40 forks source link

[Feature Request] Support Fuse overlayfs for layered WINE prefixes #136

Closed pchome closed 5 years ago

pchome commented 6 years ago

I'm currently experimenting with such prefixes, but it's hard to manually control all mount/unmount commands. It would be great if q4wine can add experimental support for prefixes mounted with fuse-overlayfs.

More details:


For first step:

Next step:

brezerk commented 6 years ago

Thank you for the feature request.

Sounds interesting.

I am on vocation atm, will review it on monday.

ср, 5 сент. 2018 г., 7:15 ПП pchome notifications@github.com:

I'm currently experimenting with such prefixes, but it's hard to manually control all mount/unmount commands. It would be great if q4wine can add experimental support for prefixes mounted with fuse-overlayfs.

More details:


For first step:

-

create such prefixes

  • check current WINE version ($ wine --version) and create corresponding base layer e.g. opfx-win64-base-wine-3.15
    • split common components from base to e.g. opfx-win64-common-wine-3.15
    • create "workspace" e.g. opfx-myprefix-user, opfx-myprefix-work and opfx-myprefix
  • mount/unmount on game/tool run/stop

    $ fuse-overlayfs -o lowerdir=opfx-win64-common-wine-3.15:opfx-win64-base-wine-3.15,upperdir=opfx-myprefix-user,workdir=opfx-myprefix-work opfx-myprefix

    or for opfx-myprefix2

    $ fuse-overlayfs -o lowerdir=opfx-win64-common-wine-3.15:opfx-win64-base-wine-3.15,upperdir=opfx-myprefix2-user,workdir=opfx-myprefix2-work opfx-myprefix2

    or add preconfigured template (opfx-myprefix-user layer can be used as template after an "initial setup stage")

    $ fuse-overlayfs -o lowerdir=opfx-win64-template-mypreconf:opfx-win64-common-wine-3.15:opfx-win64-base-wine-3.15,upperdir=opfx-myprefix3-user,workdir=opfx-myprefix3-work opfx-myprefix3

    unmount

    $ fusermount3 -u opfx-myprefix

Next step:

  • convert from/to regular WINE prefix
  • advanced manage

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/brezerk/q4wine/issues/136, or mute the thread https://github.com/notifications/unsubscribe-auth/AABdDNauPSHvO4cH1HVmIuUJYP_9s7xfks5uX_iGgaJpZM4WbPsy .

pchome commented 5 years ago

Here is some example scripts (to log required steps). I used those to create new opfx base for fresh wine version, then using it with new and an old prefixes.

Upgrade from wine-3.15 to wine-3.16 was smooth as expected, except part with .update-timestamp, this needed for wine to not recreate/update prefix.

x_opfx_conf opfx_dir="/media/Games/wineprefix" wine_ver="$(wine --version)" # compatible commons common_ver="wine-3.15"
x_opfx_init #!/bin/bash # config data . x_opfx_conf cd "${opfx_dir}" export WINEPREFIX="${opfx_dir}/opfx-win64-base-${wine_ver}" # init prefix [[ ! -d ${WINEPREFIX} ]] && wineboot --init || exit if [[ ${wine_ver} != ${common_ver} ]]; then # reuse commons ln -s "${opfx_dir}/opfx-win64-common-${common_ver}" "${opfx_dir}/opfx-win64-common-${wine_ver}" # clean prefix rm -rf "${WINEPREFIX}/drive_c/windows/Installer" rm -rf "${WINEPREFIX}/drive_c/windows/Microsoft.NET" rm -rf "${WINEPREFIX}/drive_c/windows/mono" rm -rf "${WINEPREFIX}/drive_c/windows/system32/gecko" rm -rf "${WINEPREFIX}/drive_c/windows/syswow64/gecko" else # Move common components common_target="${opfx_dir}/opfx-win64-common-${wine_ver}/drive_c/windows" mkdir -p "${common_target}" mkdir -p "${common_target}/system32" mkdir -p "${common_target}/syswow64" mv "${WINEPREFIX}/drive_c/windows/Installer" "${common_target}/" mv "${WINEPREFIX}/drive_c/windows/Microsoft.NET" "${common_target}/" mv "${WINEPREFIX}/drive_c/windows/mono" "${common_target}/" mv "${WINEPREFIX}/drive_c/windows/system32/gecko" "${common_target}/system32/" mv "${WINEPREFIX}/drive_c/windows/syswow64/gecko" "${common_target}/syswow64/" fi
x_opfx_mount #!/bin/bash # config data . x_opfx_conf if [[ -z $1 ]]; then echo "Usage: x_opfx_mount " exit else opfx_name="${1}" mkdir -p "${opfx_name}-user" "${opfx_name}-work" "${opfx_name}" fi cd "${opfx_dir}" # unmount fusermount3 -qu ${opfx_name} # wine updated cp "${opfx_dir}/opfx-win64-base-${wine_ver}/.update-timestamp" "${opfx_dir}/${opfx_name}-user/" fuse-overlayfs -o lowerdir=opfx-win64-common-${wine_ver}:opfx-win64-base-${wine_ver},upperdir=${opfx_name}-user,workdir=${opfx_name}-work ${opfx_name}
x_opfx_umount #!/bin/bash # config data . x_opfx_conf if [[ -z $1 ]]; then echo "Usage: x_opfx_umount " exit fi opfx_name="${1}" cd "${opfx_dir}" fusermount3 -u ${opfx_name} && echo "${opfx_name}: unmounted"
brezerk commented 5 years ago

hi @pchome

jfyi: there is an ability to specify pre/post execution scripts per "Icon":

image

it does exposing all required wine variables like WINEPREFIX and so on, it could help a bit in testing.

getting back to the idea.

let's clarify the scope:

this is pretty match to the pre/post scripts idea implemented on pre icon basis. but you would like to have this for prefix level as well?

pchome commented 5 years ago

I would like an option for prefix settings, which will point a prefix is an overlayed prefix and should be mounted before any wine app/util launched.

Then it should be mounted/unmounted on literally every app/util start/stop. E.g. winecfg/winetricks/icon/... , then similar actions in other prefix.

In other words : I want internal "links" to work too. And I don't want to keep many prefixes mounted all the time. And all this without manually running anything. Literally built-in overlayfs support.

If this feature don't suit q4wine's goals -- you can close this issue. Because simply mounting prefix before any actions with q4wine does the same.

brezerk commented 5 years ago

right

so current pre/post scripts are working as you described.

opfx_dir="${WINEPREFIX}"
wine_ver="$(wine --version)"

# compatible commons
common_ver="wine-3.15"

to get the opfx_dir dir dynamically.

you can tests this statements to see if it works as expected on Icon level. If it suits fine -- I could add the same settings/mechanic for the Prefix level too.

pchome commented 5 years ago

Ok, I'll do it later. BTW, I've noticed Proton using wineserver -w, so I'll try this too (in post script).

pchome commented 5 years ago

Let's forget about common stuff, it's too complex for 1st stage and no big difference at the moment.

So using only base as solid newly created WINE prefix, skipping init part, and modified mount/unmount scripts to use $WINEPREFIX env var:

opfx_dir="$(sed 's/[^\/]*$//' <<< $WINEPREFIX)" wine_ver="$(wine --version)"

mkdir -p "${WINEPREFIX}-user" "${WINEPREFIX}-work" "${WINEPREFIX}"

unmount

fusermount3 -qu ${WINEPREFIX}

wine updated

cp "${opfx_dir}/opfx-win64-base-${wine_ver}/.update-timestamp" "${WINEPREFIX}-user/"

fuse-overlayfs -o lowerdir=${opfx_dir}/opfx-win64-base-${wine_ver},upperdir=${WINEPREFIX}-user,workdir=${WINEPREFIX}-work ${WINEPREFIX}

- umount
```bash
#!/bin/bash

opfx_name="$(sed 's/^.*\///' <<< $WINEPREFIX)"

wineserver -w

fusermount3 -u $WINEPREFIX && echo "${opfx_name}: unmounted"

Those two scripts works as pre/post run scripts for icon.

Note:

brezerk commented 5 years ago

Hi @pchome

I can merge the scripts, but maybe it will be better to implement this as a Q4Wine "Plugin" and just WGET'ing it from your git repo's releases (just like it is currently done for winetricks). So you will not depend on q4wine's release cycle (which is currently a bit weird I believe :D)

So pre/post run scripts for icon works fine, right?

default directory for new prefixes

I can export this into Q4WINE_DEFAULT_PREFIXDIR env variable or something if you wish.

As for the next moves: how you would like this to be integrated?

pchome commented 5 years ago

I'm not sure I correctly understand how this "Plugin" supposed to work. Moreover, those scripts meant to be a visual guide, an example how to use fuse-overlayfs. Not for merging as-is into q4wine.

For q4wine I prefer to see something like icotool integration:

  1. check if fuse-overlayfs available
    • enable [ ] Use OverlayFS prefixes (experimental) option in preferences for selection
  2. if selected: check prefix
    • if overlayed: mount
  3. after overlayed prefix mounted, there is no difference (i hope) for WINE compared to regular prefix, so no more work required
  4. for now you may keep all of them mounted (no need to unmount every time)

Note: consider to use opfx-$ARCH-$(wine --version | md5sum) for "base". For e.g. "wine-3.16 (Staging)" versions. A command is an guide, use method preferred for Qt.

pchome commented 5 years ago

Partially resolved by recent WINE/Proton updates. https://github.com/madewokherd/wine-mono/releases/tag/wine-mono-4.8.1

While fuse-overlayfs remains useful for e.g. moding/DLC mounting/..., there is no needs to manually create shared wine components anymore.

brezerk commented 5 years ago

thank you for the info