# using pkg_add for specific rootfs in a different mount point



## vecihi (Nov 25, 2012)

hello

iam tryting to build own freebsd dist... 

my problem is about installing packages after formating and installing base system

for example in archlinux there is a tool name is pacstrap... packstrap can install packages to a mount point.
# packstrap /mnt bash

is there a way to use pkg_add like packstrap?

iam mounting /dev/ad0s1 to /media/disk... /dev/ad0s1 is rootfs of installed freebsd. 
i want to install bash.tgz package to  /dev/ad0s1 without booting from /dev/ad0s1

is there a way to do that? 
maybe i can use chroot for this

anyfeedback make me happy,

best regards


----------



## Beastie (Nov 25, 2012)

I can't tell for sure as I've never tried it myself, but this seems appropriate (see pkg_add(1)):

```
-C, --chroot chrootdir
	     Before doing any operations, chroot(2) to the chrootdir directory
	     so that all package files, and the package database, are
	     installed to chrootdir.  Note that chrootdir needs to be a fairly
	     complete file system, including everything normally needed by
	     pkg_add to run.
             [...]
```


----------



## vecihi (Nov 26, 2012)

#pkg_add libiconv-1.14.tbz -C=/mnt
pkg_add: chroot to =/mnt failed

not worked


----------



## vecihi (Nov 26, 2012)

i have chroot command. it s not related with that i guess.. what do you think?


----------



## Beastie (Nov 26, 2012)

vecihi said:
			
		

> #pkg_add libiconv-1.14.tbz -C=/mnt
> pkg_add: chroot to =/mnt failed


Drop the *=* sign.


----------



## vecihi (Nov 27, 2012)

it didn't work without = sign too


----------



## vecihi (Nov 27, 2012)

how is sysinstall installing those packages to mounted partition?


----------

