--- branches/magellan-next/include/mtools.minc 2011/12/01 14:26:01 31 +++ branches/magellan-next/include/mtools.minc 2011/12/13 17:33:23 32 @@ -104,6 +104,7 @@ { local service="$1" local service_exec="$2" + local opts # only run if systemd was found if [[ ! -x /bin/systemctl ]] @@ -112,13 +113,9 @@ return fi - # we do not support $MROOT atm if [[ ${MROOT} != / ]] && [[ ! -z ${MROOT} ]] then - echo "\$MROOT is set, doing nothing!" - echo "Please add unit ${service} manually to the runlevels!" - echo "Run 'systemctl enable ${service}' in your chroot later on." - return + opts="--root ${MROOT}" fi if [[ -z ${service_exec} ]] @@ -135,8 +132,8 @@ # add service to default runlevels echo -e " ${COLBLUE}[${COLGREEN}+${COLBLUE}]${COLDEFAULT} adding unit ${service} to default runlevels ..." # reload daemon to honor changed unit files - systemctl daemon-reload - systemctl enable ${service} + systemctl ${opts} daemon-reload + systemctl ${opts} enable ${service} # do not start services on bootstrap or MROOT!=/ if [[ ${MAGE_BOOTSTRAP} != true ]] && [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] @@ -154,6 +151,7 @@ { local service="$1" local service_exec="$2" + local opts # only run if systemd was found if [[ ! -x /bin/systemctl ]] @@ -162,13 +160,9 @@ return fi - # we do not support $MROOT atm if [[ ${MROOT} != / ]] && [[ ! -z ${MROOT} ]] then - echo "\$MROOT is set, doing nothing!" - echo "Please remove unit ${service} manually from the runlevels!" - echo "Run 'systemctl disable ${service}' in your chroot later on." - return + opts="--root ${MROOT}" fi if [[ -z ${service_exec} ]] @@ -188,8 +182,8 @@ # del services from runlevel regardless if they exist or not echo -e " ${COLBLUE}[${COLRED}-${COLBLUE}]${COLDEFAULT} removing unit ${service} from default runlevels ..." # reload daemon to honor changed unit files - systemctl daemon-reload - systemctl disable ${service} + systemctl ${opts} daemon-reload + systemctl ${opts} disable ${service} # do not stop services on bootstrap or MROOT!=/ if [[ ${MAGE_BOOTSTRAP} != true ]] && [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] @@ -212,6 +206,7 @@ { local service="$1" local service_exec="$2" + local opts # only run if systemd was found if [[ ! -x /bin/systemctl ]] @@ -220,13 +215,9 @@ return fi - # we do not support $MROOT atm if [[ ${MROOT} != / ]] && [[ ! -z ${MROOT} ]] then - echo "\$MROOT is set, doing nothing!" - echo "Please remove unit ${service} manually from the runlevels!" - echo "Run 'systemctl disable ${service}' in your chroot later on." - return + opts="--root ${MROOT}" fi if [[ -z ${service_exec} ]] @@ -241,7 +232,7 @@ fi # reload daemon to honor changed unit files - systemctl daemon-reload + systemctl ${opts} daemon-reload # do not stop services on bootstrap or MROOT!=/ if [[ ${MAGE_BOOTSTRAP} != true ]] && [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]