install script - break out of non-interactive shell [ci skip]

This commit is contained in:
Florian Staudacher 2012-04-24 14:59:03 +02:00
parent 6c5dafa6e9
commit 4075791376

View file

@ -38,6 +38,8 @@ D_GIT_CLONE_PATH="/srv/diaspora" # path for diaspora
D_REMOTE_REPO_URL="git://github.com/diaspora/diaspora.git" D_REMOTE_REPO_URL="git://github.com/diaspora/diaspora.git"
D_INSTALL_SCRIPT_URL="https://raw.github.com/diaspora/diaspora/master/script/install.sh"
D_WIKI_URL="https://github.com/diaspora/diaspora/wiki" D_WIKI_URL="https://github.com/diaspora/diaspora/wiki"
D_IRC_URL="irc://freenode.net/diaspora" D_IRC_URL="irc://freenode.net/diaspora"
@ -83,6 +85,24 @@ error() {
exit 1 exit 1
} }
# shell interactive or not
interactive_check() {
case $- in
*i*) # interactive
# all is well, continue
;;
*) # non-interactive
TMPFILE='mktemp'
curl -s -o "$TMPFILE" "$D_INSTALL_SCRIPT_URL"
chmod +x "$TMPFILE"
exec 0< /dev/tty
bash -i "$TMPFILE"
rm "$TMPFILE"
exit 0
;;
esac
}
# check if all necessary binaries are available # check if all necessary binaries are available
binaries_check() { binaries_check() {
for exe in $BINARIES; do for exe in $BINARIES; do
@ -192,6 +212,9 @@ database_setup() {
# # # #
#### #### #### ####
interactive_check
# display a nice welcome message # display a nice welcome message
define WELCOME_MSG <<'EOT' define WELCOME_MSG <<'EOT'
##################################################################### #####################################################################
@ -203,6 +226,7 @@ to get a copy of Diaspora* up and running
EOT EOT
echo "$WELCOME_MSG" echo "$WELCOME_MSG"
read -p "Press [Enter] to continue... "
# check if we have everything we need # check if we have everything we need