#!/bin/sh

. /opt/etc/functions.openrc
. /opt/etc/functions.noopenrc

usage() {
	echo "Usage: $(basename $0) [--unbind] <root_src> <root_dst>"
	echo "[Un]binds every subdirectory in <root_src> to/from same directory in <root_dst>."
	[ $# -gt 0 ] && exit $1
}
	
if [ "$1" = "--unbind" ]; then
	_cmd=do_mount_unbind
	shift
else
	_cmd=do_mount_bind
fi

[ $# -ne 2 ] && usage 1

bind_process_tree $1 $2 ${_cmd}
