Browse code

Makefile: added target to install init.d script on debian

Daniel-Constantin Mierla authored on 21/04/2013 19:16:49
Showing 1 changed files
... ...
@@ -1018,6 +1018,26 @@ clean_modules_cfg clean-modules-cfg:
1018 1018
 .PHONY: pure
1019 1019
 pure: maintainer-clean
1020 1020
 
1021
+.PHONY: install_initd_debian install-initd-debian
1022
+install_initd_debian install-initd-debian:
1023
+	sed -e "s#DAEMON=/usr/sbin/kamailio#DAEMON=$(bin_prefix)/$(bin_dir)$(NAME)#g" \
1024
+		-e "s#NAME=kamailio#NAME=$(NAME)#g" \
1025
+		-e "s#DESC=Kamailio#DESC=$(NAME)#g" \
1026
+		-e "s#HOMEDIR=/var/run/kamailio#HOMEDIR=/var/run/$(NAME)#g" \
1027
+		-e "s#DEFAULTS=/etc/default/kamailio#DEFAULTS=/etc/default/$(NAME)#g" \
1028
+		-e "s#CFGFILE=/etc/kamailio/kamailio.cfg#CFGFILE=$(cfg_prefix)/$(cfg_dir)$(NAME).cfg#g" \
1029
+		< pkg/kamailio/deb/debian/kamailio.init \
1030
+		> /etc/init.d/$(NAME)
1031
+	chmod +x /etc/init.d/$(NAME)
1032
+	sed -e "s#RUN_KAMAILIO=no#RUN_KAMAILIO=yes#g" \
1033
+		< pkg/kamailio/debian/kamailio.default \
1034
+		> /etc/default/$(NAME)
1035
+	mkdir -p /var/run/$(NAME)
1036
+	adduser --quiet --system --group --disabled-password \
1037
+        --shell /bin/false --gecos "$(NAME)" \
1038
+        --home /var/run/$(NAME) $(NAME)
1039
+	chown $(NAME):$(NAME) /var/run/$(NAME)
1040
+
1021 1041
 .PHONY: dbschema
1022 1042
 dbschema:
1023 1043
 	-@echo "Build database schemas"