From 92471d9df12d761af2a9a8587e33c2c52de8defc Mon Sep 17 00:00:00 2001 From: Daniel Bradshaw Date: Wed, 29 May 2013 19:27:02 +0100 Subject: [PATCH 1/3] Gentoo install functions --- bootstrap-salt.sh | 104 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 958b63c..892a0cc 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2550,6 +2550,110 @@ install_suse_11_restart_daemons() { # ############################################################################## +############################################################################## +# +# Gentoo Install Functions. +# + +__gentoo_set_ackeys() { + GENTOO_ACKEYS="" + if [ ! -e /etc/portage/package.accept_keywords ]; then + # This is technically bad, but probably for the best. + # We'll assume that they want a file, as that's the default behaviour of portage. + # If they really want a folder they'll need to handle that themselves. + # We could use the ACCEPT_KEYWORDS environment variable, but that exceeds the minimum requires. + GENTOO_ACKEYS="/etc/portage/package.accept_keywords" + else + if [ -f /etc/portage/package.accept_keywords ]; then + GENTOO_ACKEYS="/etc/portage/package.accept_keywords" + elif [ -d /etc/portage/package.accept_keywords ]; then + GENTOO_ACKEYS="/etc/portage/package.accept_keywords/salt" + else + # We could use accept_keywords env, but this likely indicates a bigger problem. + echo "Error: /etc/portage/package.accept_keywords is neither directory nor file." + return 1 + fi + fi + return 0 +} + +__gentoo_pre_dep() { + emerge --sync + if [ ! -d /etc/portage ]; then + mkdir /etc/portage + fi + __gentoo_set_ackeys || return 1 + cat >> ${GENTOO_ACKEYS} << _EOT +# Keywords added by bootstrap-salt +# required by salt, based on the 0.15.1 ebuild +>=dev-python/pycryptopp-0.6.0 +>=dev-python/m2crypto-0.21.1-r1 +>=dev-python/pyyaml-3.10-r1 +>=dev-python/pyzmq-13.1.0 +>=dev-python/msgpack-0.3.0 +_EOT +} +__gentoo_post_dep() { + cat >> ${GENTOO_ACKEYS} << _EOT +# End of bootstrap-salt keywords. +_EOT + # the -o option asks it to emerge the deps but not the package. + emerge -vo salt +} + +install_gentoo_deps() { + __gentoo_pre_dep || return 1 + echo "app-admin/salt" >> ${GENTOO_ACKEYS} + __gentoo_post_dep +} + +install_gentoo_git_deps() { + emerge git + __gentoo_pre_dep || return 1 + echo "=app-admin/salt-9999 **" >> ${GENTOO_ACKEYS} + __gentoo_post_dep +} + +install_gentoo_stable() { + emerge -v salt +} + +install_gentoo_git() { + install_gentoo_stable || return 1 +} + +install_gentoo_post() { + for fname in minion master syndic; do + + # Skip if not meant to be installed + [ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue + + rc-update add salt-$fname default + /etc/init.d/salt-$fname start & + done +} + +install_gentoo_restart_daemons() { + for fname in minion master syndic; do + + # Skip if not meant to be installed + [ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue + [ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue + + /etc/init.d/salt-$fname stop > /dev/null 2>&1 + /etc/init.d/salt-$fname start & + done +} + +# +# End of Gentoo Install Functions. +# +############################################################################## + + ############################################################################## # # Default minion configuration function. Matches ANY distribution as long as From 288367c1051836ed842c908b8bfbfdd9afee2df1 Mon Sep 17 00:00:00 2001 From: Daniel Bradshaw Date: Wed, 29 May 2013 22:35:20 +0100 Subject: [PATCH 2/3] Remove use of convention that doesn't actually exist. --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 892a0cc..70bdb8b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2644,7 +2644,7 @@ install_gentoo_restart_daemons() { [ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue /etc/init.d/salt-$fname stop > /dev/null 2>&1 - /etc/init.d/salt-$fname start & + /etc/init.d/salt-$fname start done } From a0fa5ebe5e9abcc622debe6fc2114aedb08130b3 Mon Sep 17 00:00:00 2001 From: Daniel Bradshaw Date: Thu, 30 May 2013 18:28:59 +0100 Subject: [PATCH 3/3] Clean the return value from emerge --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 70bdb8b..576edf2 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2615,7 +2615,7 @@ install_gentoo_git_deps() { } install_gentoo_stable() { - emerge -v salt + emerge -v salt || return 1 } install_gentoo_git() {