You are not logged in.

#1 2017-10-05 19:14:55

An IP BreAKDoWN
Member
Registered: 2016-09-01
Posts: 2

[Solved] Can't get a Pacman Hook to work correctly

I'm trying to automate grabbing a lua file from github each time mpv updates.

So far I have:

# nano /etc/pacman.d/hooks/update-mpv-stats-git.hook[Trigger]
Operation = Upgrade
Operation = Install
Type = Package
Target = mpv

[Action]
Description = Updating lua scripts for mpv stats via GitHub
When = PostTransaction
Depends = mpv
Exec = "/usr/bin/wget -O /home/breakdown/.config/mpv/scripts/stats.lua https://raw.githubusercontent.com/Argon-/mpv-stats/master/stats.lua"

I get this:

# pacman -Sv mpv
Root      : /
Conf File : /etc/pacman.conf
DB Path   : /var/lib/pacman/
Cache Dirs: /var/cache/pacman/pkg/  
Hook Dirs : /usr/share/libalpm/hooks/  /etc/pacman.d/hooks/  
Lock File : /var/lib/pacman/db.lck
Log File  : /var/log/pacman.log
GPG Dir   : /etc/pacman.d/gnupg/
Targets   : mpv
warning: mpv-1:0.27.0-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) mpv-1:0.27.0-1

Total Installed Size:  3.98 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                                                                  [##############################################################################] 100%
(1/1) checking package integrity                                                                                                [##############################################################################] 100%
(1/1) loading package files                                                                                                     [##############################################################################] 100%
(1/1) checking for file conflicts                                                                                               [##############################################################################] 100%
(1/1) checking available disk space                                                                                             [##############################################################################] 100%
:: Processing package changes...
(1/1) reinstalling mpv                                                                                                          [##############################################################################] 100%
:: Running post-transaction hooks...
(1/6) Kept the previous and currently installed packages.
==> no candidate packages found for pruning
(2/6) Updating icon theme caches...
(3/6) Removed all cached files from uninstalled packages.
==> no candidate packages found for pruning
(4/6) Arming ConditionNeedsUpdate...
(5/6) Updating the desktop file MIME type cache...
(6/6) Updating lua scripts for mpv stats via GitHub.
call to execv failed (No such file or directory)
error: command failed to execute correctly

If I run that command in terminal I get this:

$ /usr/bin/wget -O /home/breakdown/.config/mpv/scripts/stats.lua https://raw.githubusercontent.com/Argon-/mpv-stats/master/stats.lua
--2017-10-05 13:08:57--  https://raw.githubusercontent.com/Argon-/mpv-stats/master/stats.lua
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving raw.githubusercontent.com... 151.101.0.133, 151.101.192.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25067 (24K) [text/plain]
Saving to: ‘/home/breakdown/.config/mpv/scripts/stats.lua’

/home/breakdown/.config/mpv/scripts/stats.lua         100%[======================================================================================================================>]  24.48K  --.-KB/s    in 0.02s   

2017-10-05 13:08:58 (1.12 MB/s) - ‘/home/breakdown/.config/mpv/scripts/stats.lua’ saved [25067/25067]

I'm not sure exactly how to properly write the 'Exec =' line in the .hook.

Any help is greatly appreciated.

Last edited by An IP BreAKDoWN (2017-10-05 19:28:54)

Offline

#2 2017-10-05 19:20:01

apg
Developer
Registered: 2012-11-10
Posts: 211

Re: [Solved] Can't get a Pacman Hook to work correctly

Remove the quotes.

Offline

#3 2017-10-05 19:28:22

An IP BreAKDoWN
Member
Registered: 2016-09-01
Posts: 2

Re: [Solved] Can't get a Pacman Hook to work correctly

Damn, I could have sworn I tried that without the quotes first, well thank you!
Solved!

Offline

#4 2017-10-09 16:48:47

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [Solved] Can't get a Pacman Hook to work correctly

Also note that the hook will be run as root, you may wish to use /usr/bin/runuser to run it as your own user instead.

Though I'd probably install it as /usr/share/mpv-scripts/* and symlink it from ~/.config/mpv


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB