#!/bin/sh

autostart() {
	while true
		do
			/etc/init.d/autostart/*/RUN
		done
}

case $1 in
	autostart)
		autostart
			if [ "$?" != "0" ]; then
				exit 1
			fi
	;;
	-h|--help)
		printf "libesv - backend functions for esv\n"
		printf "note: this script should not be called directly by the user\n"
		printf "\n"
		printf "/usr/lib/libesv {autostart} - autostart all services in /etc/init.d/autostart\n"
		printf "note: 'autostart' should ONLY be called by esv at boot time\n"
		printf "\n"
		printf "/usr/lib/libesv {-h|--help} - show this message and exit\n"
		printf "/usr/lib/libesv {-v|--version} - show the version and exit\n"
		printf "\n"
		printf "this file is part of esv - everest service manager\n"
		exit 0
	;;
	-v|--version)
		printf "libesv v1.0.0\n"
		exit 0
	;;
	-*)
		printf "error in subprocess /usr/lib/libesv - no such option '$1'\n"
		exit 1
	;;
	*)
		printf "error in subprocess /usr/lib/libesv - no such option '$1'\n"
		exit 1
esac
