libthinkpad / dockd

Lenovo ThinkPad Dock Management Daemon. Docs:
http://thinkpads.org/projects/dockd/
Other
131 stars 22 forks source link

Hook scripts are not executed #31

Open joseon-penggwin opened 4 years ago

joseon-penggwin commented 4 years ago

Hi,

I installed dockd according to the readme and have it running now.

Although, the dock and undock scripts are not working.

The scripts are executeable and work well when I call them manually, but don't work when I let them call automatically through dockd.

/etc/dockd$ ls -la
total 32
drwxr-xr-x   2 root root  4096 Dez 13 11:56 .
drwxr-xr-x 147 root root 12288 Dez 13 11:12 ..
-rw-r--r--   1 root root   342 Dez 13 11:17 docked.conf
-rwxr--r--   1 root root   587 Dez 13 11:56 dock.hook
-rw-r--r--   1 root root   272 Dez 13 11:19 undocked.conf
-rwxr--r--   1 root root   283 Dez 13 11:56 undock.hook

My dock.hook and undock.hook respectively look like this:

...
echo "Docking at: " $(date) >> /home/user/Desktop/test
...

Alas, both don't work.

Lenovo T480s, Xubuntu 18.04

If there's anything you need, just ask.

dkim286 commented 4 years ago

I'm experiencing the same issue on X220. I made a quick and dirty fix (https://github.com/libthinkpad/dockd/pull/33) and waiting for the maintainer's input.

smclt30p commented 4 years ago

The scripts must be executable.


From: dkim286 notifications@github.com Sent: Wednesday, April 8, 2020 11:02:35 PM To: libthinkpad/dockd dockd@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [libthinkpad/dockd] Hook scripts are not executed (#31)

I'm experiencing the same issue on X220. I made a quick and dirty fix (#33https://github.com/libthinkpad/dockd/pull/33) and waiting for the maintainer's input.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/libthinkpad/dockd/issues/31#issuecomment-611192864, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADKRL6Z2ENLIEIV5UT7OWADRLTQ6XANCNFSM4J2LSCNA.

dkim286 commented 4 years ago

Thanks for the reply. At least on my end, the hooks are already executable, but they're owned by the root user and it's preventing the script from being run:

Apr 08 14:07:57 lateralus dockd[3694167]: Dock hook exited with non-zero value (32256)

I'm not sure how this can be avoided as dockd needs to be run with superuser permissions to write to /etc/dockd/ when configuring. The only workaround I can think of is running the hooks as file args for bash or manually marking them as executable for all users, the latter being less than ideal.

smclt30p commented 4 years ago

Chown the config files to your user. If you need root apps use passwordless sudo.


From: dkim286 notifications@github.com Sent: Wednesday, April 8, 2020 11:16 PM To: libthinkpad/dockd dockd@noreply.github.com Cc: Ognjen Galić smclt30p@gmail.com; Comment comment@noreply.github.com Subject: Re: [libthinkpad/dockd] Hook scripts are not executed (#31)

Thanks for the reply. At least on my end, the hooks are already executable, but they're owned by the root user and it's preventing the script from being run:

Apr 08 14:07:57 lateralus dockd[3694167]: Dock hook exited with non-zero value (32256)

I'm not sure how this can be avoided as dockd needs to be run with superuser permissions to write to /etc/dockd/ when configuring. The only workaround I can think of is running the hooks as file args for bash.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/libthinkpad/dockd/issues/31#issuecomment-611198937, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADKRL62O4CXH2QNKBO22S7TRLTSS3ANCNFSM4J2LSCNA.

dkim286 commented 4 years ago

My local copy of dockd is from AUR fetched via auracle. I noticed that the original hook files in dockd-1.21.tar.gz have their permissions set as "intended":

-rwxr-xr-x 1 username username   222 Jan 19  2018 dock.hook
-rwxr-xr-x 1 username username   224 Jan 19  2018 undock.hook

...as opposed to what they're actually set to under /etc/dockd, which matches the original post's. I suspect this is caused by permissions not being preserved at installation time and probably outside dockd's control.

In the meantime, I decided to just change my own hook files to match the intended permissions. No more hook problems.