Here we go:
Make certain lines similar to these 3 are present in /etc/fstab
ptyfs /dev/pts ptyfs rw
procfs /proc procfs rw
tmpfs /var/shm tmpfs rw,-m1777,-sram%10
Uninstall any PIP versions of these python packages, then install the NetBSD binary ones.
(Python packages needed for ueberzug)
pkgin in py38-pip py38-Xlib py38-Pillow py38-attrs py38-docopt
(Packages needed for ytfzf)
pkgin in fzf jq curl youtube-dl mpv
Patch (it should apply cleanly--there should be no *.rej
files after the command), then compile ueberzug
:
unzip -q ~/dl/ueberzug-master.zip
patch -p0 --posix < /tmp/ueberzug-master.patch
cd ueberzug-master
env CPPFLAGS=-I/usr/X11R7/include ./setup.py install
Install ytfzf
and test everything out. If it works out OK, @pin or @nia can import it into pkgsrc.
diff -urN ueberzug-master.orig/Xshm/Xshm.c ueberzug-master/Xshm/Xshm.c
--- ueberzug-master.orig/Xshm/Xshm.c 2021-01-16 13:47:42.000000000 +0000
+++ ueberzug-master/Xshm/Xshm.c 2021-03-19 11:55:18.988529400 +0000
@@ -67,9 +67,6 @@
if (self->segmentInfo.shmaddr != INVALID_SHM_ADDRESS) {
self->segmentInfo.readOnly = true;
- // Mark the shared memory segment for removal
- // It will be removed even if this program crashes
- shmctl(self->segmentInfo.shmid, IPC_RMID, 0);
return true;
}
@@ -111,6 +108,7 @@
Image_free_shared_memory(Image *self) {
if(self->segmentInfo.shmaddr != INVALID_SHM_ADDRESS) {
shmdt(self->segmentInfo.shmaddr);
+ shmctl(self->segmentInfo.shmid, IPC_RMID, 0);
self->segmentInfo.shmaddr = INVALID_SHM_ADDRESS;
}
}
diff -urN ueberzug-master.orig/examples/fzfimg.sh ueberzug-master/examples/fzfimg.sh
--- ueberzug-master.orig/examples/fzfimg.sh 2021-01-16 13:47:42.000000000 +0000
+++ ueberzug-master/examples/fzfimg.sh 2021-03-19 11:33:01.969867384 +0000
@@ -18,7 +18,7 @@
readonly REDRAW_COMMAND="toggle-preview+toggle-preview"
readonly REDRAW_KEY="ยต"
declare -r -x DEFAULT_PREVIEW_POSITION="right"
-declare -r -x UEBERZUG_FIFO="$(mktemp --dry-run --suffix "fzf-$$-ueberzug")"
+declare -r -x UEBERZUG_FIFO="$(T="$(mktemp -t fzf-$$-ueberzug)"; rm -f "$T"; echo "$T")"
declare -r -x PREVIEW_ID="preview"
diff -urN ueberzug-master.orig/ueberzug/process.py ueberzug-master/ueberzug/process.py
--- ueberzug-master.orig/ueberzug/process.py 2021-01-16 13:47:42.000000000 +0000
+++ ueberzug-master/ueberzug/process.py 2021-03-19 11:57:15.791323339 +0000
@@ -62,6 +62,9 @@
Returns:
list of str: containing the paths to these folders
"""
+ if (os.uname().sysname == 'NetBSD'):
+ return ['/dev/pts']
+
paths = []
with open('/proc/tty/drivers', 'rb') as drivers_file:
diff -urN ueberzug-master.orig/ueberzug/query_windows.py ueberzug-master/ueberzug/query_windows.py
--- ueberzug-master.orig/ueberzug/query_windows.py 2021-01-16 13:47:42.000000000 +0000
+++ ueberzug-master/ueberzug/query_windows.py 2021-03-19 11:57:35.565068867 +0000
@@ -13,6 +13,13 @@
Returns:
str: the associated command name
"""
+ if (os.uname().sysname == 'NetBSD'):
+ with open(f'/proc/{pid}/stat', 'rb') as proc_file:
+ data = proc_file.read()
+ s = data.decode(encoding='utf-8', errors='strict')
+ s = s.split(' ')[1]
+ return s.strip('()')
+
with open('/proc/{}/comm'.format(pid), 'r') as commfile:
return '\n'.join(commfile.readlines())
I have other code which more closely imitates Linux (it returns the thread-name instead of the process-name like ueberzug
seems to want), but, that is in C (and very different for each of the BSDs)--which means another module which will need to compiled and loaded. However this seems to work OK (so far) on all the BSDs all except OpenBSD, which has neither procfs
nor /dev/pts
๐.