#!/bin/sh -xe

echo --- Copy launch agent plist
mkdir ~/Library/LaunchAgents/ || true
cp -f music-exp.plist ~/Library/LaunchAgents/

echo --- Load launch agent
launchctl load ~/Library/LaunchAgents/music-exp.plist

if launchctl list | grep am.noh.music-exp; then
    echo "--- Agent successfully loaded"
    echo "--- INSTALL SUCCESS"
else
    echo "--- ERROR: Agent failed to load"
fi