if [ ! "$(uname)" == "Darwin" ]; then
echo "Helper script meant for OSX"
echo "Please visit https://tari.com/downloads/"
echo " and download the binary distro for your platform"
exit 1
fi
tsstamp=$(date +'%Y%m%d_%Hh%Mm%Ss')
logging_file=/tmp/minotari_node_postinstall-$tsstamp.log
echo "Running postinstall - $(date +'%Y-%m-%d %Hh%M:%S')" > "$logging_file"
loggedInUserID=`id -u "${USER}"`
if [[ -n "$logging_file" ]] && [[ -f "$logging_file" ]]; then
echo "Redirecting out too an logging file $logging_file ..."
exec > >(tee -a "$logging_file")
exec 2>&1
echo "Redirecting should be working ..."
else
echo "No logging."
fi
echo "Envs and diags ..."
env
echo "Positional arguments" $@
if [[ -d "$3/Users" ]]; then
echo "chflags nohidden $3/Users"
fi
if [[ -d "$3/Users/Shared" ]]; then
echo "chflags nohidden $3/Users/Shared"
fi
echo "Checking XCode ..."
if !xcode-select -p 1>&2 2>/dev/null; then
echo "XCode not installed. Installing..."
echo "XCode successfully installed"
else
echo "XCode already installed."
fi
if [ "${COMMAND_LINE_INSTALL}" = "" ]; then
/bin/launchctl asuser "${loggedInUserID}" /usr/bin/open "$3"/usr/local/share/doc/minotari_node/
echo "Lauching post_install.sh script in another terminal, "
echo " this will help setup and config tor and default minotari_node ..."
/bin/launchctl asuser "${loggedInUserID}" /usr/bin/open -a Terminal.app -g "$3"/usr/local/share/minotari_node/post_install.sh
fi
echo "Done postinstall - $(date +'%Y-%m-%d %Hh%M:%S')"
exit 0