Straight.el: Is there any way to excecute :post-build with `sudo`?

Created on 24 Mar 2021  路  5Comments  路  Source: raxod502/straight.el

Hello, I have this recipe for EMMS:

'(emms
   :type git
   :flavor melpa
   :files ("*.el" "lisp/*.el" "doc/emms.texinfo" "emms-pkg.el" "src/*")
   :repo "https://git.savannah.gnu.org/git/emms.git"
   :post-build (("make" "emms-print-metadata") ("mv" "src/emms-print-metadata" "/usr/local"))))

However, to run mv src/emms-print-metadata /usr/local, I need root permission via sudo. Is there anyway to do this?

build system external command sudo support

All 5 comments

Is the goal to run the command as root without any prompt for your password, or do you want to be prompted for your password?

ideally I would like to be prompted, but either way would be acceptable

:post-build commands can be arbitrary elisp or system processes. I haven't tried it, but you may be able to set up an askpass program and write a script which prompts for a password when you need it.

Yep, that would be the way to do it. straight.el won't be able to do a tty prompt (due to complications with how async processes work), so you'll need some additional configuration.

That said, might it be a better idea to reconfigure whatever dependency wants the EMMS stuff installed in /usr/local so that it can read the configuration out of your home directory instead? That seems like it could potentially be cleaner.

This was the perfect solution, didn't realize i could customize emms-info-libtag-program-name :p, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

parsoj picture parsoj  路  4Comments

raxod502 picture raxod502  路  4Comments

dertuxmalwieder picture dertuxmalwieder  路  3Comments

progfolio picture progfolio  路  3Comments

eflanigan00 picture eflanigan00  路  4Comments