Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
chore(install): Add update script (spinnaker#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwander authored Sep 19, 2017
1 parent ae0535c commit 8b64414
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 3 deletions.
7 changes: 7 additions & 0 deletions install/debian/InstallHalyard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ function install_halyard() {
mv /opt/hal /usr/local/bin
chmod +x /usr/local/bin/hal

if [ -f /opt/update-halyard ]; then
mv /opt/update-halyard /usr/local/bin
chmod +x /usr/local/bin/update-halyard
else
echo "No update script supplied with installer..."
fi

mkdir -p /var/log/spinnaker/halyard
chown $HAL_USER /var/log/spinnaker/halyard
chmod 755 /var/log/spinnaker/halyard
Expand Down
7 changes: 7 additions & 0 deletions install/osx/InstallHalyard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ function install_halyard() {
mv /opt/hal /usr/local/bin
chmod +x /usr/local/bin/hal

if [ -f /opt/update-halyard ]; then
mv /opt/update-halyard /usr/local/bin
chmod +x /usr/local/bin/update-halyard
else
echo "No update script supplied with installer..."
fi

mkdir -p /var/log/spinnaker/halyard
chown $HAL_USER /var/log/spinnaker/halyard
chmod 755 /var/log/spinnaker/halyard
Expand Down
2 changes: 1 addition & 1 deletion release/debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

tar -cvf halyard.tar.gz -C halyard-web/build/install halyard/ -C ../../../startup/debian hal
tar -cvf halyard.tar.gz -C halyard-web/build/install halyard/ -C ../../../startup/debian hal update-halyard
2 changes: 1 addition & 1 deletion release/osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

tar -cvf halyard.tar.gz -C halyard-web/build/install halyard/ -C ../../../startup/osx hal
tar -cvf halyard.tar.gz -C halyard-web/build/install halyard/ -C ../../../startup/osx hal update-halyard
2 changes: 1 addition & 1 deletion release/promote-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

SOURCE_VERSION=$1
TARGET_VERSION=$2
PLATFORMS=(debian docker)
PLATFORMS=(debian docker osx)

USAGE="You must supply the <SOURCE_VERSION>, and <TARGET_VERSION>:
$0 <SOURCE_VERSION> <TARGET_VERSION>"
Expand Down
72 changes: 72 additions & 0 deletions startup/debian/update-halyard
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash

set -e

function process_args() {
while [ "$#" -gt "0" ]
do
local key="$1"
shift
case $key in
--version)
echo "version"
HALYARD_VERSION="$1"
shift
;;
--help|-help|-h)
print_usage
exit 13
;;
*)
echo "ERROR: Unknown argument '$key'"
exit -1
esac
done
}

function configure_defaults() {
if [ -z "$HALYARD_VERSION" ]; then
HALYARD_VERSION="stable"
fi

HAL_USER=$(cat /opt/spinnaker/config/halyard-user)

if [ -z "$HAL_USER" ]; then
echo >&2 "Unable to derive halyard user, likely a corrupted install. Aborting."
exit 1
fi
}


function print_usage() {
cat <<EOF
usage: $0 [-y] [--version=<version>] [--user=<user>]
--version <version> Specify the exact verison of Halyard to
install. Default is 'stable'.
EOF
}

function install_halyard() {
TEMPDIR=$(mktemp -d installhalyard.XXXX)
pushd $TEMPDIR

curl -O https://storage.googleapis.com/spinnaker-artifacts/halyard/$HALYARD_VERSION/debian/halyard.tar.gz
tar -xvf halyard.tar.gz -C /opt

chown $HAL_USER:halyard /opt/halyard

mv /opt/hal /usr/local/bin
mv /opt/update-halyard /usr/local/bin
chmod +x /usr/local/bin/hal
chmod +x /usr/local/bin/update-halyard

popd
rm -rf $TEMPDIR
}

process_args $@
configure_defaults

install_halyard

su -c "hal -v" -s /bin/bash $HAL_USER
72 changes: 72 additions & 0 deletions startup/osx/update-halyard
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash

set -e

function process_args() {
while [ "$#" -gt "0" ]
do
local key="$1"
shift
case $key in
--version)
echo "version"
HALYARD_VERSION="$1"
shift
;;
--help|-help|-h)
print_usage
exit 13
;;
*)
echo "ERROR: Unknown argument '$key'"
exit -1
esac
done
}

function configure_defaults() {
if [ -z "$HALYARD_VERSION" ]; then
HALYARD_VERSION="stable"
fi

HAL_USER=$(cat /opt/spinnaker/config/halyard-user)

if [ -z "$HAL_USER" ]; then
echo >&2 "Unable to derive halyard user, likely a corrupted install. Aborting."
exit 1
fi
}


function print_usage() {
cat <<EOF
usage: $0 [-y] [--version=<version>] [--user=<user>]
--version <version> Specify the exact verison of Halyard to
install. Default is 'stable'.
EOF
}

function install_halyard() {
TEMPDIR=$(mktemp -d installhalyard.XXXX)
pushd $TEMPDIR

curl -OL https://storage.googleapis.com/spinnaker-artifacts/halyard/$HALYARD_VERSION/osx/halyard.tar.gz
tar -xvf halyard.tar.gz -C /opt

chown $HAL_USER /opt/halyard

mv /opt/hal /usr/local/bin
mv /opt/update-halyard /usr/local/bin
chmod +x /usr/local/bin/hal
chmod +x /usr/local/bin/update-halyard

popd
rm -rf $TEMPDIR
}

process_args $@
configure_defaults

install_halyard

su $HAL_USER -c "hal -v" -s /bin/bash

0 comments on commit 8b64414

Please sign in to comment.