Guide: Freenas 11.1 iocage manual install

This seems to be working for me so far in Freenas 11.1, hopefully it can help others out until an official plugin mechanism is available in a future Freenas release (targeted for 11.2). The following will manually install a new iocage jail with user=channels uid:820 and add that user the the ownership group of your DVR storage dataset (must be group writable).

modify the ip addresses, dataset directories, and ownership groups to match your setup

echo '{"pkgs":["curl","ca_root_nss","sudo"]}' > /tmp/pkg.json
iocage create -n "channels" -p /tmp/pkg.json -r 11.1-RELEASE ip4_addr="vnet0|<IP>/<MASK>" defaultrouter="<GATEWAY>" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec channels mkdir /usr/local/etc/rc.d
iocage exec channels "pw user add channels -c channels -u 820 -d /nonexistent -s /usr/bin/nologin"
iocage console channels
pw groupadd -n <GROUP NAME> -g <GID>
pw groupmod <GROUP NAME> -m channels
cd /usr/local 
mkdir -p channels-dvr 
curl -f -s https://getchannels.com/dvr/setup.sh | env DOWNLOAD_ONLY=1 sh
chown -R channels:channels channels-dvr
sysrc channels_dvr_user=channels
curl -f -s https://getchannels.com/dvr/install-freebsd.sh -o channels-dvr/install.sh
chmod +x channels-dvr/install.sh
sh channels-dvr/install.sh
echo 'channels_dvr_enable="YES"' >> /etc/rc.conf
exit
iocage fstab -a channels /mnt/storage/dvr /dvr nullfs rw 0 0 
iocage exec channels 'sysrc ifconfig_epair0_name="epair0b"'
iocage restart channels

OPTIONAL: To link the transcode directory to another directory, first get the DVR running and force a transcoded stream (anything but original quality) then stop the stream and issue the following commands. I do this to avoid wear on the main storage pool, but it may also speed things up if you are running a single HDD as your DVR storage. (this assumes the same group ownership as the DVR storage)

iocage fstab -a channels /mnt/transcode/channels /streaming nullfs rw 0 0
iocage exec channels rm -rf /dvr/Streaming                                         
iocage exec channels ln -nsf /streaming /dvr/Streaming