I have one software which I cannot modify and it tries to execute Z:/usr/bin/sudo init 0 to poweroff from within Wine.
The solution I have found to make this working, seeming that Wine won't run elf binaries and would exec shell scripts, was to add user to sudoers permitting poweroff and reboot, move sudo to sudobkp, chmoding this and new sudo shellscript to 4755 and write sudo shellscript like that:
Code: Select all
#!/bin/sh
if [ "$1" = "init" ]
then
if [ "$2" = "0" ]
then
( sudo poweroff )
elif [ "$2" = "6" ]
then
( sudo reboot )
fi
else
( /usr/bin/sudobkp $@ )
fi
exit
Is there a cleaner way to do this? I tried taking advantage of precedence of $PATH and writing this script into /usr/local/sbin which comes first (Ubuntu 20.04), it worked from shell but from the software within Wine it doesn't work. I believe it always go executing Z:/usr/bin/sudo directly .
The best "clean" solution I have thought so far is to recreate symlinks to / somewhere with Z: letter mapped there, recreate symlinks from /usr/ after then from /usr/bin/ and changing just sudo not linked there. That really looks a lot of work which I don't know would break another thing (and probably those links would need to be recreated each time bin folder changes).
Do you know a better way to do this?
Thank you!