mirror of
https://github.com/mtan93/homebridge.git
synced 2026-05-27 14:21:45 +01:00
conditionalize the install/uninstall scripts to support linux or darwin.
This commit is contained in:
+16
-4
@@ -7,9 +7,21 @@ echo "Installing Homebridge..."
|
|||||||
APP_PATH=`pwd`
|
APP_PATH=`pwd`
|
||||||
USER_NAME=`whoami`
|
USER_NAME=`whoami`
|
||||||
|
|
||||||
cp startup/org.homebridge.plist ~/Library/LaunchAgents/org.homebridge.plist
|
|
||||||
|
|
||||||
sed -i '' -e "s#%USER%#$USER_NAME#g" ~/Library/LaunchAgents/org.homebridge.plist
|
if [[ "$OSTYPE" == "linux*" ]]; then
|
||||||
sed -i '' -e "s#%PATH%#$APP_PATH#g" ~/Library/LaunchAgents/org.homebridge.plist
|
## install for linux
|
||||||
|
echo ""
|
||||||
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
## install for OS X
|
||||||
|
|
||||||
launchctl load -w -F ~/Library/LaunchAgents/org.homebridge.plist
|
# copy template plist to the correct path.
|
||||||
|
cp startup/org.homebridge.plist ~/Library/LaunchAgents/org.homebridge.plist
|
||||||
|
|
||||||
|
# Set the current user for the script to run as.
|
||||||
|
sed -i '' -e "s#%USER%#$USER_NAME#g" ~/Library/LaunchAgents/org.homebridge.plist
|
||||||
|
# Set the current path for where the app lives.
|
||||||
|
sed -i '' -e "s#%PATH%#$APP_PATH#g" ~/Library/LaunchAgents/org.homebridge.plist
|
||||||
|
|
||||||
|
# Tell launchd to start it.
|
||||||
|
launchctl load -w -F ~/Library/LaunchAgents/org.homebridge.plist
|
||||||
|
fi
|
||||||
|
|||||||
+13
-2
@@ -1,6 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "Uninstalling Homebridge..."
|
echo "Uninstalling Homebridge..."
|
||||||
|
# make forever stop the app.
|
||||||
forever stop homebridge > /dev/null 2>&1
|
forever stop homebridge > /dev/null 2>&1
|
||||||
launchctl unload ~/Library/LaunchAgents/org.homebridge.plist
|
|
||||||
rm ~/Library/LaunchAgents/org.homebridge.plist
|
if [[ "$OSTYPE" == "linux*" ]]; then
|
||||||
|
## install for linux
|
||||||
|
echo ""
|
||||||
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
## uninstall for OS X
|
||||||
|
|
||||||
|
# tell launchd to stop the process.
|
||||||
|
launchctl unload ~/Library/LaunchAgents/org.homebridge.plist
|
||||||
|
# remove the launchd script.
|
||||||
|
rm ~/Library/LaunchAgents/org.homebridge.plist
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user