mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
add Scripts to Rule Them All
This commit is contained in:
30
script/bootstrap
Executable file
30
script/bootstrap
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if ! test $(which forever)
|
||||
then
|
||||
echo
|
||||
echo "!!!!"
|
||||
echo "You don't have forever installed. You need to install it first."
|
||||
echo
|
||||
echo "Just install it with this command: "
|
||||
echo 'sudo npm install forever -g'
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p log
|
||||
|
||||
echo "Installing packages..."
|
||||
npm install > /dev/null 2>&1
|
||||
|
||||
if [ ! -f config.json ]
|
||||
then
|
||||
echo
|
||||
echo "==> Creating your config. Please edit config.json."
|
||||
echo
|
||||
cp config-sample.json config.json
|
||||
fi
|
||||
|
||||
echo "Finished setting up Homebridge! run it with script/server or install it with script/install."
|
||||
15
script/install
Executable file
15
script/install
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
echo "Installing Homebridge..."
|
||||
|
||||
APP_PATH=`pwd`
|
||||
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
|
||||
sed -i '' -e "s#%PATH%#$APP_PATH#g" ~/Library/LaunchAgents/org.homebridge.plist
|
||||
|
||||
launchctl load -w -F ~/Library/LaunchAgents/org.homebridge.plist
|
||||
4
script/restart
Executable file
4
script/restart
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
script/uninstall
|
||||
script/install
|
||||
12
script/server
Executable file
12
script/server
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
forever=`which forever`
|
||||
|
||||
test -z "$NODE_ENV" &&
|
||||
export NODE_ENV='development'
|
||||
|
||||
if [ "$NODE_ENV" = "development" ]; then
|
||||
$forever -f startup/forever/development.json
|
||||
else
|
||||
$forever start startup/forever/production.json
|
||||
fi
|
||||
6
script/uninstall
Executable file
6
script/uninstall
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Uninstalling Homebridge..."
|
||||
forever stop homebridge > /dev/null 2>&1
|
||||
launchctl unload ~/Library/LaunchAgents/org.homebridge.plist
|
||||
rm ~/Library/LaunchAgents/org.homebridge.plist
|
||||
8
script/upgrade
Executable file
8
script/upgrade
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
echo "Updating from GitHub..."
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
git pull origin $BRANCH
|
||||
|
||||
npm update
|
||||
|
||||
script/restart
|
||||
Reference in New Issue
Block a user