NAME=invirt-dev
GEN_FILES=/srv/repository/conf/distributions
+. /lib/init/std-init.sh
. /lib/init/gen-files.sh
-case "$1" in
- start|reload|force-reload|restart)
- log_begin_msg "Reloading config for $PACKAGE"
- gen_files
- reprepro-env export
- invirt-build-conf
- log_end_msg $?
- ;;
- stop)
- ;;
- *)
- log_success_msg "Usage: /etc/init.d/$NAME {start|reload|force-reload|restart|stop}"
- ;;
-esac
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ ret=0
+
+ gen_files || ret=2
+ for d in db dists lists pool; do
+ dir="/srv/repository/$d"
+ mkdir -p "$dir"
+ chown -R repository:nogroup "$dir"
+ done
+ reprepro-env export || ret=2
+
+ invirt-build-conf || ret=2
+
+ return $ret
+}
+
+do_stop()
+{
+ :
+}
+
+do_reload()
+{
+ do_start
+}
+
+std_init "$@"