# make install and pkg_add differences



## hakd (Feb 14, 2012)

Hi all. I have made a package for learn port/packaging system. It's only writing 
	
	



```
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

```
# 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

```
all:
   @echo "hi"

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

*A*m *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.


```
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
```


----------



## SirDice (Feb 15, 2012)

Ports or packages should _never_ modify /etc/rc.conf.


----------



## hakd (Feb 16, 2012)

I find the solution. If you use 

```
@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.


----------



## hakd (Feb 16, 2012)

Sorry, the sample command is 
	
	



```
@exec echo 'apache22_enable="YES"' >> /etc/rc.conf
```


----------



## throAU (Feb 16, 2012)

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.


----------



## hakd (Feb 16, 2012)

I have no opinion about apache server. Like you said, I just want to learn all this stuff. http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/

My problem is solved. Thanks your replies.


----------

