Skip to content

Instantly share code, notes, and snippets.

@baetheus
Last active April 12, 2020 12:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baetheus/71533d6358e55342dbb9 to your computer and use it in GitHub Desktop.
Save baetheus/71533d6358e55342dbb9 to your computer and use it in GitHub Desktop.
Compiling NZBGet 15.0

NZBGet 15.0 on SmartOS

Introduction

Documentation on compiling NZBGet 15.0 on a SmartOS minimal-64 15.1.1 zone. Perhaps I'll try my hand at contributing to pkgsrc at some point, but for now this will do. NZBGet is a very fast and very lightweight nzb downloader. More information on it can be found here.

Prerequisites

pkgin -fy up
pkgin -y fug
pkgin -y in gmake gcc47 unrar p7zip libxml2 unzip
groupadd -g 500 nzbget
useradd -m -c "NZBGet User" -u 500 -g nzbget nzbget
passwd -N nzbget
cd
mkdir build
cd build
wget --no-check-certificate https://github.com/nzbget/nzbget/archive/v15.0.zip
unzip v15.0.zip
cd nzbget-15.0

Build

./configure --prefix=/opt/local --with-libxml2-includes=/opt/local/include/libxml2/ --with-libxml2-libraries=/opt/local/lib/ --disable-curses
make
make install
make install-conf

Install SMF Service

curl -sk https://gist.githubusercontent.com/baetheus/71533d6358e55342dbb9/raw/nzbget.xml > $HOME/build/nzbget.xml
svccfg import $HOME/build/nzbget.xml
svcadm enable nzbget

Accessibility and Further Configuration

The service should now be available at http://<hostname/ip>:6789

User: nzbget
Pass: tegbzn6789

Configuration is located at /opt/local/etc/nzbget.conf. Additionally, you may wish to change ownership of the nzbget.conf file like so chown root:nzbget /opt/local/etc/nzbget.conf and give it group write permissions chmod g+w /opt/local/etc/nzbget.conf so the web interface can save changes to the config. Also, there is a line in the default nzbget.conf for output mode set to curses, since we disabled curses(because I'm too lazy to chase down the build deps in smartos) we should probable change this output config so we don't get bad mojo in our logs: sed -i.bak 's/^\(OutputMode=\).*/\1loggable/' /opt/local/etc/nzbget.conf.

Automounting samba/cifs

I store my finished files on a samba share that plex has access to. There isn't much documentation in the man pages for sharectl, automount, and autofs for this. But a bit of trial and error led me to a solution. First, enable the autofs and smb/client services:

svcadm enable -r smb/client
svcadm enable -r autofs

Then edit /etc/auto_master to map some shares manually:

cat '/mnt/auto auto_manual' >> /etc/auto_master

And create /etc/auto_manual:

cat 'mountpoint -fstype=smbfs,dirperms=0777,fileperms=0777 //<smb-cifs-hostname-or-ip>/<shared-volume>' > /etc/auto_manual

Then a little autofs restart:

svcadm restart autofs

You'll find your manual mounts under /mnt/auto. This setup assumes that the share is readable and writeable by guest, which is not a secure setup. Feel free to button it up. Also, I've added another nzbget manifest that has a dependancy on autofs, so that nzbget starts after any remote shares have been mounted.

Changelog

20150727

  • Updated to newest stable release and a different zone dataset.

20150407

  • Fixed links to point to new username.

20150222

  • Added a note and sed line to fix services logging and on start errors in nzbget.
  • Fixed some headings to be a little more descriptive
  • Added -y to some of the pkgin commands to make the block copy/pastable.

20150128

  • Changed build prefix to /opt/local and matched remaining documentation.

20150111

  • Added gid and uid settings for nzbget user and group.
  • Fixed the method_context for smf services to properly address permissions.

20150110

  • Forgot to add libxml2 dependancy, added it.
  • Updated zone and nzbget versions to latest stable.

20141128

  • Added method env with PATH and HOME to smf script so the default nzbget.conf can correctly call unrar and 7z binaries.
  • Added information about setting up automount for samba shares.
  • Included alternate nzbget.xml example with a dependancy on autofs for those that use autofs.
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='site/nzbget' type='service' version='0'>
<create_default_instance enabled='false'/>
<single_instance/>
<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default'/>
</dependency>
<dependency name='filesystem' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<dependency name='autofs' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/system/filesystem/autofs:default'/>
</dependency>
<exec_method name='start' type='method' exec='/opt/local/bin/nzbget -D -c /opt/local/etc/nzbget.conf' timeout_seconds='60'>
<method_context>
<method_credential group='nzbget' user='nzbget' privileges='basic,net_privaddr'/>
<method_environment>
<envvar name='PATH' value='/usr/local/sbin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin'/>
<envvar name='HOME' value='/home/nzbget'/>
</method_environment>
</method_context>
</exec_method>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'/>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='contract'/>
<propval name='ignore_error' type='astring' value='core,signal'/>
</property_group>
<property_group name='application' type='application'>
<propval name='config_file' type='astring' value='/opt/local/etc/nzbget.conf'/>
</property_group>
<stability value='Evolving'/>
<template>
<common_name>
<loctext xml:lang='C'>NZBGet</loctext>
</common_name>
</template>
</service>
</service_bundle>
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='site/nzbget' type='service' version='0'>
<create_default_instance enabled='false'/>
<single_instance/>
<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default'/>
</dependency>
<dependency name='filesystem' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<method_context>
<method_credential group='nzbget' user='nzbget'/>
<method_environment>
<envvar name='PATH' value='/usr/local/sbin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin'/>
<envvar name='HOME' value='/home/nzbget'/>
</method_environment>
</method_context>
<exec_method name='start' type='method' exec='/opt/local/bin/nzbget -D -c /opt/local/etc/nzbget.conf' timeout_seconds='60'>
<method_context>
<method_credential group='nzbget' user='nzbget' privileges='basic,net_privaddr'/>
<method_environment>
<envvar name='PATH' value='/usr/local/sbin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin'/>
<envvar name='HOME' value='/home/nzbget'/>
</method_environment>
</method_context>
</exec_method>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'/>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='contract'/>
<propval name='ignore_error' type='astring' value='core,signal'/>
</property_group>
<property_group name='application' type='application'>
<propval name='config_file' type='astring' value='/opt/local/etc/nzbget.conf'/>
</property_group>
<stability value='Evolving'/>
<template>
<common_name>
<loctext xml:lang='C'>NZBGet</loctext>
</common_name>
</template>
</service>
</service_bundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment