#!/bin/sh
# see also m-p-d::profiles/live/image-scripts.d/init3-services

[ -x /sbin/chkconfig -o -x /bin/systemctl ] || exit 0

switch() {
	case "$2" in
	on)
		cc=on; sc=enable;;
	off)
		cc=off; sc=disable;;
	esac

	{
		[ ! -x /bin/systemctl ] ||
			/bin/systemctl --no-reload $sc $1.service

		[ ! -x /sbin/chkconfig ] ||
			/sbin/chkconfig $1 $cc
	} 2>/dev/null
}

ENABLE="
dm
kdm
wdm
prefdm
alteratord
livecd-evms
livecd-fstab
livecd-hostname
livecd-save-nfs
livecd-setauth
livecd-setlocale
livecd-net-eth
livecd-install-wmaker
network
NetworkManager
connman
random
rpcbind
plymouth
avahi-daemon
cpufreq-simple
"

# NB: dnsmasq: https://bugzilla.altlinux.org/show_bug.cgi?id=18799
# NB: sshd might be needed for some particular cases
DISABLE="
anacron
blk-availability
bridge
clamd
crond
dhcpd
dnsmasq
lvm2-lvmetad
lvm2-monitor
mdadm
netfs
o2cb
ocfs2
openvpn
postfix
rawdevices
slapd
smartd
sshd
sysstat
update_wms
xinetd
"

for i in $ENABLE;  do switch $i on;  done
for i in $DISABLE; do switch $i off; done
:
