diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2020-10-01 15:02:47 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2020-10-01 15:02:47 -0300 |
commit | c212514035cffd38acbfac1413064937b28685b6 (patch) | |
tree | a043a9c3caac740cf61313d04d9d84280a44f30f /bin/dependencies | |
download | semanticscuttle-c212514035cffd38acbfac1413064937b28685b6.tar.gz semanticscuttle-c212514035cffd38acbfac1413064937b28685b6.tar.bz2 |
Squashed 'puppet/' content from commit eb5ecc4
git-subtree-dir: puppet
git-subtree-split: eb5ecc4fcad6bd4f75e38683ae12a8dba4382c0b
Diffstat (limited to 'bin/dependencies')
-rwxr-xr-x | bin/dependencies | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/bin/dependencies b/bin/dependencies new file mode 100755 index 0000000..3a47a8e --- /dev/null +++ b/bin/dependencies @@ -0,0 +1,45 @@ +#!/bin/bash +# +# Puppet bootstrap dependencies. +# + +# Parameters +BASENAME="`basename $0`" +DEPLOY_DEPENDENCIES="rsync puppet-common hiera-eyaml r10k" +DEVELOP_DEPENDENCIES="git mr whois hiera-eyaml" + +# Additional wheezy dependencies if not using puppet-common from wheezy-backports +#if [ "`head -c 1 /etc/debian_version`" == '7' ]; then +# DEPLOY_DEPENDENCIES="$DEPLOY_DEPENDENCIES ruby-hiera-puppet" +#fi + +# Set sudo config +if [ "`whoami`" != 'root' ]; then + SUDO="sudo" + + if ! sudo -n true; then + echo "Please set passwordless sudo." + exit 1 + fi +fi + +# Install a package, thanks to the Hydra Suite. +function provision_package { + if [ -z "$1" ]; then + return + fi + + dpkg -s $1 &> /dev/null + + if [ "$?" == "1" ]; then + echo "Installing package $1..." + DEBIAN_FRONTEND=noninteractive $SUDO apt-get install $1 -y + fi +} + +# Ensure basic packages are installed. +if [ "$BASENAME" == "dependencies" ]; then + for package in $DEVELOP_DEPENDENCIES; do + provision_package $package + done +fi |