diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-09-29 12:15:22 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-09-29 12:15:22 -0300 |
commit | 3dd16ce361e30d805f2bb983ab8e365f8ef1035a (patch) | |
tree | 19904b46156c24fcd9a847fb852b99bf26088c35 | |
parent | 5fde61c778e0fec2c693cc35e2711c63d4b9bb90 (diff) | |
download | hydra-3dd16ce361e30d805f2bb983ab8e365f8ef1035a.tar.gz hydra-3dd16ce361e30d805f2bb983ab8e365f8ef1035a.tar.bz2 |
Auto install dependencies
-rw-r--r-- | doc/todo.rst | 1 | ||||
-rw-r--r-- | lib/hydra/misc | 2 | ||||
-rwxr-xr-x | share/hydra/eyaml | 5 | ||||
-rwxr-xr-x | share/hydra/mass | 6 | ||||
-rwxr-xr-x | share/hydra/newkeys | 3 | ||||
-rwxr-xr-x | share/hydra/sync | 2 |
6 files changed, 7 insertions, 12 deletions
diff --git a/doc/todo.rst b/doc/todo.rst index 6e66e48..3a80f24 100644 --- a/doc/todo.rst +++ b/doc/todo.rst @@ -1,7 +1,6 @@ TODO ==== -- auto install dependencies (hiera-eyaml, keyringer, etc). - docs. - deploy: - lockfile. diff --git a/lib/hydra/misc b/lib/hydra/misc index 894502d..0105760 100644 --- a/lib/hydra/misc +++ b/lib/hydra/misc @@ -66,7 +66,7 @@ function hydra_install_package { if [ "$?" == "1" ]; then echo "Installing package $1..." - DEBIAN_FRONTEND=noninteractive apt-get install $1 -y + DEBIAN_FRONTEND=noninteractive $SUDO apt-get install $1 -y || exit 1 fi } diff --git a/share/hydra/eyaml b/share/hydra/eyaml index 24e714d..b07d991 100755 --- a/share/hydra/eyaml +++ b/share/hydra/eyaml @@ -29,10 +29,7 @@ DOMAIN="`echo $FQDN | cut -d . -f 2-`" shift # Check for eyaml -if ! which eyaml &> /dev/null; then - echo "Please install ruby-eyaml" - exit 1 -fi +hydra_install_package hiera-eyaml # Check for node if [ -z "$NODE" ]; then diff --git a/share/hydra/mass b/share/hydra/mass index a716bae..ba5bddd 100755 --- a/share/hydra/mass +++ b/share/hydra/mass @@ -18,7 +18,7 @@ # Issue commands with pssh function mass_pssh { - hydra_check_command parallel-ssh + hydra_install_package pssh parallel-ssh -P -p 4 -t 0 -h $TMPWORK sudo $COMMAND } @@ -32,13 +32,13 @@ function mass_loop { # Issue commands with dish function mass_dish { - hydra_check_command dish + hydra_install_package dish dish -f -p /dev/null -e "sudo $COMMAND" -g $TMPWORK } # Issue commands with mussh function mass_mussh { - hydra_check_command mussh + hydra_install_package mussh mussh -H $TMPWORK -c "sudo $COMMAND" } diff --git a/share/hydra/newkeys b/share/hydra/newkeys index 84180ba..31e5ee4 100755 --- a/share/hydra/newkeys +++ b/share/hydra/newkeys @@ -88,8 +88,7 @@ hydra_config_load # Check for keyringer. if ! which keyringer &> /dev/null; then - echo "Error: please install keyringer." - exit 1 + hydra_install_package keyringer fi hydra_newkeys $* diff --git a/share/hydra/sync b/share/hydra/sync index f062c98..3727c8e 100755 --- a/share/hydra/sync +++ b/share/hydra/sync @@ -83,7 +83,7 @@ hydra_sync $REPOSITORIES # Update keyring. if [ "$UPDATE_KEYRINGER" != "no" ]; then if ! which keyringer &> /dev/null; then - echo "Please install keyringer for a full hydra experience." + hydra_install_package keyringer elif [ ! -e "$HOME/.keyringer/$HYDRA" ]; then echo "Initializing keyring for $HYDRA..." keyringer $HYDRA init $HYDRA_FOLDER/$repository |