set -e
if [ ! -f "target/release/small" ]; then
echo "Error: Binary not found. Run './bin/build' first."
exit 1
fi
_prefix="/Users/Shared/Small"
mkdir -p "${_prefix}/bin"
echo "Installing Small to ${_prefix}"
install -m755 target/release/small ${_prefix}/bin/small
install -m755 bin/small_wrapper ${_prefix}/bin/small_wrapper
strip ${_prefix}/bin/small
chmod +x ${_prefix}/bin/small
install -v "LaunchAgents/com.verknowsys.SyncEmAll.plist" "${HOME}/Library/LaunchAgents/com.verknowsys.SyncEmAll.plist"
echo "Loading"
launchctl load -w "${HOME}/Library/LaunchAgents/com.verknowsys.SyncEmAll.plist"
echo "Installation complete!"