make install and pkg_add differences

Hi all. I have made a package for learn port/packaging system. It's only writing
Code:
apache22_enable="YES"
to rc.conf last line.
It's working clearly when I type make install, and clearly uninstalling too. But if I make a package for this port, and install it with pkg_add rconf-challenger-0.1.tbz it's not working.

Ports Makefile
Code:
# New ports collection makefile for:     rconf-challenger
# Date created:        5 December 1994
# Whom:                hak11d@gmail.com
#
# $FreeBSD$
#

Apache_Pre_Include= bsd.apache.mk
PORTNAME=       rconf-challenger
PORTVERSION=    0.1
CATEGORIES=     sysutils

PREFIX= /
MAINTAINER=     hak11d@gmail.com
COMMENT=        rc.conf apache script

 .include <bsd.port.mk>

project Makefile
Code:
all:
   @echo "hi"

install:
   @echo 'apache_enable="YES"' >> /etc/rc.conf

Am I missing something?
It's working correctly with make install, why is it not working with pkg_add... I'm confused, it's so strange.

Code:
FreeBSD hakd.valgrind.com 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 05:46:30 UTC 2012    
 [email]root@farrell.cse.buffalo.edu[/email]:/usr/obj/usr/src/sys/GENERIC  amd64
 
I find the solution. If you use
Code:
@exec echo 'apache22_enable="YES"'
in pkg-plist file, pkg_add runs every command. I'm using it with Makefile also and its working with make makefile command too.

Finally, I'm writing same commands to Makefile and pkg-plist files, so it is working correctly.
Thanks you all.
 
Sorry, the sample command is
Code:
@exec echo 'apache22_enable="YES"' >> /etc/rc.conf
 
SirDice said:
Ports or packages should never modify /etc/rc.conf.

What he said.

The fact that it looks like the apache Makefile is doing this means apache is broken (IMHO). edit: This is not the official package, just one you are playing with to learn packaging, yes?

It is up to the admin to select whether or not to have the service start at boot time, this shouldn't be automatically enabled by a port or package.
 
Back
Top