Coder Social home page Coder Social logo

Comments (8)

Destroyer avatar Destroyer commented on May 24, 2024

you can try

# useradd  -m -d /mnt/bar foo
# adduser foo sudo
# su foo
$ cd ~
$ echo "echo $SUDO_USER" > test.sh
$ sudo sh test.sh

workaround is to rewrite script in way that part of it could run with regular user rights (that part would create stuff for user) and the rest of the installation script would ask you for root

from naga_keypadmapper.

apocatarsis avatar apocatarsis commented on May 24, 2024

Sorry, I did not explain myself well. In the install script I just changed the HOME variable using getent passwd $SUDO_USER. So that is ok. But yeah, as you have root you can just su USER. Good idea, I will keep it in mind.
I meant in naga.cpp, you need to read the configuration from $HOME of the user, but with getenv you get home of root (is this true btw?). I changed so the mapping.txt is read from /home/$SUDO_USER/.naga . But this is not necessarily general.

from naga_keypadmapper.

apocatarsis avatar apocatarsis commented on May 24, 2024

BTW, I am not able to autostart it. Calling naga at the end of nagastart doesnt seem to be enough. And calling sudo naga asks for password, so you cannot auto start it. Any ideas?.
For the moment I am just starting it manually with nohup sudo nagastart.sh > /dev/null

from naga_keypadmapper.

Destroyer avatar Destroyer commented on May 24, 2024
  1. It depends on who owns the process(in most cases). If it's run via root it will check default variable $HOME of root (if not set otherwise). And since we start this tool (at least in ubuntu) with autostart in users profile and the process that starts it owns the user, it does uses his home.
    Also I don't think that you need any tweaking of the executable, if you want to specify HOME for naga executable you can edit nagastart.sh to include export HOME=path and put whatever you need there (if you're the only user, otherwise you need to call it from somewhere else, child processes will share these env variables).
  2. I've made it so that sudo shouldn't be neccessary. Either you can chmod the naga events in /dev/input with chmod o+r or you use this https://github.com/apocatarsis/Naga_KeypadMapper/blob/master/install.sh#L46-L48
    either way the executable should work without root privileges, that was my intention

from naga_keypadmapper.

apocatarsis avatar apocatarsis commented on May 24, 2024
  1. Yeah the export HOME is much secure. I'll change it.
  2. Oh really? I'll check later, not needing root would be dope!

from naga_keypadmapper.

apocatarsis avatar apocatarsis commented on May 24, 2024

Ok so now I am a bit lost. Please give me a hand whenever you can. I think I may screwed up a little. Using the current master:
1. Where does the install.sh copy mapping.txt?, /root/.naga or /home/user/.naga??
2. Where does naga.cpp looks for mapping.txt?, in /root/.naga or /home/user/.naga??
I think the problem with the user in the other issue could be related to this.

Thank you very much Destroyer. I appologize for the inconvinience..

from naga_keypadmapper.

Destroyer avatar Destroyer commented on May 24, 2024
  1. I thought you should know since you've pushed this commit, but afaik it should copy mapping.txt to home/user/.naga (but I dunno why using this complicated syntax)
  2. As I've said it depends if it's ran by root it looks at /root/ (or $HOME of root) and if it's ran by regular user it looks at /home/user (or $HOME of the user). If it's ran via installation script it will look for mapping in home of that user.

but from what I can see I should push merge from testlab as soon as possible so that I can work on just one version and not two

edit: merged
I've also removed testlab branch in order to prevent issues with merging and commiting as it's not needed right now.

from naga_keypadmapper.

Destroyer avatar Destroyer commented on May 24, 2024

I am closing this ticket now, if you need more help, just reopen it.

from naga_keypadmapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.