summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-03-21 12:21:39 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-03-21 14:16:30 -0400
commit34593c6f86a8f707394da8f937cca1819b7b7cca (patch)
tree00807d6d0bc3d9810217b8c89acc3ca26fb72a1e
parent7dba2cf97a1b01cc4d4c3c346603af439d1ee0f6 (diff)
wmii: move (u)mount.9p to util.sh, prefer 9pfuse
-rw-r--r--.config/wmii-hg/config.sh17
-rw-r--r--.config/wmii-hg/util.sh28
2 files changed, 28 insertions, 17 deletions
diff --git a/.config/wmii-hg/config.sh b/.config/wmii-hg/config.sh
index dea6774..967d5de 100644
--- a/.config/wmii-hg/config.sh
+++ b/.config/wmii-hg/config.sh
@@ -12,23 +12,6 @@ mkdir -p -- "${HIST%/*}"
# Colors tuples: "<text> <background> <border>"
. theme-abyss
-if [[ "$(uname -m)" = i686 ]]; then
- mount.9p() {
- 9pfuse "$1" "$2"
- while ! [[ -f "$2/event" ]]; do :; done
- }
- umount.9p() {
- fusermount -u "$1"
- }
-else
- mount.9p() {
- 9mount -i "$1" "$2"
- }
- umount.9p() {
- 9umount "$1"
- }
-fi
-
Event() {
local event=$1; shift;
case "$event" in
diff --git a/.config/wmii-hg/util.sh b/.config/wmii-hg/util.sh
index 55344b2..f80b871 100644
--- a/.config/wmii-hg/util.sh
+++ b/.config/wmii-hg/util.sh
@@ -116,3 +116,31 @@ scansection() {
conffile() {
echo "$HOME/.wmii-hg/$1"
}
+
+################################################################################
+# 9P filesystem #
+################################################################################
+
+# Prefer 9pfuse since:
+# 1. Linux 9p directory listings are broken on i686
+# 2. 9umount doesn't work with recent versions of Linux 9p
+if (. /etc/profile.d/plan9.sh || true; type 9pfuse) &>/dev/null; then
+ . /etc/profile.d/plan9.sh || true
+ mount.9p() {
+ 9pfuse "$1" "$2"
+ while ! [[ -f "$2/event" ]]; do :; done
+ }
+ umount.9p() {
+ fusermount -u "$1"
+ }
+elif type 9mount &>/dev/null; then
+ mount.9p() {
+ 9mount -i "$1" "$2"
+ }
+ umount.9p() {
+ 9umount "$1"
+ }
+else
+ >&2 echo "ERROR: I don't know how to mount 9P filesystems"
+ exit 5 # EXIT_NOTINSTALLED (LSB)
+fi