Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Wrapper around unionfs-fuse that uses a file-based branches configuration.
#! /bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
: ${UNIONFS:=unionfs}
readonly MODFS_BIN="$0"
modfs.usage() {
cat << EOM
Usage: $MODFS_BIN [options] branches.d mountpoint
options:
Any valid $UNIONFS options.
branches.d:
Directory containing the configuration files describing the branches to mount.
Configuration filenames must end with the .conf extension. Adding a new branch in a configuration files is done using the following syntax:
MODFS_BRANCHES+=("/path/to/branch=mode")
mode can be either RO (read-only) or RW (read-write).
mountpoint:
Destination mountpoint.
EOM
}
modfs.main() {
local -a options=()
local branchesDir
local mountpoint
local -a MODFS_BRANCHES=()
local i
local branches=""
# Read arguments
(( $# < 2 )) && modfs.usage && return 1
until (( $# == 2 )); do
options+=("$1")
shift
done
branchesDir="$1"
mountpoint="$2"
# Configuration
for i in "$branchesDir"/*.conf; do
[[ -f "$i" ]] && . "$i"
done
# Mount
for i in "${MODFS_BRANCHES[@]}"; do
[[ -z "$branches" ]] || branches+=":"
branches+="$i"
done
$UNIONFS "${options[@]}" "$branches" "$mountpoint"
}
modfs.main "$@"
@fleger
Owner

Requires unionfs-fuse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.