Téléverser les fichiers vers "scripts"

This commit is contained in:
Ailcope 2024-04-07 15:10:10 +00:00
parent 41404dbc97
commit 98f8f114b4
3 changed files with 55 additions and 0 deletions

24
scripts/install.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/sh -xe
# cd to project root
cd "$(dirname "$0")"
cd ..
DENO_PATH="$(which deno)"
if [ -z "$DENO_PATH" ]; then
echo --- Deno non détecté.
exit 1
fi
DENO_PATH_DIR="$(dirname "$DENO_PATH")"
./scripts/uninstall.sh
echo --- Copie de l agent de démarage
mkdir ~/Library/LaunchAgents/ || true
cp -f scripts/moe.yuru.music-rpc.plist ~/Library/LaunchAgents/
echo --- Modification de l agent
# /usr/bin is for osascript
plutil -replace EnvironmentVariables.PATH -string "$DENO_PATH_DIR:/usr/bin" ~/Library/LaunchAgents/moe.yuru.music-rpc.plist
plutil -replace WorkingDirectory -string "$(pwd)" ~/Library/LaunchAgents/moe.yuru.music-rpc.plist
echo --- Chargement de l agent
launchctl load ~/Library/LaunchAgents/moe.yuru.music-rpc.plist
echo --- Installation réussi

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>moe.yuru.music-rpc</string>
<key>ProgramArguments</key>
<array>
<string>./music-rpc.ts</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>music-rpc.log</string>
<key>WorkingDirectory</key>
<string>/absolute/path/to/cloned/repo</string>
</dict>
</plist>

6
scripts/uninstall.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh -xe
echo --- Arrêt de l agent
launchctl unload ~/Library/LaunchAgents/moe.yuru.music-rpc.plist
echo --- Suppression de l agent
rm -f ~/Library/LaunchAgents/moe.yuru.music-rpc.plist || true
echo --- Succès.