SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-31-2010, 03:32 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Using wine from exec() in a plugin

I need help from a linux guru on how to launch a program in wine from within a plugin using exec(). I can launch wine (and the windows program) but it only runs if I set the owner of wine's home directory to root.

I've installed wine (on Ubuntu) as user tom. I'm running sage as root (as far as I know I must do that) using the command "sudo ./startsage".

I am using the following Java code to setup the environment and launch comskip:

Code:
Runtime.getRuntime().exec(command, env);
If the owner of /home/tom/.wine is "tom" wine gives me an error saying:
Quote:
wine: /home/tom/.wine is not owned by you
If I change the owner of /home/tom/.wine to root wine works properly. How do I get this to work? Is there a way to launch wine as a user instead of as root?
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #2  
Old 07-31-2010, 10:14 AM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
Could you check if /root/.wine exists else run winecfg?

You can also run a command as a user as such:

su -c 'command with paramters' user

But I would think you couldn't guarantee which user to run the command as.

B
__________________
Running SageTV on unRAID via Docker
Tuning handled by HDHR3-6CC-3X2 using OpenDCT
Reply With Quote
  #3  
Old 07-31-2010, 10:41 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Lot's of issues to figure out with this. For now I'm just copping out and having the user select the .wine directory in the configuration. It's only an issue with linux (maybe Mac too, but no way for me to test) and I figure anybody who is using linux must know what they are doing so setting this parameter won'e be a big deal.

I think forcing root to OWN the directory (assuming wine is installed as a user) IS a big deal because once root owns .wine nothing can be run under wine as the user anymore. Ugly.

Unfortunately I know just enough about linux to be dangerous.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #4  
Old 07-31-2010, 10:50 AM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
You could run this during install on linux:
Code:
if ! [[ -d ~/.wine ]]; then winecfg; fi
__________________
Running SageTV on unRAID via Docker
Tuning handled by HDHR3-6CC-3X2 using OpenDCT
Reply With Quote
  #5  
Old 07-31-2010, 11:39 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
I've got close to 0 bash experience. I'm assuming this checks to see if the .wine directory exists in the root's home, and if it does not it runs winecfg?

winecfg uses a GUI and I have no idea how to run that during the plugin install process.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #6  
Old 07-31-2010, 12:22 PM
bcjenkins bcjenkins is offline
SageTVaholic
 
Join Date: Jan 2006
Posts: 3,764
In my testing I didn't need a .wine directory it was created on the first go. Also, running the command above will check to see if the user's home directory has the .wine directory. It won't matter who the user is. If you assume root, you would be wrong in my usage of sagetv.

What happens when you just run the comskip command without specifying the wine cfg directory?


B
__________________
Running SageTV on unRAID via Docker
Tuning handled by HDHR3-6CC-3X2 using OpenDCT
Reply With Quote
  #7  
Old 07-31-2010, 12:51 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
In my testing there needed to be an environment variable WINEPREFIX set to point to where the .wine directory was located. I think it also needs WINEPATH so I set that as well. If the environment variable was not set wine would not run.

I'm a complete novice with wine and open to advice and constructive criticism. I never even installed wine until I started testing this plugin. (Although I have drunk a lot of wine over the years, but that is another story.)

The kludgy solution I have in mind is to tell users to make a dedicated user, run winecfg as that user, chown the .wine directory to root and then point the plugin at that directory. It's ugly but it will work for now.

I'm shooting to release a beta this weekend so I may have to settle for that kludge until I can figure out something better.

Advice welcome.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #8  
Old 08-02-2010, 06:02 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Thanks to bcjenkins I think I have a possible solution. My plan is to use sudo to run wine as a user. It sounds easy enough which makes me believe I have missed something really obvious.

Thoughts?
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Plugin: MizookLCD (Alternate SageTV LCDSmartie Plugin) cslatt SageTV Customizations 48 06-11-2012 10:44 AM
MediaPlayer Plugin/STV Import: Winamp Media Player Plugin deria SageTV Customizations 447 12-11-2010 07:38 PM
String[] and exec() in Java tmiranda SageTV Studio 8 07-31-2010 10:33 AM
Linux Comskip without Wine? btf1962 SageTV Customizations 3 04-27-2010 08:16 PM


All times are GMT -6. The time now is 12:39 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.