Merge pull request #149 from kaithar/gentoo-install

Gentoo install functions
This commit is contained in:
Pedro Algarvio 2013-06-01 06:54:13 -07:00
commit 1e75a787ba

View file

@ -2554,6 +2554,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 || return 1
}
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