The Birth of JailMan (#2)

* move ex (+25 squashed commit)

Squashed commit:

[e5e9c57] verb

[16b023f] exp

[e0299d9] easier

[67fcf93] no message

[404687f] different

[bd82e7c] test

[14b91d9] mod

[f2bb227] test again

[a9d5ad0] again

[0dcb106] with bash

[7324c15] more

[8ec72d5] another test

[0933fdc] again

[a5247df] test more

[ee61137] temp test

[c90aa90] add some more tests

[9f8e47a] make executable

[ac84788] rename part 2

[890c3ca] rename part 1

[f17e571] test create

[9bd8ecd] typo aqgain

[eb865a7] test2

[fb57e28] typo

[595d9e9] make executable

[5d1ae75] first steps

* test5 (+22 squashed commit)

Squashed commit:

[f059ada] tweaks

[5c325de] again

[9f59aa6] ip4

[9990a77] Standardised creation

[0a6fa7f] whoops

[620d07c] no message

[2a98559] error

[62e9c39] hmmm

[9f8e4df] no message

[d1e9025] puzzle

[73aa99b] substitution try 1

[117e75e] other sub

[7c080b0] more flexible

[a0778f4] testzoveel

[739a3bf] fix

[f881425] no message

[1962b83] oops

[994692c] no message

[b6dd2a2] test

[6713186] echo

[6d8d95a] test

[f8c3740] quote processing

* small update fix (+18 squashed commit)

Squashed commit:

[8f0c2aa] Basic update

[c44eae5] simplification

[b1e9314] define basic pkgs

[1a55a85] define global pkgs

[6829d30] dirtest

[5d2a215] checking for install script existance

[d936df3] 1

[fcc7403] hmm

[08e7e07] exit 0

[380da4d] jail interfaces

[634f12e] make all executable

[0f2728c] add first test jail

[8320d77] restructure individual install scripts

[752b375] Standardise

[cbab837] itterate through jails

[37ecc1d] if array is without elements

[0a9e899] moving it to arrays

[cc356ee] mockup jailman

* moving docs,fixing test thingy (+27 squashed commit)

Squashed commit:

[76e856b] rc.d pathing

[4e1b178] fixing some pathing bugs

[e9e9648] quotes

[7c5aa9e] test10 fixes

[e8858cc] sonarr first steps

[0cb1efe] exit on invalid option

[e3451da] exit on unknown option

[60a1f9c] exit

[0536c11] test idea

[81d3465] hmm

[cb3b935] work on h

[1311fea] enable help

[aa8d55a] space?

[5ef67e0] add comment to global

[61be2fa] Add commenting and in-script help

[aac8557] Testing broken config

[ecc1142] oops

[e0059be] condition fix

[9628297] Add check for missing network settings

[44be2bc] Creating DHCP option, working on default example config.

[b0fe910] Adding documentation, setting up Jackett

[0045b2b] strucutre

[fbe3d20] includes first

[a1b032d] gitupdate space

[1b503b5] update fix

[512f597] add update feature

[e9b8359] add initial upgrade script

* Create LICENSE (#1)

* to 30

* move back kms includes readme, add config.yml to gitignore, add kms to config.yml.example (+24 squashed commit)

Squashed commit:

[095aa36] added py ks to readme

[28526d8] Setup KMS

[82f7bfa] Exeuction fix

[89de700] finish organizr and setup first steps of kms

[0624952] Add dummy cert generation

[2583e39] slight nginx mod

[3b3da6a] fixed again

[7f5807b] Readme and fix for wrong copy

[6cab6ca] Make tautulli permanent and prepare organizr

[6801447] Tautulli setup, plex to permanent

[6198469] also fix update if

[49cff5d] if fix 2

[4c436c4] fixing plex if

[1adf56f] Add first go at plex support

[446dff6] fixing some linking and dataset creation

[6dee179] forgot to set yaml files

[4e767de] settings file is not needed at all

[8ff9d73] setup lidarr, begin setup for transmission

[8f8d9ee] Fixing wrong echo's, adding *arr to readme

[7aab5f0] lidarr test setup, making radarr final, yaml restructure

[3113f71] some dataset creation tweaks

[286437b] movies, much

[181cf3e] test setup

[6477b74] Sonarr done, radarr next

* set to master and make executable
This commit is contained in:
Kjeld Schouten-Lebbing 2020-03-06 21:32:55 +01:00 committed by GitHub
parent d129808e2a
commit 4c09ea840c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 1177 additions and 370 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
config.yml

View File

@ -1,19 +0,0 @@
## Intro
This Repo are my personal install and update scripts I use (or have used and still support) for my freenas jails and (some) other network services.
They will be grossly undercommented and underdocumented, but there are some nice gems if you know where to look.
## Currently Supported Services
### General
- Organizr
- Py-KMS (Windows Activation)
### Media
- Plex
- Tautulli
- Transmission
- Sonarr
- Radarr
- Lidarr

51
config.yml.example Normal file
View File

@ -0,0 +1,51 @@
global:
# Relevant dataset paths, please use the ZFS dataset syntax such as: tank/apps
dataset:
config: tank/apps
iocage: tank/iocage
jails:
# jail version to install
version: 11.3-RELEASE
# Global pkgs to install in all jails.
# Please use standard space delimited pkg install syntax.
pkgs: curl ca_root_nss
# Example configuration, showing how to customise network config.
# Ese the same jailname on both sides of this variable example: example
example: example
#interfaces is optional and will be autmatically replace with vnet0:bridge0 if not present
interfaces: vnet0:bridge0
ip4_addr: 192.168.1.99/24
gateway: 192.168.1.1
# Jail specific pkgs.
# Please use standard space delimited pkg install syntax.
pkgs: mono
jackett: jackett
pkgs: mono
radarr: radarr
pkgs: mono
sonarr: sonarr
pkgs: mono
lidarr: lidarr
pkgs: mono
transmission: transmission
pkgs: bash unzip unrar transmission
plex: plex
plexpass: false
pkgs: plexmediaserver
tautulli: tautulli
pkgs: python2 py27-sqlite3 py27-openssl git
organizr: organizr
pkgs: nginx php72 php72-filter php72-curl php72-hash php72-json php72-openssl php72-pdo php72-pdo_sqlite php72-session php72-simplexml php72-sqlite3 php72-zip git
kms: kms
pkgs: bash py37-tkinter py37-pip py37-sqlite3 git

25
docs/LICENSE Normal file
View File

@ -0,0 +1,25 @@
BSD 2-Clause License
Copyright (c) 2020, Kjeld Schouten-Lebbing
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

25
docs/LICENSE.BSD2 Normal file
View File

@ -0,0 +1,25 @@
BSD 2-Clause License
Copyright (c) 2019, Kjeld Schouten-Lebbing
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

339
docs/LICENSE.GPLV2 Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

83
docs/Readme.md Normal file
View File

@ -0,0 +1,83 @@
## Intro
JailMan is a collection of shell scripts designed to make it easier to install iocage Jails on FreeNAS and/or TrueNAS core.
Inspirations for this script are: Docker, FreeNAS plugins, Pentaflake's guide and "freenas-iocage-nextcloud" by danb35.
The updater is inspired by the updater designed for ZFS-Compression-Test by Ornias1993.
The goal of this project is to be able to install, update, reinstall, upgrade and delete most of your services by just running a single command.
While doing this we aim for a "docker like" scenario, where the jail is completely disposable and all configuration is saved outside of the jail.
Example:
If something goes wrong with Jackett, you just use:
'jailman -r jackett'
## Install
- `git clone https://github.com/Ornias1993/jailman.git`
- `cp config.yml.ex. config.yml`
- edit config.yml to reflect your personal settings
Thats all.
## Update
This script includes an autoupdate feature which checks if changes to the script has been posted to github.
## Use
Replace $jailname with the name of the jail you want to install.
For supported jails, please see this readme or config.yml.example
- Install:
`jailman.sh -i $jailname`
- ReInstall:
`jailman.sh -r $jailname`
- Destroy
`jailman.sh -d $jailname`
This installs the jail, creates the config dataset if needed, installs all packages and sets them up for you.
Only thing you need to do is do the setup of the packages in their respective GUI.
All settings for the applications inside the jails are persistent across reinstalls, so don't worry reinstalling!
config.yml.example includes basic configuration for all jails.
Basic means: The same setup as a FreeNAS plugin would've, DHCP on bridge0.
## Currently Supported Services
### General
- organizr
- py-kms
### Downloads
- transmission
- jackett
### Media
- plex
- tautulli
- sonarr
- radarr
- lidarr
## References
- Pentaflake's guide:
https://www.ixsystems.com/community/resources/fn11-3-iocage-jails-plex-tautulli-sonarr-radarr-lidarr-jackett-transmission-organizr.58/
- "freenas-iocage-nextcloud" by danb35:
https://github.com/danb35/freenas-iocage-nextcloud
- "ZFS-Compression-Test" by Ornias1993:
https://github.com/Ornias1993/zfs-compression-test
- "py-kms" by SystemRage and others:
https://github.com/SystemRage/py-kms
### LICENCE
This work is dual licenced under GPLv2 and BSD-2 clause

39
global.sh Executable file
View File

@ -0,0 +1,39 @@
#!/usr/local/bin/bash
# shellcheck disable=SC1003
# yml Parser function
# Based on https://gist.github.com/pkuczynski/8665367
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
if (length($3) > 0) {
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
printf("export %s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
}
}'
}
# automatic update function
gitupdate() {
echo "checking for updates using Branch: $1"
git fetch
git update-index -q --refresh
CHANGED=$(git diff --name-only origin/$1)
if [ ! -z "$CHANGED" ];
then
echo "script requires update"
git reset --hard
git checkout $1
git pull
echo "script updated"
exit 1
else
echo "script up-to-date"
fi
}

View File

@ -1,49 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: ombi
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# ombi_enable (bool): Set to NO by default.
# Set it to YES to enable it.
# ombi_user: The user account ombi daemon runs as what
# you want it to be. It uses 'ombi' user by
# default. Do not sets it as empty or it will run
# as root.
# ombi_group: The group account ombi daemon runs as what
# you want it to be. It uses 'ombi' group by
# default. Do not sets it as empty or it will run
# as wheel.
# ombi_data_dir: Directory where ombi configuration
# data is stored.
# Default: /usr/local/share/ombi
. /etc/rc.subr
name=ombi
rcvar=ombi_enable
load_rc_config ${name}
: ${ombi_enable:=NO}
: ${ombi_user:=ombi}
: ${ombi_group:=ombi}
: ${ombi_data_dir:="/config"}
procname="/usr/local/bin/mono"
command="/usr/sbin/daemon"
command_args="-f ${procname} /usr/local/share/ombi/Ombi.exe"
start_precmd=ombi_precmd
ombi_precmd() {
if [ ! -d ${ombi_data_dir} ];
then install -d -o ${ombi_user} -g ${ombi_group} ${ombi_data_dir}
fi
export XDG_CONFIG_HOME=${ombi_data_dir}
}
run_rc_command "$1"

View File

@ -1,21 +0,0 @@
user www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 443 ssl;
server_name organizr.schouten-lebbing.nl;
include custom/organizr.conf;
ssl_certificate /config/cert/Organizr-Cert.crt; # Manually Added
ssl_certificate_key /config/cert/Organizr-Cert.key; # Manually Added
}
}

View File

@ -1,69 +0,0 @@
{
"alt-speed-down": 10000,
"alt-speed-enabled": true,
"alt-speed-time-begin": 420,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": true,
"alt-speed-time-end": 1260,
"alt-speed-up": 5000,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 200,
"dht-enabled": true,
"download-dir": "/mnt/downloads/complete",
"download-queue-enabled": false,
"download-queue-size": 50,
"encryption": 1,
"idle-seeding-limit": 1,
"idle-seeding-limit-enabled": true,
"incomplete-dir": "/mnt/downloads/incomplete",
"incomplete-dir-enabled": true,
"lpd-enabled": false,
"message-level": 2,
"peer-congestion-algorithm": "",
"peer-id-ttl-hours": 6,
"peer-limit-global": 1000,
"peer-limit-per-torrent": 100,
"peer-port": 51413,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,
"peer-socket-tos": "default",
"pex-enabled": true,
"pidfile": "/var/run/transmission/daemon.pid",
"port-forwarding-enabled": false,
"preallocation": 0,
"prefetch-enabled": true,
"queue-stalled-enabled": true,
"queue-stalled-minutes": 1,
"ratio-limit": 0,
"ratio-limit-enabled": true,
"rename-partial-files": true,
"rpc-authentication-required": false,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-host-whitelist": "",
"rpc-host-whitelist-enabled": false,
"rpc-password": "{4274e8c504b23f3cd52c7128d4838282019b83bbUtfhD/5d",
"rpc-port": 9091,
"rpc-url": "/transmission/",
"rpc-username": "",
"rpc-whitelist": "127.0.0.1",
"rpc-whitelist-enabled": false,
"scrape-paused-torrents-enabled": true,
"script-torrent-done-enabled": false,
"script-torrent-done-filename": "",
"seed-queue-enabled": false,
"seed-queue-size": 10,
"speed-limit-down": 100,
"speed-limit-down-enabled": false,
"speed-limit-up": 100,
"speed-limit-up-enabled": false,
"start-added-torrents": true,
"trash-original-torrent-files": false,
"umask": 0,
"upload-slots-per-torrent": 14,
"utp-enabled": true
}

View File

@ -1,13 +0,0 @@
echo '{"pkgs":["bash","ca_root_nss","nano","py37-tkinter","py37-pip","py37-sqlite3","git"]}' > /tmp/pkg.json
iocage create -n "kms" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge10" ip4_addr="vnet0|192.168.10.43/24" defaultrouter="192.168.10.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec kms mkdir -p /config
iocage fstab -a kms /mnt/tank/apps/kms /config nullfs rw 0 0
iocage exec kms svn checkout https://github.com/SystemRage/py-kms/trunk/py-kms /usr/local/share/py-kms
iocage exec kms "pw user add kms -c kms -u 666 -d /nonexistent -s /usr/bin/nologin"
iocage exec kms chown -R kms:kms /usr/local/share/py-kms /config
iocage exec kms mkdir /usr/local/etc/rc.d
cp ../includes/py-kms-conf/py_kms.rc /mnt/tank/iocage/jails/kms/root/usr/local/etc/rc.d/py_kms
iocage exec kms chmod u+x /usr/local/etc/rc.d/py_kms
iocage exec kms sysrc "py_kms_enable=YES"
iocage exec kms service py_kms start

View File

@ -1,20 +0,0 @@
echo '{"pkgs":["mono","mediainfo","sqlite3","ca_root_nss","curl","chromaprint","nano"]}' > /tmp/pkg.json
iocage create -n "lidarr" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge31" ip4_addr="vnet0|192.168.31.25/24" defaultrouter="192.168.31.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec lidarr mkdir -p /config
iocage exec lidarr mkdir -p /mnt/music
iocage exec lidarr mkdir -p /mnt/fetched
iocage fstab -a lidarr /mnt/tank/apps/lidarr /config nullfs rw 0 0
iocage fstab -a lidarr /mnt/tank/downloads/complete /mnt/fetched nullfs rw 0 0
iocage fstab -a lidarr /mnt/tank/library/Music /mnt/music nullfs rw 0 0
iocage exec lidarr ln -s /usr/local/bin/mono /usr/bin/mono
iocage exec lidarr "fetch https://github.com/lidarr/Lidarr/releases/download/v0.2.0.371/Lidarr.develop.0.2.0.371.linux.tar.gz -o /usr/local/share"
iocage exec lidarr "tar -xzvf /usr/local/share/Lidarr.develop.0.2.0.371.linux.tar.gz -C /usr/local/share"
iocage exec lidarr "rm /usr/local/share/Lidarr.develop.0.2.0.371.linux.tar.gz"
iocage exec lidarr "pw user add lidarr -c lidarr -u 353 -d /nonexistent -s /usr/bin/nologin"
iocage exec lidarr chown -R lidarr:lidarr /usr/local/share/Lidarr /config
iocage exec lidarr mkdir /usr/local/etc/rc.d
cp ../includes/lidarr-conf/lidarr.rc /mnt/tank/iocage/jails/lidarr/root/usr/local/etc/rc.d/lidarr
iocage exec lidarr chmod u+x /usr/local/etc/rc.d/lidarr
iocage exec lidarr sysrc "lidarr_enable=YES"
iocage exec lidarr service lidarr start

View File

@ -1,29 +0,0 @@
echo '{"pkgs":["mono","ca_root_nss","unzip","sqlite3","nano"]}' > /tmp/pkg.json
iocage create -n "ombi" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge31" ip4_addr="vnet0|192.168.31.27/24" defaultrouter="192.168.31.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec ombi mkdir -p /config
iocage fstab -a ombi /mnt/tank/apps/ombi /config nullfs rw 0 0
iocage exec ombi ln -s /usr/local/bin/mono /usr/bin/mono
iocage exec ombi "fetch https://github.com/tidusjar/Ombi/releases/download/v2.2.1/Ombi.zip -o /usr/local/share"
iocage exec ombi "unzip -d /usr/local/share /usr/local/share/Ombi.zip"
iocage exec ombi mv /usr/local/share/Release /usr/local/share/ombi
iocage exec ombi rm /usr/local/share/Ombi.zip
if [ -f "/config/Ombi.sqlite" ];
then
echo "Ombi.sqlite exist."
else
echo "Ombi.sqlite does not exist, creating..." >&2
iocage exec ombi sqlite3 /config/Ombi.sqlite "create table aTable(field1 int); drop table aTable;"
iocage exec ombi mkdir -p /config/Backups
fi
iocage exec ombi ln -s /config/Ombi.sqlite /usr/local/share/ombi/Ombi.sqlite
iocage exec ombi ln -s /config/Backups /usr/local/share/ombi/Backups
iocage exec ombi "pw user add ombi -c ombi -u 819 -d /nonexistent -s /usr/bin/nologin"
iocage exec ombi chown -R ombi:ombi /usr/local/share/ombi /config
iocage exec ombi mkdir /usr/local/etc/rc.d
cp ../includes/ombi-conf/ombi.rc /mnt/tank/iocage/jails/ombi/root/usr/local/etc/rc.d/ombi
iocage exec ombi chmod u+x /usr/local/etc/rc.d/ombi
iocage exec ombi sysrc ombi_enable=YES
iocage exec ombi service ombi start

View File

@ -1,26 +0,0 @@
#!/bin/sh
echo '{"pkgs":["plexmediaserver-plexpass","ca_root_nss","nano"]}' > /tmp/pkg.json
iocage create -n "plex" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge30" ip4_addr="vnet0|192.168.30.26/24" defaultrouter="192.168.30.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec plex "mkdir -p /usr/local/etc/pkg/repos"
cp ../includes/plex-conf/FreeBSD.conf /mnt/tank/iocage/jails/plex/root/usr/local/etc/pkg/repos/FreeBSD.conf
iocage exec plex mkdir -p /config
iocage exec plex mkdir -p /mnt/library
iocage fstab -a plex /mnt/tank/apps/plex /config nullfs rw 0 0
iocage fstab -a plex /mnt/tank/Library /mnt/library nullfs ro 0 0
iocage exec plex chown -R plex:plex /config
iocage exec plex sysrc "plexmediaserver_plexpass_enable=YES"
iocage exec plex sysrc plexmediaserver_plexpass_support_path="/config"
iocage exec plex pkg update -y
iocage exec plex pkg upgrade -y
iocage exec plex chown -R plex:plex /usr/local/share/plexmediaserver-plexpass/
iocage exec plex service plexmediaserver_plexpass start
sleep 10s
echo "Waiting 20s to stop plex"
iocage stop plex
sleep 10s
echo "Waiting 20s to start plex"
iocage start plex
iocage exec plex service plexmediaserver_plexpass start
echo "Finished installing plex"

View File

@ -1,20 +0,0 @@
echo '{"pkgs":["mono","mediainfo","sqlite3","ca_root_nss","curl","nano"]}' > /tmp/pkg.json
iocage create -n "radarr" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge31" ip4_addr="vnet0|192.168.31.24/24" defaultrouter="192.168.31.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec radarr mkdir -p /config
iocage exec radarr mkdir -p /mnt/movies
iocage exec radarr mkdir -p /mnt/fetched
iocage fstab -a radarr /mnt/tank/apps/radarr /config nullfs rw 0 0
iocage fstab -a radarr /mnt/tank/downloads/complete /mnt/fetched nullfs rw 0 0
iocage fstab -a radarr /mnt/tank/library/Movies /mnt/movies nullfs rw 0 0
iocage exec radarr ln -s /usr/local/bin/mono /usr/bin/mono
iocage exec radarr "fetch https://github.com/Radarr/Radarr/releases/download/v0.2.0.1480/Radarr.develop.0.2.0.1480.linux.tar.gz -o /usr/local/share"
iocage exec radarr "tar -xzvf /usr/local/share/Radarr.develop.0.2.0.1480.linux.tar.gz -C /usr/local/share"
iocage exec radarr rm /usr/local/share/Radarr.develop.0.2.0.1480.linux.tar.gz
iocage exec radarr "pw user add radarr -c radarr -u 352 -d /nonexistent -s /usr/bin/nologin"
iocage exec radarr chown -R radarr:radarr /usr/local/share/Radarr /config
iocage exec radarr mkdir /usr/local/etc/rc.d
cp ../includes/radarr-conf/radarr.rc /mnt/tank/iocage/jails/radarr/root/usr/local/etc/rc.d/radarr
iocage exec radarr chmod u+x /usr/local/etc/rc.d/radarr
iocage exec radarr sysrc "radarr_enable=YES"
iocage exec radarr service radarr start

View File

@ -1,20 +0,0 @@
echo '{"pkgs":["mono","mediainfo","sqlite3","ca_root_nss","curl","nano"]}' > /tmp/pkg.json
iocage create -n "sonarr" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge31" ip4_addr="vnet0|192.168.31.23/24" defaultrouter="192.168.31.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec sonarr mkdir -p /config
iocage exec sonarr mkdir -p /mnt/series
iocage exec sonarr mkdir -p /mnt/fetched
iocage fstab -a sonarr /mnt/tank/apps/sonarr /config nullfs rw 0 0
iocage fstab -a sonarr /mnt/tank/downloads/complete /mnt/fetched nullfs rw 0 0
iocage fstab -a sonarr /mnt/tank/library/Series /mnt/series nullfs rw 0 0
iocage exec sonarr ln -s /usr/local/bin/mono /usr/bin/mono
iocage exec sonarr "fetch http://download.sonarr.tv/v2/master/mono/NzbDrone.master.tar.gz -o /usr/local/share"
iocage exec sonarr "tar -xzvf /usr/local/share/NzbDrone.master.tar.gz -C /usr/local/share"
iocage exec sonarr rm /usr/local/share/NzbDrone.master.tar.gz
iocage exec sonarr "pw user add sonarr -c sonarr -u 351 -d /nonexistent -s /usr/bin/nologin"
iocage exec sonarr chown -R sonarr:sonarr /usr/local/share/NzbDrone /config
iocage exec sonarr mkdir /usr/local/etc/rc.d
cp ../includes/sonarr-conf/sonarr.rc /mnt/tank/iocage/jails/sonarr/root/usr/local/etc/rc.d/sonarr
iocage exec sonarr chmod u+x /usr/local/etc/rc.d/sonarr
iocage exec sonarr sysrc "sonarr_enable=YES"
iocage exec sonarr service sonarr start

View File

@ -1,17 +0,0 @@
echo '{"pkgs":["bash","unzip","unrar","transmission","ca_root_nss","nano"]}' > /tmp/pkg.json
iocage create -n "transmission" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge31" ip4_addr="vnet0|192.168.31.22/24" defaultrouter="192.168.31.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec transmission mkdir -p /config
iocage exec transmission mkdir -p /mnt/downloads
iocage exec transmission mkdir -p /mnt/downloads/complete
iocage exec transmission mkdir -p /mnt/downloads/incomplete
iocage fstab -a transmission /mnt/tank/apps/transmission /config nullfs rw 0 0
iocage fstab -a transmission /mnt/tank/downloads /mnt/downloads nullfs rw 0 0
iocage fstab -a transmission /mnt/tank/downloads/complete /mnt/downloads/complete nullfs rw 0 0
iocage fstab -a transmission /mnt/tank/downloads/incomplete /mnt/downloads/incomplete nullfs rw 0 0
iocage exec transmission mkdir -p /config
iocage exec transmission chown -R transmission:transmission /config
iocage exec transmission sysrc "transmission_enable=YES"
iocage exec transmission sysrc "transmission_conf_dir=/config"
iocage exec transmission sysrc "transmission_download_dir=/mnt/downloads/complete"
iocage exec transmission service transmission start

53
jailcreate.sh Executable file
View File

@ -0,0 +1,53 @@
#!/usr/local/bin/bash
echo "Checking config..."
jailname="${1}"
jailpkgs="${1}_pkgs"
jailinterfaces="${1}_interfaces"
jailip4="${1}_ip4_addr"
jailgateway="${1}_gateway"
jaildhcp="${1}_dhcp"
setdhcp=${!jaildhcp}
if [ -z "${!jailinterfaces}" ]; then
jailinterfaces="vnet0:bridge0"
else
jailinterfaces=${!jailinterfaces}
fi
if [ -z "${setdhcp}" ] && [ -z "${!jailip4}" ] && [ -z "${!jailgateway}" ]; then
echo 'no network settings specified in config.yml, defaulting to dhcp="on"'
setdhcp="on"
fi
if [ -z "${!jailname}" ]; then
echo "ERROR, jail not defined in config.yml"
exit 1
else
echo "Creating jail for $1"
pkgs="$(sed 's/[^[:space:]]\{1,\}/"&"/g;s/ /,/g' <<<"${!jailpkgs} ${global_jails_pkgs}")"
echo '{"pkgs":['${pkgs}']}' > /tmp/pkg.json
if [ "${setdhcp}" == "on" ]
then
iocage create -n "${1}" -p /tmp/pkg.json -r ${global_jails_version} interfaces="${jailinterfaces}" dhcp="on" vnet="on" allow_raw_sockets="1" boot="on"
else
iocage create -n "${1}" -p /tmp/pkg.json -r ${global_jails_version} interfaces="${jailinterfaces}" ip4_addr="vnet0|${!jailip4}" defaultrouter="${!jailgateway}" vnet="on" allow_raw_sockets="1" boot="on"
fi
rm /tmp/pkg.json
echo "creating jail config directory"
iocage exec $1 mkdir -p /config
if [ ! -d "/mnt/${global_dataset_config}" ]; then
echo "Config root dataset does not exist... Creating... ${global_dataset_config}"
zfs create ${global_dataset_config}
fi
if [ ! -d "/mnt/${global_dataset_config}/$1" ]; then
echo "Config dataset does not exist... Creating... ${global_dataset_config}/$1"
zfs create ${global_dataset_config}/$1
fi
iocage fstab -a $1 /mnt/${global_dataset_config}/$1 /config nullfs rw 0 0
echo "Jail creation completed for $1"
fi

170
jailman.sh Executable file
View File

@ -0,0 +1,170 @@
#!/usr/local/bin/bash
# Important defines:
export SCRIPT_NAME=$(basename $(test -L "${BASH_SOURCE[0]}" && readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}"));
export SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd);
echo "Working directory for jailman.sh is: ${SCRIPT_DIR}"
#Includes
source ${SCRIPT_DIR}/global.sh
# Check for root privileges
if ! [ $(id -u) = 0 ]; then
echo "This script must be run with root privileges"
exit 1
fi
# Auto Update
BRANCH="master"
gitupdate ${BRANCH}
# If no option is given, point to the help menu
if [ $# -eq 0 ]
then
echo "Missing options!"
echo "(run $0 -h for help)"
echo ""
exit 0
fi
# Go through the options and put the jails requested in an array
unset -v sub
while getopts ":i:r:u:d:g:h" opt
do
case $opt in
i ) installjails=("$OPTARG")
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
installjails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1))
done
;;
r ) redojails=("$OPTARG")
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
redojails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1))
done
;;
u ) updatejails=("$OPTARG")
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
updateljails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1))
done
;;
d ) destroyjails=("$OPTARG")
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
deletejails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1))
done
;;
g ) upgradejails=("$OPTARG")
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
upgradejails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1))
done
;;
h )
echo "Usage:"
echo "$0 -i "
echo "$0 -r "
echo "$0 -u "
echo "$0 -d "
echo "$0 -g "
echo ""
echo " -i to install jails, listed by name, space seperated like this: jackett plex sonarr"
echo " -r to reinstall jails, listed by name, space seperated like this: jackett plex sonarr"
echo " -u to update jails, listed by name, space seperated like this: jackett plex sonarr"
echo " -d to destroy jails, listed by name, space seperated like this: jackett plex sonarrt"
echo " -g to upgrade jails, listed by name, space seperated like this: jackett plex sonarr"
echo " -h help (this output)"
exit 0
;;
? ) echo "Error: Invalid option was specified -$OPTARG"
exit 0
;;
esac
done
# Parse the Config YAML
eval $(parse_yaml config.yml)
# Check and Execute requested jail destructions
if [ ${#destroyjails[@]} -eq 0 ]; then
echo "No jails to destroy"
else
echo "jails to destroy ${destroyjails[@]}"
for jail in "${destroyjails[@]}"
do
echo "destroying $jail"
iocage destroy -f $jail
done
fi
# Check and Execute requested jail Installs
if [ ${#installjails[@]} -eq 0 ]; then
echo "No jails to install"
else
echo "jails to install ${installjails[@]}"
for jail in "${installjails[@]}"
do
if [ -f "${SCRIPT_DIR}/jails/$jail/install.sh" ]
then
echo "Installing $jail"
${SCRIPT_DIR}/jailcreate.sh $jail && ${SCRIPT_DIR}/jails/$jail/install.sh
else
echo "Missing install script for $jail in ${SCRIPT_DIR}/jails/$jail/install.sh"
fi
done
fi
# Check and Execute requested jail Reinstalls
if [ ${#redojails[@]} -eq 0 ]; then
echo "No jails to ReInstall"
else
echo "jails to reinstall ${redojails[@]}"
for jail in "${redojails[@]}"
do
if [ -f "${SCRIPT_DIR}/jails/$jail/install.sh" ]
then
echo "Reinstalling $jail"
iocage destroy -f $jail && ${SCRIPT_DIR}/jailcreate.sh $jail && ${SCRIPT_DIR}/jails/$jail/install.sh
else
echo "Missing install script for $jail in ${SCRIPT_DIR}/jails/$jail/update.sh"
fi
done
fi
# Check and Execute requested jail Updates
if [ ${#updatejails[@]} -eq 0 ]; then
echo "No jails to Update"
else
echo "jails to update ${updatejails[@]}"
for jail in "${updatejails[@]}"
do
if [ -f "${SCRIPT_DIR}/jails/$jail/update.sh" ]
then
echo "Updating $jail"
iocage update $jail && iocage exec $jail "pkg update && pkg upgrade -y" && ${SCRIPT_DIR}/jails/$jail/update.sh
iocage restart $jail
else
echo "Missing update script for $jail in ${SCRIPT_DIR}/jails/$jail/update.sh"
fi
done
fi
# Check and Execute requested jail Upgrades
if [ ${#upgradejails[@]} -eq 0 ]; then
echo "No jails to Upgrade"
else
echo "jails to update ${upgradejails[@]}"
for jail in "${upgradejails[@]}"
do
if [ -f "${SCRIPT_DIR}/jails/$jail/update.sh" ]
then
echo "Currently Upgrading is not yet included in this script."
else
echo "Missing update script for $jail in ${SCRIPT_DIR}/jails/$jail/update.sh"
fi
done
fi

View File

@ -1,8 +1,6 @@
echo '{"pkgs":["mono","curl","ca_root_nss","nano"]}' > /tmp/pkg.json
iocage create -n "jackett" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge31" ip4_addr="vnet0|192.168.31.30/24" defaultrouter="192.168.21.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec jackett mkdir -p /config
iocage fstab -a jackett /mnt/tank/apps/jackett /config nullfs rw 0 0
#!/usr/local/bin/bash
# This file contains the install script for jackett
iocage exec jackett ln -s /usr/local/bin/mono /usr/bin/mono
iocage exec jackett "fetch https://github.com/Jackett/Jackett/releases/download/v0.11.502/Jackett.Binaries.Mono.tar.gz -o /usr/local/share"
iocage exec jackett "tar -xzvf /usr/local/share/Jackett.Binaries.Mono.tar.gz -C /usr/local/share"
@ -10,7 +8,7 @@ iocage exec jackett rm /usr/local/share/Jackett.Binaries.Mono.tar.gz
iocage exec jackett "pw user add jackett -c jackett -u 818 -d /nonexistent -s /usr/bin/nologin"
iocage exec jackett chown -R jackett:jackett /usr/local/share/Jackett /config
iocage exec jackett mkdir /usr/local/etc/rc.d
cp ../includes/jackett-conf/jackett.rc /mnt/tank/iocage/jails/jackett/root/usr/local/etc/rc.d/jackett
cp ${SCRIPT_DIR}/jails/jackett/includes/jackett.rc /mnt/${global_dataset_iocage}/jails/jackett/root/usr/local/etc/rc.d/jackett
iocage exec jackett chmod u+x /usr/local/etc/rc.d/jackett
iocage exec jackett sysrc "jackett_enable=YES"
iocage exec jackett service jackett restart
iocage exec jackett service jackett restart

6
jails/jackett/readme.md Normal file
View File

@ -0,0 +1,6 @@
## jackett
Jackett is tool designed to combine and search multiple bittorrent trackers like a proxy.
### Post-install
Currently there are not relevant post-install steps, other than your own personal preferences for setting up Jacket.

9
jails/jackett/update.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/local/bin/bash
# This file contains the update script for jackett
iocage exec jackett service jackett stop
#TODO insert code to update jacket itself here
iocage exec jackett chown -R jackett:jackett /usr/local/share/Jackett /config
cp ${SCRIPT_DIR}/jails/test10/includes/jackett.rc /mnt/${global_dataset_iocage}/jails/test10/root/usr/local/etc/rc.d/jackett
iocage exec jackett chmod u+x /usr/local/etc/rc.d/jackett
iocage exec jackett service jackett restart

12
jails/kms/install.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/local/bin/bash
# This file contains the install script for KMS
iocage exec kms svn checkout https://github.com/SystemRage/py-kms/trunk/py-kms /usr/local/share/py-kms
iocage exec kms "pw user add kms -c kms -u 666 -d /nonexistent -s /usr/bin/nologin"
iocage exec kms chown -R kms:kms /usr/local/share/py-kms /config
iocage exec kms mkdir /usr/local/etc/rc.d
cp ${SCRIPT_DIR}/jails/kms/includes/py_kms.rc /mnt/${global_dataset_iocage}/jails/kms/root/usr/local/etc/rc.d/py_kms
iocage exec kms chmod u+x /usr/local/etc/rc.d/py_kms
iocage exec kms sysrc "py_kms_enable=YES"
iocage exec kms service py_kms start

9
jails/kms/update.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/local/bin/bash
# This file contains the update script for KMS
iocage exec kms service py_kms stop
iocage exec kms svn checkout https://github.com/SystemRage/py-kms/trunk/py-kms /usr/local/share/py-kms
iocage exec kms chown -R kms:kms /usr/local/share/py-kms /config
cp ${SCRIPT_DIR}/jails/kms/includes/py_kms.rc /mnt/${global_dataset_iocage}/jails/kms/root/usr/local/etc/rc.d/py_kms
iocage exec kms chmod u+x /usr/local/etc/rc.d/py_kms
iocage exec kms service py_kms start

44
jails/lidarr/install.sh Executable file
View File

@ -0,0 +1,44 @@
#!/usr/local/bin/bash
# This file contains the install script for lidarr
iocage exec lidarr mkdir -p /mnt/music
iocage exec lidarr mkdir -p /mnt/fetched
# Check if dataset for completed download and it parent dataset exist, create if they do not.
if [ ! -d "/mnt/${global_dataset_downloads}" ]; then
echo "Downloads dataset does not exist... Creating... ${global_dataset_downloads}"
zfs create ${global_dataset_downloads}
fi
if [ ! -d "/mnt/${global_dataset_downloads}/complete" ]; then
echo "Completed Downloads dataset does not exist... Creating... ${global_dataset_downloads}/complete"
zfs create ${global_dataset_downloads}/complete
fi
iocage fstab -a lidarr /mnt/${global_dataset_downloads}/complete /mnt/fetched nullfs rw 0 0
# Check if dataset for media library and the dataset for music exist, create if they do not.
if [ ! -d "/mnt/${global_dataset_media}" ]; then
echo "Media dataset does not exist... Creating... ${global_dataset_media}"
zfs create ${global_dataset_media}
fi
if [ ! -d "/mnt/${global_dataset_media}/music" ]; then
echo "Music dataset does not exist... Creating... ${global_dataset_media}/music"
zfs create ${global_dataset_media}/music
fi
iocage fstab -a lidarr /mnt/${global_dataset_media}/music /mnt/music nullfs rw 0 0
iocage exec lidarr ln -s /usr/local/bin/mono /usr/bin/mono
iocage exec lidarr "fetch https://github.com/lidarr/Lidarr/releases/download/v0.2.0.371/Lidarr.develop.0.2.0.371.linux.tar.gz -o /usr/local/share"
iocage exec lidarr "tar -xzvf /usr/local/share/Lidarr.develop.0.2.0.371.linux.tar.gz -C /usr/local/share"
iocage exec lidarr "rm /usr/local/share/Lidarr.develop.0.2.0.371.linux.tar.gz"
iocage exec lidarr "pw user add lidarr -c lidarr -u 353 -d /nonexistent -s /usr/bin/nologin"
iocage exec lidarr chown -R lidarr:lidarr /usr/local/share/Lidarr /config
iocage exec lidarr mkdir /usr/local/etc/rc.d
cp ${SCRIPT_DIR}/jails/lidarr/includes/lidarr.rc /mnt/${global_dataset_iocage}/jails/lidarr/root/usr/local/etc/rc.d/lidarr
iocage exec lidarr chmod u+x /usr/local/etc/rc.d/lidarr
iocage exec lidarr sysrc "lidarr_enable=YES"
iocage exec lidarr service lidarr start

9
jails/lidarr/update.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/local/bin/bash
# This file contains the update script for lidarr
iocage exec lidarr service lidarr stop
#TODO insert code to update lidarr itself here
iocage exec lidarr chown -R lidarr:lidarr /usr/local/share/lidarr /config
cp ${SCRIPT_DIR}/jails/lidarr/includes/lidarr.rc /mnt/${global_dataset_iocage}/jails/lidarr/root/usr/local/etc/rc.d/lidarr
iocage exec lidarr chmod u+x /usr/local/etc/rc.d/lidarr
iocage exec lidarr service lidarr restart

View File

@ -0,0 +1,25 @@
user www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
include custom/organizr.conf;
}
server {
listen 443 ssl;
server_name localhost;
include custom/organizr.conf;
ssl_certificate /config/cert/Organizr-Cert.crt; # Replace with actually valid certificate
ssl_certificate_key /config/cert/Organizr-Cert.key; # Replace with actually valid certificate
}
}

View File

@ -1,8 +1,6 @@
echo '{"pkgs":["nginx","php72","php72-filter","php72-curl","php72-hash","php72-json","php72-openssl","php72-pdo","php72-pdo_sqlite","php72-session","php72-simplexml","php72-sqlite3","php72-zip","git","ca_root_nss"]}' > /tmp/pkg.json
iocage create -n "organizr" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge30" ip4_addr="vnet0|192.168.30.25/24" defaultrouter="192.168.30.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec organizr mkdir -p /config
iocage fstab -a organizr /mnt/tank/apps/organizr /config nullfs rw 0 0
#!/usr/local/bin/bash
# This file contains the install script for Organizr
iocage exec organizr sed -i '' -e 's?listen = 127.0.0.1:9000?listen = /var/run/php-fpm.sock?g' /usr/local/etc/php-fpm.d/www.conf
iocage exec organizr sed -i '' -e 's/;listen.owner = www/listen.owner = www/g' /usr/local/etc/php-fpm.d/www.conf
iocage exec organizr sed -i '' -e 's/;listen.group = www/listen.group = www/g' /usr/local/etc/php-fpm.d/www.conf
@ -10,13 +8,27 @@ iocage exec organizr sed -i '' -e 's/;listen.mode = 0660/listen.mode = 0600/g' /
iocage exec organizr cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
iocage exec organizr sed -i '' -e 's?;date.timezone =?date.timezone = "Universal"?g' /usr/local/etc/php.ini
iocage exec organizr sed -i '' -e 's?;cgi.fix_pathinfo=1?cgi.fix_pathinfo=0?g' /usr/local/etc/php.ini
mv /mnt/tank/iocage/jails/organizr/root/usr/local/etc/nginx/nginx.conf /mnt/tank/iocage/jails/organizr/root/usr/local/etc/nginx/nginx.conf.bak
cp ../includes/organizr-conf/nginx.conf /mnt/tank/iocage/jails/organizr/root/usr/local/etc/nginx/nginx.conf
cp ../includes/organizr-conf/custom /mnt/tank/iocage/jails/organizr/root/usr/local/etc/nginx/custom
mv /mnt/${global_dataset_iocage}/jails/organizr/root/usr/local/etc/nginx/nginx.conf /mnt/${global_dataset_iocage}/jails/organizr/root/usr/local/etc/nginx/nginx.conf.bak
cp ${SCRIPT_DIR}/jails/organizr/includes/nginx.conf /mnt/${global_dataset_iocage}/jails/organizr/root/usr/local/etc/nginx/nginx.conf
cp -Rf ${SCRIPT_DIR}/jails/organizr/includes/custom /mnt/${global_dataset_iocage}/jails/organizr/root/usr/local/etc/nginx/custom
if [ ! -d "/mnt/${global_dataset_config}/organizr/cert" ]; then
echo "cert folder not existing... creating..."
iocage exec organizr mkdir /config/cert
fi
if [ -f "/mnt/${global_dataset_config}/organizr/cert/Organizr-Cert.crt" ]; then
echo "certificate exist... Skipping cert generation"
else
"No ssl certificate present, generating self signed certificate"
openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost" -keyout /mnt/${global_dataset_config}/organizr/cert/Organizr-Cert.key -out /mnt/${global_dataset_config}/organizr/cert/Organizr-Cert.crt
fi
iocage exec organizr git clone https://github.com/causefx/Organizr.git /usr/local/www/Organizr
iocage exec organizr chown -R www:www /usr/local/www /config /usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/custom
iocage exec organizr ln -s /config/config.php /usr/local/www/Organizr/api/config/config.php
iocage exec organizr sysrc nginx_enable=YES
iocage exec organizr sysrc php_fpm_enable=YES
iocage exec organizr service nginx start
iocage exec organizr service php-fpm start
iocage exec organizr service php-fpm start

View File

@ -1,9 +1,11 @@
#!/usr/local/bin/bash
# This file contains the update script for Organizr
iocage exec organizr service nginx stop
iocage exec organizr service php-fpm stop
iocage update organizr
iocage exec organizr "pkg update && pkg upgrade -y"
cp ../includes/organizr-conf/nginx.conf /mnt/tank/iocage/jails/organizr/root/usr/local/etc/nginx/nginx.conf
cp ../includes/organizr-conf/custom/*.* /mnt/tank/iocage/jails/organizr/root/usr/local/etc/nginx/custom/
# TODO setup cli update for Organizr here.
cp ${SCRIPT_DIR}/jails/organizr/includes/nginx.conf /mnt/${global_dataset_iocage}/jails/organizr/root/usr/local/etc/nginx/nginx.conf
iocage exec organizr "cd /usr/local/www/Organizr && git pull"
iocage exec organizr chown -R www:www /usr/local/www /config /usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/custom
iocage exec organizr service nginx start

65
jails/plex/install.sh Executable file
View File

@ -0,0 +1,65 @@
#!/usr/local/bin/bash
# This file contains the install script for plex
iocage exec plex mkdir -p /usr/local/etc/pkg/repos
iocage exec plex mkdir -p /mnt/media
iocage exec plex mkdir -p /mnt/media/movies
iocage exec plex mkdir -p /mnt/media/music
iocage exec plex mkdir -p /mnt/media/shows
# Change to to more frequent FreeBSD repo to stay up-to-date with plex more.
cp ${SCRIPT_DIR}/jails/plex/includes/FreeBSD.conf /mnt/${global_dataset_iocage}/jails/plex/root/usr/local/etc/pkg/repos/FreeBSD.conf
# Check if datasets for media librarys exist, create them if they do not.
if [ ! -d "/mnt/${global_dataset_media}" ]; then
echo "Media dataset does not exist... Creating... ${global_dataset_media}"
zfs create ${global_dataset_media}
fi
iocage fstab -a plex /mnt/${global_dataset_media} /mnt/media nullfs rw 0 0
if [ ! -d "/mnt/${global_dataset_media}/shows" ]; then
echo "TV Shows dataset does not exist... Creating... ${global_dataset_media}/shows"
zfs create ${global_dataset_media}/shows
fi
iocage fstab -a plex /mnt/${global_dataset_media}/shows /mnt/media/shows nullfs rw 0 0
if [ ! -d "/mnt/${global_dataset_media}/music" ]; then
echo "music dataset does not exist... Creating... ${global_dataset_media}/music"
zfs create ${global_dataset_media}/music
fi
iocage fstab -a plex /mnt/${global_dataset_media}/music /mnt/media/music nullfs rw 0 0
if [ ! -d "/mnt/${global_dataset_media}/movies" ]; then
echo "movies dataset does not exist... Creating... ${global_dataset_media}/movies"
zfs create ${global_dataset_media}/movies
fi
iocage fstab -a plex /mnt/${global_dataset_media}/movies /mnt/media/movies nullfs rw 0 0
iocage exec plex chown -R plex:plex /config
# Force update pkg to get latest plex version
iocage exec plex pkg update
iocage exec plex pkg upgrade -y
# Run different install procedures depending on Plex vs Plexpass
if [ "$plex_plexpass" == "true" ]; then
echo "plexpass enabled in config.yml... using plexpass for install"
iocage exec plex sysrc "plexmediaserver_plexpass_enable=YES"
iocage exec plex sysrc plexmediaserver_plexpass_support_path="/config"
iocage exec plex chown -R plex:plex /usr/local/share/plexmediaserver-plexpass/
iocage exec plex service plexmediaserver_plexpass restart
else
echo "plexpass disabled in config.yml... NOT using plexpass for install"
iocage exec plex sysrc "plexmediaserver_enable=YES"
iocage exec plex sysrc plexmediaserver_support_path="/config"
iocage exec plex chown -R plex:plex /usr/local/share/plexmediaserver/
iocage exec plex service plexmediaserver restart
fi
echo "Finished installing plex"

22
jails/plex/update.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/local/bin/bash
# This file contains the update script for Plex
# Run different update procedures depending on Plex vs Plexpass
if [ "$plex_plexpass" == "true" ]; then
echo "plexpass enabled in config.yml... using plexpass for update..."
iocage exec plex service plexmediaserver_plexpass stop
# Plex is updated using PKG already, this is mostly a placeholder
iocage exec plex chown -R plex:plex /usr/local/share/plexmediaserver-plexpass/
iocage exec plex service plexmediaserver_plexpass restart
else
echo "plexpass disabled in config.yml... NOT using plexpass for update..."
iocage exec plex service plexmediaserver stop
# Plex is updated using PKG already, this is mostly a placeholder
iocage exec plex chown -R plex:plex /usr/local/share/plexmediaserver/
iocage exec plex service plexmediaserver restart
fi

43
jails/radarr/install.sh Executable file
View File

@ -0,0 +1,43 @@
#!/usr/local/bin/bash
# This file contains the install script for radarr
iocage exec radarr mkdir -p /mnt/movies
iocage exec radarr mkdir -p /mnt/fetched
# Check if dataset for completed download and it parent dataset exist, create if they do not.
if [ ! -d "/mnt/${global_dataset_downloads}" ]; then
echo "Downloads dataset does not exist... Creating... ${global_dataset_downloads}"
zfs create ${global_dataset_downloads}
fi
if [ ! -d "/mnt/${global_dataset_downloads}/complete" ]; then
echo "Completed Downloads dataset does not exist... Creating... ${global_dataset_downloads}/complete"
zfs create ${global_dataset_downloads}/complete
fi
iocage fstab -a radarr /mnt/${global_dataset_downloads}/complete /mnt/fetched nullfs rw 0 0
# Check if dataset for media library and the dataset for movies exist, create if they do not.
if [ ! -d "/mnt/${global_dataset_media}" ]; then
echo "Media dataset does not exist... Creating... ${global_dataset_media}"
zfs create ${global_dataset_media}
fi
if [ ! -d "/mnt/${global_dataset_media}/movies" ]; then
echo "Movies dataset does not exist... Creating... ${global_dataset_media}/movies"
zfs create ${global_dataset_media}/movies
fi
iocage fstab -a radarr /mnt/${global_dataset_media}/movies /mnt/movies nullfs rw 0 0
iocage exec radarr ln -s /usr/local/bin/mono /usr/bin/mono
iocage exec radarr "fetch https://github.com/Radarr/Radarr/releases/download/v0.2.0.1480/Radarr.develop.0.2.0.1480.linux.tar.gz -o /usr/local/share"
iocage exec radarr "tar -xzvf /usr/local/share/Radarr.develop.0.2.0.1480.linux.tar.gz -C /usr/local/share"
iocage exec radarr rm /usr/local/share/Radarr.develop.0.2.0.1480.linux.tar.gz
iocage exec radarr "pw user add radarr -c radarr -u 352 -d /nonexistent -s /usr/bin/nologin"
iocage exec radarr chown -R radarr:radarr /usr/local/share/Radarr /config
iocage exec radarr mkdir /usr/local/etc/rc.d
cp ${SCRIPT_DIR}/jails/radarr/includes/radarr.rc /mnt/${global_dataset_iocage}/jails/radarr/root/usr/local/etc/rc.d/radarr
iocage exec radarr chmod u+x /usr/local/etc/rc.d/radarr
iocage exec radarr sysrc "radarr_enable=YES"
iocage exec radarr service radarr restart

9
jails/radarr/update.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/local/bin/bash
# This file contains the update script for radarr
iocage exec radarr service radarr stop
#TODO insert code to update radarr itself here
iocage exec radarr chown -R radarr:radarr /usr/local/share/Radarr /config
cp ${SCRIPT_DIR}/jails/radarr/includes/radarr.rc /mnt/${global_dataset_iocage}/jails/radarr/root/usr/local/etc/rc.d/radarr
iocage exec radarr chmod u+x /usr/local/etc/rc.d/radarr
iocage exec radarr service radarr restart

44
jails/sonarr/install.sh Executable file
View File

@ -0,0 +1,44 @@
#!/usr/local/bin/bash
# This file contains the install script for sonarr
iocage exec sonarr mkdir -p /mnt/shows
iocage exec sonarr mkdir -p /mnt/fetched
# Check if dataset for completed download and it parent dataset exist, create if they do not.
if [ ! -d "/mnt/${global_dataset_downloads}" ]; then
echo "Downloads dataset does not exist... Creating... ${global_dataset_downloads}"
zfs create ${global_dataset_downloads}
fi
if [ ! -d "/mnt/${global_dataset_downloads}/complete" ]; then
echo "Completed Downloads dataset does not exist... Creating... ${global_dataset_downloads}/complete"
zfs create ${global_dataset_downloads}/complete
fi
iocage fstab -a sonarr /mnt/${global_dataset_downloads}/complete /mnt/fetched nullfs rw 0 0
# Check if dataset for media library and the dataset for tv shows exist, create if they do not.
if [ ! -d "/mnt/${global_dataset_media}" ]; then
echo "Media dataset does not exist... Creating... ${global_dataset_media}"
zfs create ${global_dataset_media}
fi
if [ ! -d "/mnt/${global_dataset_media}/shows" ]; then
echo "TV Shows dataset does not exist... Creating... ${global_dataset_media}/shows"
zfs create ${global_dataset_media}/shows
fi
iocage fstab -a sonarr /mnt/${global_dataset_media}/shows /mnt/shows nullfs rw 0 0
iocage exec sonarr ln -s /usr/local/bin/mono /usr/bin/mono
iocage exec sonarr "fetch http://download.sonarr.tv/v2/master/mono/NzbDrone.master.tar.gz -o /usr/local/share"
iocage exec sonarr "tar -xzvf /usr/local/share/NzbDrone.master.tar.gz -C /usr/local/share"
iocage exec sonarr rm /usr/local/share/NzbDrone.master.tar.gz
iocage exec sonarr "pw user add sonarr -c sonarr -u 351 -d /nonexistent -s /usr/bin/nologin"
iocage exec sonarr chown -R sonarr:sonarr /usr/local/share/NzbDrone /config
iocage exec sonarr mkdir /usr/local/etc/rc.d
cp ${SCRIPT_DIR}/jails/sonarr/includes/sonarr.rc /mnt/${global_dataset_iocage}/jails/sonarr/root/usr/local/etc/rc.d/sonarr
iocage exec sonarr chmod u+x /usr/local/etc/rc.d/sonarr
iocage exec sonarr sysrc "sonarr_enable=YES"
iocage exec sonarr service sonarr restart

9
jails/sonarr/update.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/local/bin/bash
# This file contains the update script for sonarr
iocage exec sonarr service sonarr stop
#TODO insert code to update sonarr itself here
iocage exec sonarr chown -R sonarr:sonarr /usr/local/share/NzbDrone /config
cp ${SCRIPT_DIR}/jails/sonarr/includes/sonarr.rc /mnt/${global_dataset_iocage}/jails/sonarr/root/usr/local/etc/rc.d/sonarr
iocage exec sonarr chmod u+x /usr/local/etc/rc.d/sonarr
iocage exec sonarr service sonarr restart

View File

@ -1,8 +1,7 @@
echo '{"pkgs":["python2","py27-sqlite3","py27-openssl","ca_root_nss","git","nano"]}' > /tmp/pkg.json
iocage create -n "tautulli" -p /tmp/pkg.json -r 11.3-RELEASE interfaces="vnet0:bridge31" ip4_addr="vnet0|192.168.31.26/24" defaultrouter="192.168.31.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage exec tautulli mkdir -p /config
iocage fstab -a tautulli /mnt/tank/apps/tautulli /config nullfs rw 0 0
#!/usr/local/bin/bash
# This file contains the install script for Tautulli
iocage exec tautulli git clone https://github.com/Tautulli/Tautulli.git /usr/local/share/Tautulli
iocage exec tautulli "pw user add tautulli -c tautulli -u 109 -d /nonexistent -s /usr/bin/nologin"
iocage exec tautulli chown -R tautulli:tautulli /usr/local/share/Tautulli /config

View File

@ -1,6 +1,8 @@
#!/usr/local/bin/bash
# This file contains the update script for Tautulli
iocage exec tautulli service tautulli stop
iocage update tautulli
iocage exec tautulli "pkg update && pkg upgrade -y"
# Tautulli is updated through pkg, this is mostly just a placeholder
iocage exec tautulli chown -R tautulli:tautulli /usr/local/share/Tautulli /config
iocage exec tautulli cp /usr/local/share/Tautulli/init-scripts/init.freenas /usr/local/etc/rc.d/tautulli
iocage exec tautulli chmod u+x /usr/local/etc/rc.d/tautulli

38
jails/transmission/install.sh Executable file
View File

@ -0,0 +1,38 @@
#!/usr/local/bin/bash
# This file contains the install script for transmission
iocage exec transmission mkdir -p /mnt/downloads
iocage exec transmission mkdir -p /mnt/downloads/complete
iocage exec transmission mkdir -p /mnt/downloads/incomplete
# Check if dataset Downloads dataset exist, create if they do not.
if [ ! -d "/mnt/${global_dataset_downloads}" ]; then
echo "Downloads dataset does not exist... Creating... ${global_dataset_downloads}"
zfs create ${global_dataset_downloads}
fi
iocage fstab -a transmission /mnt/${global_dataset_downloads} /mnt/downloads nullfs rw 0 0
# Check if dataset Complete Downloads dataset exist, create if they do not.
if [ ! -d "/mnt/${global_dataset_downloads}/complete" ]; then
echo "Completed Downloads dataset does not exist... Creating... ${global_dataset_downloads}/complete"
zfs create ${global_dataset_downloads}/complete
fi
iocage fstab -a transmission /mnt/${global_dataset_downloads}/complete /mnt/downloads/complete nullfs rw 0 0
# Check if dataset InComplete Downloads dataset exist, create if they do not.
if [ ! -d "/mnt/${global_dataset_downloads}/incomplete" ]; then
echo "Completed Downloads dataset does not exist... Creating... ${global_dataset_downloads}/incomplete"
zfs create ${global_dataset_downloads}/incomplete
fi
iocage fstab -a transmission /mnt/${global_dataset_downloads}/incomplete /mnt/downloads/incomplete nullfs rw 0 0
iocage exec transmission mkdir -p /config
iocage exec transmission chown -R transmission:transmission /config
iocage exec transmission sysrc "transmission_enable=YES"
iocage exec transmission sysrc "transmission_conf_dir=/config"
iocage exec transmission sysrc "transmission_download_dir=/mnt/downloads/complete"
iocage exec transmission service transmission restart

7
jails/transmission/update.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/local/bin/bash
# This file contains the update script for transmission
iocage exec transmission service transmission stop
# Transmision is updated during PKG update, this file is mostly just a placeholder
iocage exec transmission chown -R transmission:transmission /config
iocage exec transmission service transmission restart

View File

@ -1,4 +0,0 @@
cd update
for f in *.sh; do
sh "$f"
done

View File

@ -1,7 +0,0 @@
iocage exec jackett service jackett stop
iocage update jackett
iocage exec jackett "pkg update && pkg upgrade -y"
iocage exec jackett chown -R jackett:jackett /usr/local/share/Jackett /config
cp ../includes/jackett-conf/jackett.rc /mnt/tank/iocage/jails/jackett/root/usr/local/etc/rc.d/jackett
iocage exec jackett chmod u+x /usr/local/etc/rc.d/jackett
iocage exec jackett service jackett restart

View File

@ -1,7 +0,0 @@
iocage exec lidarr service lidarr stop
iocage update lidarr
iocage exec lidarr "pkg update && pkg upgrade -y"
iocage exec lidarr chown -R lidarr:lidarr /usr/local/share/Lidarr /config
cp ../includes/lidarr-conf/lidarr.rc /mnt/tank/iocage/jails/lidarr/root/usr/local/etc/rc.d/lidarr
iocage exec lidarr chmod u+x /usr/local/etc/rc.d/lidarr
iocage exec lidarr service lidarr restart

View File

@ -1,8 +0,0 @@
iocage exec plex service plexmediaserver_plexpass stop
iocage update plex
iocage exec plex "pkg update && pkg upgrade -y"
iocage exec plex chown -R plex:plex /usr/local/share/plexmediaserver-plexpass/
iocage exec plex service plexmediaserver_plexpass restart
sleep 10s
iocage exec plex service plexmediaserver_plexpass start
echo "Finished updating plex"

View File

@ -1,7 +0,0 @@
iocage exec radarr service radarr stop
iocage update radarr
iocage exec radarr "pkg update && pkg upgrade -y"
iocage exec radarr chown -R radarr:radarr /usr/local/share/Radarr /config
cp ../includes/radarr-conf/radarr.rc /mnt/tank/iocage/jails/radarr/root/usr/local/etc/rc.d/radarr
iocage exec radarr chmod u+x /usr/local/etc/rc.d/radarr
iocage exec radarr service radarr restart

View File

@ -1,7 +0,0 @@
iocage exec sonarr service sonarr stop
iocage update sonarr
iocage exec sonarr "pkg update && pkg upgrade -y"
iocage exec sonarr chown -R sonarr:sonarr /usr/local/share/NzbDrone /config
cp ../includes/sonarr-conf/sonarr.rc /mnt/tank/iocage/jails/sonarr/root/usr/local/etc/rc.d/sonarr
iocage exec sonarr chmod u+x /usr/local/etc/rc.d/sonarr
iocage exec sonarr service sonarr restart