aboutsummaryrefslogtreecommitdiffstats
path: root/skein-infra
diff options
context:
space:
mode:
authorWynn Wolf Arbor2020-06-04 11:38:00 +0200
committerWynn Wolf Arbor2020-06-04 11:38:00 +0200
commita79316179389b22525b58e38f4618bf9fa0ea525 (patch)
tree6e6364bb84f3098c08d5dea197e304aabd11f48f /skein-infra
parentdaae3d6eb38b970e6e7330cf86ebf7fa8a78eb00 (diff)
downloadskein-a79316179389b22525b58e38f4618bf9fa0ea525.tar.gz
skein-infra: Simplify logging of mount actions
Both bind_* functions remove the SKEIN_CGIT_ROOT prefix from its log messages in an effort to remove redundant information. With commit efdbb04 ("skein-infra: Rename instances/ to home/") however, it is no longer clear from the path alone that a path under SKEIN_CGIT_ROOT is being operated upon. Use the full path in the log message to resolve this. The logging aliases ladd() and ldel() are only used in the respective bind_mount() and bind_umount() functions and we don't expect this to change any time soon. Rename log() to log_mount() and call the latter directly from within both bind_* functions to improve clarity.
Diffstat (limited to '')
-rwxr-xr-xskein-infra18
1 files changed, 3 insertions, 15 deletions
diff --git a/skein-infra b/skein-infra
index ac8084d..9673f55 100755
--- a/skein-infra
+++ b/skein-infra
@@ -10,33 +10,21 @@ usage() {
exit 1
}
-log() {
+log_mount() {
printf ' %s %s\n' "$1" "$2"
}
-ladd() {
- log + "$1"
-}
-
-ldel() {
- log - "$1"
-}
-
-remove_prefix() {
- printf "%s" "${1#$SKEIN_CGIT_ROOT/*}"
-}
-
bind_mount() {
mkdir "$2"
mount --rbind "$1" "$2"
mount --make-rslave "$2"
- ladd "$(remove_prefix "$2")"
+ log_mount "+" "$2"
}
bind_umount() {
umount "$1"
rmdir "$1"
- ldel "$(remove_prefix "$1")"
+ log_mount "-" "$1"
}
setup() {