This commit is contained in:
Jonathon 2024-10-13 11:43:41 +02:00 committed by GitHub
commit dd242c57fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 72 additions and 0 deletions

25
pkgs/bin-wrapper/PKGBUILD Normal file
View file

@ -0,0 +1,25 @@
# Maintainer: Jonathon Fernyhough <jonathon at+manjarodotorg>
pkgname=bin-wrapper
pkgver=0.0.1
pkgrel=1
pkgdesc="Automatically wrap JuNest executables for use in outer system's PATH"
arch=(any)
url="https://github.com/fsquillace/junest"
license=(GPL)
source=(create-wrapper
delete-wrapper
junest-wrapper
create-wrapper.hook
delete-wrapper.hook)
sha256sums=('0b9d2fe31fee1d514295399fade8ae178d8c6fcc918e81286084337cfd900663'
'46ecdd2404e6bf8310e02fcfd8e0690405d52ce07b82dff2f0c9cbad31e40f67'
'f27807aae86daec311d601b1b954be1ee274232f9416963449514a2b00b34b83'
'ed6ce2ab02368427aab12d3aa36e2b1741cca526bd4caf55a90687bb117ea358'
'3a08a9c2889d9cb97fc2a53a5e045372477fde7261b0cbda1c332cd0c4ec1b1f')
package() {
install -Dm644 -t "$pkgdir"/usr/lib/libalpm/hooks *.hook
install -Dm644 -t "$pkgdir"/usr/share/doc/bin-wrapper README
install -D -t "$pkgdir"/wrappers *-wrapper
}

14
pkgs/bin-wrapper/README Normal file
View file

@ -0,0 +1,14 @@
This set of scripts and hooks will trigger pacman to create a wrapper script
for any executable installed under /usr/bin/. The wrapper will be removed when
the executable is removed.
This will allow you to place $JUNEST_HOME/wrappers in your $PATH and use any
JuNest-installed application transparently, including the use of a desktop
launcher.
The wrapper script targets the default (ns) JuNest back-end and will bind to
any locations specified by a $JUNEST_BINDS environment variable, e.g.:
export JUNEST_BINDS="--bind /media /media"
You will have to export $JUNEST_HOME as normal. junest must be on your $PATH.

View file

@ -0,0 +1,4 @@
#!/usr/bin/bash
while read input; do
[[ -n "$input" ]] && /usr/bin/ln -sf junest-wrapper /wrappers/$(/usr/bin/basename "$input")
done

View file

@ -0,0 +1,10 @@
[Trigger]
Operation = Install
Operation = Upgrade
Type = Path
Target = usr/bin/?*
[Action]
Description = Create/Update JuNest wrapper
When = PostTransaction
Exec = /wrappers/create-wrapper
NeedsTargets

View file

@ -0,0 +1,4 @@
#!/usr/bin/bash
while read input; do
[[ -n "$input" ]] && /usr/bin/rm -f /wrappers/$(/usr/bin/basename "$input")
done

View file

@ -0,0 +1,9 @@
[Trigger]
Operation = Remove
Type = Path
Target = usr/bin/?*
[Action]
Description = Remove JuNest wrapper
When = PostTransaction
Exec = /wrappers/delete-wrapper
NeedsTargets

View file

@ -0,0 +1,6 @@
#!/bin/bash
declare args
[[ $@ ]] && args=$(printf " %q" "$@")
exec junest ns -n -b "$JUNEST_BINDS" -- /usr/bin/$(/usr/bin/basename $0) $args