LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-17-2017, 07:54 PM   #1
saxa
Senior Member
 
Registered: Aug 2004
Location: Nova Gorica, Salvador
Distribution: Slackware
Posts: 1,213

Rep: Reputation: 297Reputation: 297Reputation: 297
udevadm and node serialport


Hi I am trying to play a bit with cnc stuff and want to use slackware as my default system for this.
I want to set up a cnc gcode parser with cncjs which therefore requires node for the interface.

Problem arises that node-serialport required udevadm been accesible as normal user.

I saw this bug report and it suggests just symlink udevadm to /usr/bin which in fact worked out for running
the program, but i know this is something not very corect.

So I would like to have some suggestions on what would be the best way to solve those issues.

One thing i have to try is to install node systemwide and not only as a user.

See more details here:
https://github.com/EmergingTechnolog...rt/issues/1085
https://github.com/cncjs/cncjs/issues/197
 
Old 09-18-2017, 07:08 AM   #2
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
I honestly don't know what the best option is, and I agree with them that it is probably best to not hardcode paths, although, it might not hurt to do a quick if/else if statement checking for the existence of udevadm in several common locations and then set a variable for that. (NOTE: the following is a quick "back of the napkin" code and may be slightly off... I've been taking a java programming class and a python class before that, so my bash scripting might be a bit rusty.)

Code:
if [ -e /usr/bin/udevadm ]; then
  UDEVADM_PATH=/usr/bin
elif [ -e /usr/sbin/udevadm ]; then
  UDEVADM_PATH=/usr/sbin
elif [ -e /bin/udevadm ]; then
  UDEVADM_PATH=/bin
elif [ -e /sbin/udevadm ]; then
  UDEVADM_PATH=/sbin
else
  echo "udevadm is not accessible"
  exit 1
fi
Then they could just call udevadm with that variable in front of it... this should feasibly work for almost all distros and any new exceptions could be quickly added.

Code:
const udevadm = `$UDEVADM_PATH/udevadm info --query=property -p $(udevadm info -q path -n ${file})`;
Barring them from updating the program/script, you could also set an alias for udevadm. As a regular user, you still have the ability to run udevadm (just without root permissions), it just isn't in your PATH file. This prevents you from cluttering up the actual filesystem with symlinks. So you could set up something like the following in a ~/.bashrc to have it map the udevadm command to the correct location.

Code:
alias udevadm=/sbin/udevadm
 
Old 09-18-2017, 08:30 AM   #3
saxa
Senior Member
 
Registered: Aug 2004
Location: Nova Gorica, Salvador
Distribution: Slackware
Posts: 1,213

Original Poster
Rep: Reputation: 297Reputation: 297Reputation: 297
Thanks for the alias solution, I will play a bit with few various options to see which one will fit better. For now doing a symlink
just worked out, but yeah its not my favourit solution.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rhel 2 node cluster: resources do not move to second node when node halted tapuhi Linux - Software 1 03-01-2015 10:41 AM
node recovery when the node becomes fault by using another node to replace it jerinc Linux - Wireless Networking 0 02-21-2014 05:44 PM
How to transfer the services from node 1 to node 2 ,if node 1 is directly turned off sankarg304 Linux - Server 1 12-12-2012 10:06 AM
Serialport configuration hcz Linux - Hardware 8 08-03-2006 09:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration