Make sure that only what's asked to be installed gets touched on the system, specially on git installs.

This commit is contained in:
Pedro Algarvio 2013-01-25 23:41:57 +00:00
parent 06228b5f7c
commit 8397a35b1f

View file

@ -532,7 +532,7 @@ install_ubuntu_stable() {
if [ $INSTALL_SYNDIC -eq 1 ]; then if [ $INSTALL_SYNDIC -eq 1 ]; then
packages="${packages} salt-syndic" packages="${packages} salt-syndic"
fi fi
__apt_get_noinput "${packages}" __apt_get_noinput ${packages}
} }
install_ubuntu_daily() { install_ubuntu_daily() {
@ -545,6 +545,12 @@ install_ubuntu_git() {
install_ubuntu_git_post() { install_ubuntu_git_post() {
for fname in minion master syndic; do for fname in minion master syndic; do
# Skip if not meant to be installed
[ $fname = "minion" ] && [ $INSTALL_MINION -eq 0 ] && continue
[ $fname = "master" ] && [ $INSTALL_MASTER -eq 0 ] && continue
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq 0 ] && continue
if [ -f /usr/sbin/service ]; then if [ -f /usr/sbin/service ]; then
# We have upstart support # We have upstart support
if [ -f ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.upstart ]; then if [ -f ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.upstart ]; then
@ -626,7 +632,7 @@ install_debian_stable() {
if [ $INSTALL_SYNDIC -eq 1 ]; then if [ $INSTALL_SYNDIC -eq 1 ]; then
packages="${packages} salt-syndic" packages="${packages} salt-syndic"
fi fi
__apt_get_noinput "${packages}" __apt_get_noinput ${packages}
} }
@ -644,6 +650,12 @@ install_debian_60_git() {
install_debian_git_post() { install_debian_git_post() {
for fname in minion master syndic; do for fname in minion master syndic; do
# Skip if not meant to be installed
[ $fname = "minion" ] && [ $INSTALL_MINION -eq 0 ] && continue
[ $fname = "master" ] && [ $INSTALL_MASTER -eq 0 ] && continue
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq 0 ] && continue
if [ -f ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init ]; then if [ -f ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init ]; then
cp ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init /etc/init.d/salt-$fname cp ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init /etc/init.d/salt-$fname
fi fi
@ -694,6 +706,12 @@ install_fedora_git() {
install_fedora_git_post() { install_fedora_git_post() {
for fname in minion master syndic; do for fname in minion master syndic; do
# Skip if not meant to be installed
[ $fname = "minion" ] && [ $INSTALL_MINION -eq 0 ] && continue
[ $fname = "master" ] && [ $INSTALL_MASTER -eq 0 ] && continue
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq 0 ] && continue
cp ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname.service /lib/systemd/system/salt-$fname.service cp ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname.service /lib/systemd/system/salt-$fname.service
systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service) systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)
@ -765,12 +783,19 @@ install_centos_63_git() {
} }
install_centos_63_git_post() { install_centos_63_git_post() {
for fname in master minion; do for fname in master minion syndic; do
# Skip if not meant to be installed
[ $fname = "minion" ] && [ $INSTALL_MINION -eq 0 ] && continue
[ $fname = "master" ] && [ $INSTALL_MASTER -eq 0 ] && continue
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq 0 ] && continue
cp pkg/rpm/salt-${fname} /etc/init.d/ cp pkg/rpm/salt-${fname} /etc/init.d/
chmod +x /etc/init.d/salt-${fname} chmod +x /etc/init.d/salt-${fname}
/sbin/chkconfig salt-${fname} on
/etc/init.d/salt-${fname} start
done done
/sbin/chkconfig salt-minion on
/etc/init.d/salt-minion start
} }
# #
# Ended CentOS Install Functions # Ended CentOS Install Functions
@ -826,12 +851,14 @@ install_arch_post() {
} }
install_arch_git_post() { install_arch_git_post() {
if [ -f /usr/bin/systemctl ]; then for fname in minion master syndic; do
for fname in minion master syndic; do
if [ $fname != "minion" ]; then # Skip if not meant to be installed
# Guess we should only enable and start the minion service. Right?? [ $fname = "minion" ] && [ $INSTALL_MINION -eq 0 ] && continue
continue [ $fname = "master" ] && [ $INSTALL_MASTER -eq 0 ] && continue
fi [ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq 0 ] && continue
if [ -f /usr/bin/systemctl ]; then
cp ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname.service /lib/systemd/system/salt-$fname.service cp ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname.service /lib/systemd/system/salt-$fname.service
systemctl preset salt-$fname.service systemctl preset salt-$fname.service
@ -840,18 +867,12 @@ install_arch_git_post() {
systemctl daemon-reload systemctl daemon-reload
sleep 0.2 sleep 0.2
systemctl start salt-$fname.service systemctl start salt-$fname.service
done else
else
for fname in minion master syndic; do
if [ $fname != "minion" ]; then
# Guess we should only enable and start the minion service. Right??
continue
fi
cp ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname /etc/rc.d/init.d/salt-$fname cp ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname /etc/rc.d/init.d/salt-$fname
chmod +x /etc/rc.d/init.d/salt-$fname chmod +x /etc/rc.d/init.d/salt-$fname
/etc/init.d/salt-$fname start /etc/init.d/salt-$fname start
done fi
fi done
} }
# #
# Ended Arch Install Functions # Ended Arch Install Functions