Opticos / GWSL-Source

The actual code for GWSL. And some prebuilt releases.
https://opticos.github.io/gwsl/
Other
1.16k stars 80 forks source link

Getting DBUS to work? #58

Open Andrew-J-Larson opened 3 years ago

Andrew-J-Larson commented 3 years ago

Also I noticed something in https://github.com/Opticos/GWSL-Source/blob/master/assets/GWSL_helper.sh:

Is there a reason for the double slashes at lines 114 and 117?:

...
113     echo "injecting dbus into .profile"
114     sed -i.bak '//etc/init.d/dbus start/d' ~/.profile
115     echo "sudo /etc/init.d/dbus start" >> ~/.profile
116     
117     sed -i.bak '//etc/init.d/dbus start/d' ~/.bashrc
118     echo "sudo /etc/init.d/dbus start" >> ~/.bashrc
...
Pololot64 commented 3 years ago

I am not sure about what to do with the dbus button. I think I did it wrong and wonder if it works for that many people. Can you think of other ways to make it work? Also, I will push the changes I made to the helper.sh file soon. They are mid-progress but closer to working.

Andrew-J-Larson commented 3 years ago

I actually did find my own way to get it automatically started, but it requires using the /etc/profile.d/ directory and creating/adding a script to be called with sudo for all nopass. I'll relay the details if you think it would be better.

Andrew-J-Larson commented 3 years ago

Made a script ...

at /usr/local/bin/gwsl-fix-dbus.sh

#!/bin/bash

ps -e | grep -q "dbus\-daemon"
if [ $? -eq 1 ]; then
  service dbus start > /dev/null 2>&1
fi

Then ran sudo chown root: /usr/local/bin/gwsl-fix-dbus.sh and sudo chmod 755 /usr/local/bin/gwsl-fix-dbus.sh

Made a second script ...

at /etc/profile.d/gwsl-fixes.sh

#!/bin/bash

sudo /usr/local/bin/gwsl-fix-dbus.sh

Then ran sudo chown root: /etc/profile.d/gwsl-fixes.sh and sudo chmod 777 /etc/profile.d/gwsl-fixes.sh

Lastly, edited sudoers ...

via sudo visudo and added the following line

# Fixes GWSL dbus not starting issue
ALL ALL=(root) NOPASSWD: /usr/local/bin/gwsl-fix-dbus.sh

And then optionally restart Ubuntu, or start up another session (via an app or terminal)

This may be helpful to script the visudo part.

Andrew-J-Larson commented 3 years ago

The main advantage of this is, it doesn't rely having to be put in every user's profile, and it should start up only when it needs to, and every time ubuntu gets started.

Not sure how much of my scripts can be used in other distros though.

Pololot64 commented 3 years ago

Thanks! Hmm. I'll look into it. I don't really want to edit sudoers so I currently just ask for the password every time a shortcut uses dbus. I gtg afk

Andrew-J-Larson commented 3 years ago

No problem 👌🏻