This repository has been archived by the owner on Oct 20, 2023. It is now read-only.
forked from spinnaker/halyard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(install): Add update script (spinnaker#705)
- Loading branch information
Showing
7 changed files
with
161 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |