Skip to content

Commit

Permalink
Update installer to place halconfig in right path (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwander committed Mar 3, 2017
1 parent 603ddb4 commit 9e64c39
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
45 changes: 38 additions & 7 deletions InstallHalyard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,15 @@ function install_halyard() {
}

function configure_bash_completion() {
local yes
echo ""
read -p "Would you like to configure halyard to use bash auto-completion? [Y/N]: " yes

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

if [ -z "$bashrc" ]; then
bashrc="$HOME/.bashrc"
Expand All @@ -197,10 +199,43 @@ function configure_bash_completion() {
echo "# configure hal auto-complete " >> $bashrc
echo ". /etc/bash_completion.d/hal" >> $bashrc
fi

echo "Bash auto-completion configured."
echo "$(tput bold)To use the auto-completion, either restart your shell, or run$(tput sgr0)"
echo "$(tput bold). $bashrc$(tput sgr0)"
fi

}

function configure_halyard_defaults() {
local halconfig
echo ""
read -p "Where would you like to store your halconfig? [default=$HOME/.hal]: " halconfig

if [ -z "$halconfig" ]; then
halconfig="$HOME/.hal"
fi

mkdir -p $halconfig
chown spinnaker $halconfig

mkdir -p /opt/spinnaker/config
chown spinnaker /opt/spinnaker/config

cat > /opt/spinnaker/config/halyard.yml <<EOL
spinnaker:
config:
output:
directory: ~/.spinnaker
halyard:
halconfig:
directory: $halconfig
EOL

chown spinnaker /opt/spinnaker/config/halyard.yml
}

process_args "$@"

# Only add external apt repositories if we are not --local_install
Expand All @@ -223,8 +258,6 @@ fi
echo "$(tput bold)Installing Halyard...$(tput sgr0)"
install_halyard

configure_bash_completion

## Remove

if [ "$homebase" = "" ]; then
Expand All @@ -240,10 +273,8 @@ if [ -z "$(getent passwd spinnaker)" ]; then
useradd --gid spinnaker -m --home-dir $homebase/spinnaker spinnaker
fi

mkdir -p /opt/spinnaker/config
chown spinnaker /opt/spinnaker/config
touch /opt/spinnaker/config/halyard.yml
chown spinnaker /opt/spinnaker/config/halyard.yml
configure_halyard_defaults
configure_bash_completion

rm -rf $TEMPDIR

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public class ResourceConfig {
* @return The path with home (~) expanded.
*/
@Bean
String halconfigDirectory(@Value("${halconfig.directory.halconfig:~/.hal}") String path) {
String halconfigDirectory(@Value("${halyard.halconfig.directory:~/.hal}") String path) {
return normalizePath(path);
}

@Bean
String halconfigPath(@Value("${halconfig.directory.halconfig:~/.hal}") String path) {
String halconfigPath(@Value("${halyard.halconfig.directory:~/.hal}") String path) {
return normalizePath(Paths.get(path, "config").toString());
}

Expand Down

0 comments on commit 9e64c39

Please sign in to comment.