• Re: update-alternatives: install with permanent arguments

    From Greg Wooledge@21:1/5 to Dmitrii Odintcov on Thu Aug 22 13:10:01 2024
    On Thu, Aug 22, 2024 at 13:09:06 +0300, Dmitrii Odintcov wrote:
    Let's say I want to install VS Code / Codium as an alternative for `/usr/bin/editor`, but I want it to always run with `--wait
    --reuse-window` so that other software can rely on the editor
    returning after the file is saved (like `crontab -e` does, for
    example)

    I cannot do `update-alternatives --install /usr/bin/editor editor
    "$(which codium) --wait --reuse-window" 0` because the "alternative
    path doesn't exist".

    Suggestions?

    Write a wrapper script like


    #!/bin/sh
    exec codium --wait --reuse-window "$@"


    and use this script as the symlink target of /usr/bin/editor (do it
    manually, not with update-alternatives). Don't forget to chmod 755.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Dmitrii Odintcov on Thu Aug 22 14:20:02 2024
    On Thu, Aug 22, 2024 at 14:33:22 +0300, Dmitrii Odintcov wrote:
    Hi Greg,


    This has occurred to me, but seemed like a bit of a hack and less
    convenient to transfer to other machines...

    do it manually, not with update-alternatives
    Why so? Could I not feed the script path to update-alternatives install?

    Well, if it works, then I guess it's OK.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Henning Follmann@21:1/5 to Greg Wooledge on Thu Aug 22 15:20:01 2024
    On Thu, Aug 22, 2024 at 08:17:36AM -0400, Greg Wooledge wrote:
    On Thu, Aug 22, 2024 at 14:33:22 +0300, Dmitrii Odintcov wrote:
    Hi Greg,


    This has occurred to me, but seemed like a bit of a hack and less convenient to transfer to other machines...

    do it manually, not with update-alternatives
    Why so? Could I not feed the script path to update-alternatives install?

    Well, if it works, then I guess it's OK.


    Exactly. And if you want it less "hackish", build a deb where the postinstall creates the links.

    -H
    --
    Henning Follmann | [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)