conf="/etc/gentoo-sync.conf"
[[ -e ${conf} ]] && . "${conf}"
+bootstrap() {
+ [[ $(id -u) -eq 0 ]] || exec sudo env -uUNSHARE HOME="$HOME" "$0" "$@"
+
+ if [[ -z ${UNSHARE} ]] ; then
+ mount_args=
+ if type -P unshare >&/dev/null ; then
+ test_arg() { unshare "$@" -- true >&/dev/null && uargs+=( "$@" ) || :; }
+ uargs=( -m )
+ test_arg -u
+ test_arg -i
+ test_arg -p -f --mount-proc
+ test_arg --propagation=private
+ UNSHARE=true exec unshare "${uargs[@]}" -- "$0" "$@"
+ fi
+ else
+ mount_args='-n'
+ fi
+ unset UNSHARE
+}
+bootstrap "$@"
+
usage() {
cat <<-EOF
Usage: ${0##*/} [options]
esac
done
-[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "$0" "$0" "$@" || :
${GS_DEBUG} && set -x
logdir="/var/log"