# Adding FreeSwitch to NanoBSD



## FazeLessWhite (Jun 30, 2015)

Hey guys! I wanted to add FreeSwitch from the internet on to my NanoBSD build,
This is how you add it on a freebsdFreeBSD system :


```
pkg install autoconf automake curl git gmake jpeg ldns libedit libtool openssl pcre pkgconf speex sqlite3 wget sudo
mkdir ~/src
cd ~/src
git clone https://freeswitch.org/stash/scm/fs/freeswitch.git

cd freeswitch
./bootstrap.sh -j
./configure
gmake
sudo gmake install cd-sounds-install cd-moh-install
```

How do I add this to my nanobsd.sh file?
Here is my current nanobsd.sh file : http://pastebin.com/USjfJDZE


----------



## tobik@ (Jun 30, 2015)

FazeLessWhite said:


> Here is my current nanobsd.sh file : http://pastebin.com/USjfJDZE


Here is the diff for your version and the one in 10.1-RELEASE:

```
diff --git a/tools/tools/nanobsd/nanobsd.sh b/tools/tools/nanobsd/nanobsd.sh
old mode 100644
new mode 100755
index 600d112..7fc4ddf
--- a/tools/tools/nanobsd/nanobsd.sh
+++ b/tools/tools/nanobsd/nanobsd.sh
@@ -93,7 +93,7 @@ NANO_LATE_CUSTOMIZE=""
 NANO_NEWFS="-b 4096 -f 512 -i 8192 -U"
 
 # The drive name of the media at runtime
-NANO_DRIVE=ad0
+NANO_DRIVE=da0
 
 # Target media size in 512 bytes sectors
 NANO_MEDIASIZE=2000000
@@ -416,7 +416,7 @@ setup_nanobsd_etc ( ) (
        touch etc/diskless
 
        # Make root filesystem R/O by default
-       echo "root_rw_mount=NO" >> etc/defaults/rc.conf
+       echo "root_rw_mount=YES" >> etc/defaults/rc.conf
 
        # save config file for scripts
        echo "NANO_DRIVE=${NANO_DRIVE}" > etc/nanobsd.conf
```
 You should not need to edit nanobsd.sh directly. It's specifically designed to allow you to customize it. Read nanobsd(8) if you haven't done so already.

NANO_DRIVE can be overridden in your NanoBSD config file and root_rw_mount can be set in your image's /etc/rc.conf. You can do this with a customization function (nanobsd(8) contains an example of one).

I have a NanoBSD project here https://github.com/t6/wifistreamer which installs some packages in the image. Maybe you can adapt it and add a customization function to run the steps you have outlined for installing FreeSwitch.


----------



## FazeLessWhite (Jun 30, 2015)

Thanks for your reply tobik! I have a lot of question's remaining still, would you please come over to an IRC? 
I'll be here at irc.freenode.net under #nanobsd


----------



## FazeLessWhite (Jun 30, 2015)

I'm getting a new error after adding this :


```
install_packages () (

chroot ${NANO_WORLDDIR} sh -c 'cd packages; pkg; pkg install nano; pkg clean;'

)
customize_cmd install_packages

# I just wanted to test this by adding nano
```
File: /usr/obj/nanobsd.full//_.cust.install_packages 


```
+ install_packages

+ chroot /usr/obj/nanobsd.full//_.w sh -c 'cd packages; pkg; pkg install nano; pkg clean;'

cd: packages: No such file or directory

The package management tool is not yet installed on your system.

Do you want to fetch and install it now? [y/N]: The package management tool is not yet installed on your system.

Do you want to fetch and install it now? [y/N]: The package management tool is not yet installed on your system.

Do you want to fetch and install it now? [y/N]:[CODE]
```
[/CODE]

I get this error...


----------



## ondra_knezour (Jun 30, 2015)

https://dan.langille.org/2013/12/06...freebsd-unattended-and-without-answering-yes/


----------



## FazeLessWhite (Jul 1, 2015)

ondra_knezour said:


> https://dan.langille.org/2013/12/06...freebsd-unattended-and-without-answering-yes/



I did that and now I'm confused about the directories, In which directory should I do the package installation?


```
+ install_packages

+ chroot /usr/obj/nanobsd.full//_.w sh -c 'mkdir pkg;cd pkg; pkg install -y nano; pkg clean -y;'

The package management tool is not yet installed on your system.

Do you want to fetch and install it now? [y/N]: The package management tool is not yet installed on your system.

Do you want to fetch and install it now? [y/N]:
```

Still the same error !


----------

