From 299d1ebd943825e56ff293d607e277a940ab2b41 Mon Sep 17 00:00:00 2001 From: Hoang Xuan Phu Date: Thu, 12 Jun 2014 11:00:09 +0000 Subject: [PATCH] add utility scripts --- mount.sh | 14 ++++++++++++++ unmount.sh | 12 ++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 mount.sh create mode 100755 unmount.sh diff --git a/mount.sh b/mount.sh new file mode 100755 index 0000000..8d28b19 --- /dev/null +++ b/mount.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +bin_dir="$(cd "$(dirname "$0")" && pwd)" + +while read module +do + orig_path="${module#*;}" + link_path="$bin_dir/site-cookbooks/${module%;*}" + mkdir -p "$link_path" + [[ "$(ls -A "$link_path")" ]] && sudo umount "$link_path" + sudo mount --bind "$orig_path" "$link_path" +done < "$bin_dir/modules" diff --git a/unmount.sh b/unmount.sh new file mode 100755 index 0000000..5e1aadf --- /dev/null +++ b/unmount.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e + +bin_dir="$(cd "$(dirname "$0")" && pwd)" + +while read module +do + link_path="$bin_dir/site-cookbooks/${module%;*}" + mkdir -p "$link_path" + [[ "$(ls -A "$link_path")" ]] && sudo umount "$link_path" +done < "$bin_dir/modules"