mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
support install/uninstall on linux with SysVinit
This commit is contained in:
@@ -5,12 +5,29 @@ set -e
|
||||
echo "Installing Homebridge..."
|
||||
|
||||
APP_PATH=`pwd`
|
||||
FOREVER_PATH=`which forever`
|
||||
USER_NAME=`whoami`
|
||||
|
||||
|
||||
if [[ "$OSTYPE" == "linux*" ]]; then
|
||||
## install for linux
|
||||
echo ""
|
||||
|
||||
# copy SysVinit script to the correct path.
|
||||
sudo cp startup/homebridge /etc/init.d/homebridge
|
||||
# set exec permissions on script.
|
||||
sudo chmod +x /etc/init.d/homebridge
|
||||
|
||||
# Set the current path for where the app lives.
|
||||
sudo sed -i '' -e "s#%PATH%#$APP_PATH#g" /etc/init.d/homebridge
|
||||
# Set the path for where the forever lives.
|
||||
sudo sed -i '' -e "s#%FOREVER_PATH%#$FOREVER_PATH#g" /etc/init.d/homebridge
|
||||
|
||||
# Start it.
|
||||
sudo /etc/init.d/homebridge start
|
||||
|
||||
# tell it to launch at boot
|
||||
sudo update-rc.d homebridge defaults
|
||||
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
## install for OS X
|
||||
|
||||
|
||||
@@ -5,8 +5,13 @@ echo "Uninstalling Homebridge..."
|
||||
forever stop homebridge > /dev/null 2>&1
|
||||
|
||||
if [[ "$OSTYPE" == "linux*" ]]; then
|
||||
## install for linux
|
||||
echo ""
|
||||
## uninstall for linux
|
||||
|
||||
# stop the service.
|
||||
sudo /etc/init.d/homebridge stop
|
||||
|
||||
# remove the service from launching at boot.
|
||||
sudo update-rc.d -f homebridge remove
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
## uninstall for OS X
|
||||
|
||||
|
||||
Reference in New Issue
Block a user