Skip to content

Commit

Permalink
Improved install flow (#185)
Browse files Browse the repository at this point in the history
* Command needs to be run as root.
 * Config dir is created.
 * tmp dir is deleted.
  • Loading branch information
lwander authored Mar 1, 2017
1 parent 433f0fe commit 0e68888
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
35 changes: 21 additions & 14 deletions InstallHalyard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,27 +133,27 @@ function add_apt_repositories() {
gpg=""
gpg=$(curl -s -f "https://bintray.com/user/downloadSubjectPublicKey?username=$REPOSITORY_ORG") || true
if [ -n "$gpg" ]; then
echo "$gpg" | sudo apt-key add -
echo "$gpg" | apt-key add -
fi
fi
echo "deb $REPOSITORY_URL $DISTRIB_CODENAME spinnaker" | sudo tee /etc/apt/sources.list.d/spinnaker-dev.list > /dev/null
echo "deb $REPOSITORY_URL $DISTRIB_CODENAME spinnaker" | tee /etc/apt/sources.list.d/spinnaker-dev.list > /dev/null
# Java 8
# https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa
sudo add-apt-repository -y ppa:openjdk-r/ppa
sudo apt-get update ||:
add-apt-repository -y ppa:openjdk-r/ppa
apt-get update ||:
}

function install_java() {
if [ -z "$DOWNLOAD" ]; then
sudo apt-get install -y --force-yes openjdk-8-jdk
apt-get install -y --force-yes openjdk-8-jdk

# https://bugs.launchpad.net/ubuntu/+source/ca-certificates-java/+bug/983302
# It seems a circular dependency was introduced on 2016-04-22 with an openjdk-8 release, where
# the JRE relies on the ca-certificates-java package, which itself relies on the JRE. D'oh!
# This causes the /etc/ssl/certs/java/cacerts file to never be generated, causing a startup
# failure in Clouddriver.
sudo dpkg --purge --force-depends ca-certificates-java
sudo apt-get install ca-certificates-java
dpkg --purge --force-depends ca-certificates-java
apt-get install ca-certificates-java
elif [[ "x`java -version 2>&1|head -1`" != *"1.8.0"* ]]; then
echo "you must manually install java 8 and then rerun this script; exiting"
exit 13
Expand All @@ -162,7 +162,7 @@ function install_java() {

function install_halyard() {
package="spinnaker-halyard"
sudo apt-get install -y --force-yes --allow-unauthenticated $package
apt-get install -y --force-yes --allow-unauthenticated $package
local apt_status=$?
if [ $apt_status -ne 0 ]; then
if [ -n "$DOWNLOAD" ] && [ "$apt_status" -eq "100" ]; then
Expand All @@ -186,7 +186,7 @@ function configure_bash_completion() {

completion_script="/etc/bash_completion.d/hal"
if [ "$yes" = "y" ] || [ "$yes = "Y" ] || [ "$yes = "yes" ]; then
hal --print-bash-completion | sudo tee $completion_script > /dev/null
hal --print-bash-completion | tee $completion_script > /dev/null
read -p "Where is your bash RC? [default $HOME/.bashrc]: " bashrc

if [ -z "$bashrc" ]; then
Expand Down Expand Up @@ -232,15 +232,22 @@ if [ "$homebase" = "" ]; then
echo "Setting spinnaker home to $homebase"
fi

if [ -z "$(sudo getent group spinnaker)" ]; then
sudo groupadd spinnaker
if [ -z "$(getent group spinnaker)" ]; then
groupadd spinnaker
fi

if [ -z "$(sudo getent passwd spinnaker)" ]; then
sudo useradd --gid spinnaker -m --home-dir $homebase/spinnaker spinnaker
if [ -z "$(getent passwd spinnaker)" ]; then
useradd --gid spinnaker -m --home-dir $homebase/spinnaker spinnaker
fi

sudo start halyard
mkdir -p /opt/spinnaker/config
chown spinnaker /opt/spinnaker/config
touch /opt/spinnaker/config/halyard.yml
chown spinnaker /opt/spinnaker/config/halyard.yml

rm -rf $TEMPDIR

start halyard

if [ -z "$QUIET" ]; then
cat <<EOF
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A tool for configuring, installing, and updating Spinnaker.
```
$ wget https://raw.githubusercontent.com/spinnaker/halyard/master/InstallHalyard.sh
$ bash InstallHalyard.sh
$ sudo ./InstallHalyard.sh
```

# Overview
Expand Down

0 comments on commit 0e68888

Please sign in to comment.