Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐧 Initial commit of bin-wrapper #246

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions pkgs/bin-wrapper/PKGBUILD
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions pkgs/bin-wrapper/README
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions pkgs/bin-wrapper/create-wrapper
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions pkgs/bin-wrapper/create-wrapper.hook
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions pkgs/bin-wrapper/delete-wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/bash
while read input; do
[[ -n "$input" ]] && /usr/bin/rm -f /wrappers/$(/usr/bin/basename "$input")
done
9 changes: 9 additions & 0 deletions pkgs/bin-wrapper/delete-wrapper.hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Trigger]
Operation = Remove
Type = Path
Target = usr/bin/?*
[Action]
Description = Remove JuNest wrapper
When = PostTransaction
Exec = /wrappers/delete-wrapper
NeedsTargets
6 changes: 6 additions & 0 deletions pkgs/bin-wrapper/junest-wrapper
Original file line number Diff line number Diff line change
@@ -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