#!/bin/bash

[ "$#" == 2 ] || {
	echo "usage: $(basename "$0") <master> <slave>" >&2
	exit 1
}

[ -d "$1" ] && {
	echo "$1 is a directory"
	exit 1
}

[ -d "$2" ] && {
	echo "$2 is a directory"
	exit 1
}

if cmp "$1" "$2"; then
	[ "$(realpath "$1")" != "$(realpath "$2")" ] && ln -sf "$1" "$2"
else
	exit 0
fi
