Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build script option to autoinstall for startup #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/bin/bash

while getopts ":s" opt; do
# use -s to suppress user prompt and NOT install for startup
# use -i to suppress user prompt AND INSTALL for startup
# without either, user is prompted to choose
while getopts ":si" opt; do
case $opt in
s)
SILENT=true
command shift
;;
i)
AUTOINSTALL=true
command shift
;;
esac
done
echo "Building OpenSprinkler..."
Expand All @@ -20,11 +27,14 @@ fi

if [ ! "$SILENT" = true ] && [ -f OpenSprinkler.launch ] && [ ! -f /etc/init.d/OpenSprinkler.sh ]; then

read -p "Do you want to start OpenSprinkler on startup? " -n 1 -r
echo
# only ask user if auto-install not specified
if [ ! "$AUTOINSTALL" = true ]; then
read -p "Do you want to start OpenSprinkler on startup? " -n 1 -r
echo

if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 0
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 0
fi
fi

echo "Adding OpenSprinkler launch script..."
Expand Down