#!/bin/zsh
setopt no_unset extended_glob warn_create_global
typeset -g DSTROOT
#set -x
DSTROOT=$1

copy-skel() {
	local skel
	for skel in $HOME/adhoc-skel/*/*(DN); do
		s6-hiercopy $skel $DSTROOT/$skel:h:t/$skel:t || exit $?
	done
}

main() {
	if ! [[ -d $DSTROOT ]]; then
		echo >&2 "Destination root not a directory: $DSTROOT" 
		exit 2
	fi

	copy-skel
}

main