Linter cleanup (#84)

* Fix all Scriptcheck errors on current dev code

* clean recent plex changes
This commit is contained in:
Kjeld Schouten-Lebbing 2020-04-26 14:55:22 +02:00 committed by kjeld Schouten-Lebbing
parent 46d1487191
commit c32ea280da
26 changed files with 205 additions and 115 deletions

View File

@ -3,12 +3,15 @@
# yml Parser function # yml Parser function
# Based on https://gist.github.com/pkuczynski/8665367 # Based on https://gist.github.com/pkuczynski/8665367
# shellcheck disable=SC2086
parse_yaml() { parse_yaml() {
local prefix=$2 prefix=${2}
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
local prefix
local s w fs
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ 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 | -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" "${1}" |
awk -F$fs '{ awk -F"${fs}" '{
indent = length($1)/2; indent = length($1)/2;
vname[indent] = $2; vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}} for (i in vname) {if (i > indent) {delete vname[i]}}
@ -24,12 +27,12 @@ gitupdate() {
echo "checking for updates using Branch: $1" echo "checking for updates using Branch: $1"
git fetch git fetch
git update-index -q --refresh git update-index -q --refresh
CHANGED=$(git diff --name-only origin/$1) CHANGED=$(git diff --name-only origin/"$1")
if [ ! -z "$CHANGED" ]; if [ -n "$CHANGED" ];
then then
echo "script requires update" echo "script requires update"
git reset --hard git reset --hard
git checkout $1 git checkout "${1}"
git pull git pull
echo "script updated, please restart the script manually" echo "script updated, please restart the script manually"
exit 1 exit 1
@ -64,17 +67,20 @@ if [ -z "${!jailname}" ]; then
exit 1 exit 1
else else
echo "Creating jail for $1" echo "Creating jail for $1"
# shellcheck disable=SC2154
pkgs="$(sed 's/[^[:space:]]\{1,\}/"&"/g;s/ /,/g' <<<"${global_jails_pkgs} ${!jailpkgs}")" pkgs="$(sed 's/[^[:space:]]\{1,\}/"&"/g;s/ /,/g' <<<"${global_jails_pkgs} ${!jailpkgs}")"
echo '{"pkgs":['${pkgs}']}' > /tmp/pkg.json echo '{"pkgs":['"${pkgs}"']}' > /tmp/pkg.json
if [ "${setdhcp}" == "on" ] if [ "${setdhcp}" == "on" ]
then then
if ! iocage create -n "${1}" -p /tmp/pkg.json -r ${global_jails_version} interfaces="${jailinterfaces}" dhcp="on" vnet="on" allow_raw_sockets="1" boot="on" -b # shellcheck disable=SC2154
if ! iocage create -n "${1}" -p /tmp/pkg.json -r "${global_jails_version}" interfaces="${jailinterfaces}" dhcp="on" vnet="on" allow_raw_sockets="1" boot="on" -b
then then
echo "Failed to create jail" echo "Failed to create jail"
exit 1 exit 1
fi fi
else else
if ! 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" -b # shellcheck disable=SC2154
if ! 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" -b
then then
echo "Failed to create jail" echo "Failed to create jail"
exit 1 exit 1
@ -84,19 +90,19 @@ else
rm /tmp/pkg.json rm /tmp/pkg.json
echo "creating jail config directory" echo "creating jail config directory"
# shellcheck disable=SC2154
createmount $1 ${global_dataset_config} createmount "${1}" "${global_dataset_config}"
createmount $1 ${global_dataset_config}/$1 /config createmount "${1}" "${global_dataset_config}"/"${1}" /config
# Create and Mount portsnap # Create and Mount portsnap
echo "Mounting and fetching ports" echo "Mounting and fetching ports"
createmount $1 ${global_dataset_config}/portsnap createmount "${1}" "${global_dataset_config}"/portsnap
createmount $1 ${global_dataset_config}/portsnap/db /var/db/portsnap createmount "${1}" "${global_dataset_config}"/portsnap/db /var/db/portsnap
createmount $1 ${global_dataset_config}/portsnap/ports /usr/ports createmount "${1}" "${global_dataset_config}"/portsnap/ports /usr/ports
iocage exec "$1" "if [ -z /usr/ports ]; then portsnap fetch extract; else portsnap auto; fi" iocage exec "${1}" "if [ -z /usr/ports ]; then portsnap fetch extract; else portsnap auto; fi"
echo "Jail creation completed for $1" echo "Jail creation completed for ${1}"
fi fi
} }
@ -112,17 +118,17 @@ createmount() {
else else
if [ ! -d "/mnt/$2" ]; then if [ ! -d "/mnt/$2" ]; then
echo "Dataset does not exist... Creating... $2" echo "Dataset does not exist... Creating... $2"
zfs create $2 zfs create "${2}"
else else
echo "Dataset already exists, skipping creation of $2" echo "Dataset already exists, skipping creation of $2"
fi fi
if [ -n "$1" ] && [ -n "$3" ]; then if [ -n "$1" ] && [ -n "$3" ]; then
iocage exec $1 mkdir -p $3 iocage exec "${1}" mkdir -p "${3}"
if [ -n "$4" ]; then if [ -n "${4}" ]; then
iocage fstab -a $1 /mnt/$2 $3 $4 iocage fstab -a "${1}" /mnt/"${2}" "${3}" "${4}"
else else
iocage fstab -a $1 /mnt/$2 $3 nullfs rw 0 0 iocage fstab -a "${1}" /mnt/"${2}" "${3}" nullfs rw 0 0
fi fi
else else
echo "No Jail Name or Mount target specified, not mounting dataset" echo "No Jail Name or Mount target specified, not mounting dataset"

View File

@ -1,15 +1,20 @@
#!/usr/local/bin/bash #!/usr/local/bin/bash
# Important defines: # Important defines:
export SCRIPT_NAME=$(basename $(test -L "${BASH_SOURCE[0]}" && readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")); # shellcheck disable=SC2046
export SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd); SCRIPT_NAME=$(basename $(test -L "${BASH_SOURCE[0]}" && readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}"));
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd);
export SCRIPT_NAME
export SCRIPT_DIR
echo "Working directory for jailman.sh is: ${SCRIPT_DIR}" echo "Working directory for jailman.sh is: ${SCRIPT_DIR}"
#Includes #Includes
source ${SCRIPT_DIR}/global.sh # shellcheck source=global.sh
source "${SCRIPT_DIR}/global.sh"
# Check for root privileges # Check for root privileges
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "This script must be run with root privileges" echo "This script must be run with root privileges"
exit 1 exit 1
fi fi
@ -31,33 +36,44 @@ fi
unset -v sub unset -v sub
while getopts ":i:r:u:d:g:h" opt while getopts ":i:r:u:d:g:h" opt
do do
#Shellcheck on wordsplitting will be disabled. Wordsplitting can't happen, because it's already split using OPTIND.
case $opt in case $opt in
i ) installjails=("$OPTARG") i ) installjails=("$OPTARG")
# shellcheck disable=SC2046
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
# shellcheck disable=SC2207
installjails+=($(eval "echo \${$OPTIND}")) installjails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1)) OPTIND=$((OPTIND + 1))
done done
;; ;;
r ) redojails=("$OPTARG") r ) redojails=("$OPTARG")
# shellcheck disable=SC2046
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
# shellcheck disable=SC2207
redojails+=($(eval "echo \${$OPTIND}")) redojails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1)) OPTIND=$((OPTIND + 1))
done done
;; ;;
u ) updatejails=("$OPTARG") u ) updatejails=("$OPTARG")
# shellcheck disable=SC2046
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
# shellcheck disable=SC2207
updatejails+=($(eval "echo \${$OPTIND}")) updatejails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1)) OPTIND=$((OPTIND + 1))
done done
;; ;;
d ) destroyjails=("$OPTARG") d ) destroyjails=("$OPTARG")
# shellcheck disable=SC2046
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
# shellcheck disable=SC2207
destroyjails+=($(eval "echo \${$OPTIND}")) destroyjails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1)) OPTIND=$((OPTIND + 1))
done done
;; ;;
g ) upgradejails=("$OPTARG") g ) upgradejails=("$OPTARG")
# shellcheck disable=SC2046
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
# shellcheck disable=SC2207
upgradejails+=($(eval "echo \${$OPTIND}")) upgradejails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1)) OPTIND=$((OPTIND + 1))
done done
@ -88,18 +104,20 @@ global_dataset_iocage=$(zfs get -H -o value mountpoint $(iocage get -p)/iocage)
global_dataset_iocage=${global_dataset_iocage#/mnt/} global_dataset_iocage=${global_dataset_iocage#/mnt/}
# Parse the Config YAML # Parse the Config YAML
for configpath in ${SCRIPT_DIR}/jails/*/config.yml; do ! eval $(parse_yaml ${configpath}); done # shellcheck disable=SC2046
eval $(parse_yaml config.yml) for configpath in "${SCRIPT_DIR}"/jails/*/config.yml; do ! eval $(parse_yaml "${configpath}"); done
eval "$(parse_yaml config.yml)"
# Check and Execute requested jail destructions # Check and Execute requested jail destructions
if [ ${#destroyjails[@]} -eq 0 ]; then if [ ${#destroyjails[@]} -eq 0 ]; then
echo "No jails to destroy" echo "No jails to destroy"
else else
# shellcheck disable=SC2124,SC2145
echo "jails to destroy ${destroyjails[@]}" echo "jails to destroy ${destroyjails[@]}"
for jail in "${destroyjails[@]}" for jail in "${destroyjails[@]}"
do do
echo "destroying $jail" echo "destroying $jail"
iocage destroy -f $jail iocage destroy -f "${jail}"
done done
fi fi
@ -108,13 +126,14 @@ fi
if [ ${#installjails[@]} -eq 0 ]; then if [ ${#installjails[@]} -eq 0 ]; then
echo "No jails to install" echo "No jails to install"
else else
# shellcheck disable=SC2124,SC2145
echo "jails to install ${installjails[@]}" echo "jails to install ${installjails[@]}"
for jail in "${installjails[@]}" for jail in "${installjails[@]}"
do do
if [ -f "${SCRIPT_DIR}/jails/$jail/install.sh" ] if [ -f "${SCRIPT_DIR}/jails/$jail/install.sh" ]
then then
echo "Installing $jail" echo "Installing $jail"
jailcreate $jail && ${SCRIPT_DIR}/jails/$jail/install.sh jailcreate "${jail}" && "${SCRIPT_DIR}"/jails/"${jail}"/install.sh
else else
echo "Missing install script for $jail in ${SCRIPT_DIR}/jails/$jail/install.sh" echo "Missing install script for $jail in ${SCRIPT_DIR}/jails/$jail/install.sh"
fi fi
@ -125,13 +144,14 @@ fi
if [ ${#redojails[@]} -eq 0 ]; then if [ ${#redojails[@]} -eq 0 ]; then
echo "No jails to ReInstall" echo "No jails to ReInstall"
else else
# shellcheck disable=SC2124,SC2145
echo "jails to reinstall ${redojails[@]}" echo "jails to reinstall ${redojails[@]}"
for jail in "${redojails[@]}" for jail in "${redojails[@]}"
do do
if [ -f "${SCRIPT_DIR}/jails/$jail/install.sh" ] if [ -f "${SCRIPT_DIR}/jails/$jail/install.sh" ]
then then
echo "Reinstalling $jail" echo "Reinstalling $jail"
iocage destroy -f $jail && jailcreate $jail && ${SCRIPT_DIR}/jails/$jail/install.sh iocage destroy -f "${jail}" && jailcreate "${jail}" && "${SCRIPT_DIR}"/jails/"${jail}"/install.sh
else else
echo "Missing install script for $jail in ${SCRIPT_DIR}/jails/$jail/update.sh" echo "Missing install script for $jail in ${SCRIPT_DIR}/jails/$jail/update.sh"
fi fi
@ -143,16 +163,17 @@ fi
if [ ${#updatejails[@]} -eq 0 ]; then if [ ${#updatejails[@]} -eq 0 ]; then
echo "No jails to Update" echo "No jails to Update"
else else
# shellcheck disable=SC2124,SC2145
echo "jails to update ${updatejails[@]}" echo "jails to update ${updatejails[@]}"
for jail in "${updatejails[@]}" for jail in "${updatejails[@]}"
do do
if [ -f "${SCRIPT_DIR}/jails/$jail/update.sh" ] if [ -f "${SCRIPT_DIR}/jails/$jail/update.sh" ]
then then
echo "Updating $jail" echo "Updating $jail"
iocage update $jail iocage update "${jail}"
iocage exec $jail "pkg update && pkg upgrade -y" && ${SCRIPT_DIR}/jails/$jail/update.sh iocage exec "${jail}" "pkg update && pkg upgrade -y" && "${SCRIPT_DIR}"/jails/"${jail}"/update.sh
iocage restart $jail iocage restart "${jail}"
iocage start $jail iocage start "${jail}"
else else
echo "Missing update script for $jail in ${SCRIPT_DIR}/jails/$jail/update.sh" echo "Missing update script for $jail in ${SCRIPT_DIR}/jails/$jail/update.sh"
fi fi
@ -163,6 +184,7 @@ fi
if [ ${#upgradejails[@]} -eq 0 ]; then if [ ${#upgradejails[@]} -eq 0 ]; then
echo "No jails to Upgrade" echo "No jails to Upgrade"
else else
# shellcheck disable=SC2124,SC2145
echo "jails to update ${upgradejails[@]}" echo "jails to update ${upgradejails[@]}"
for jail in "${upgradejails[@]}" for jail in "${upgradejails[@]}"
do do

View File

@ -5,10 +5,14 @@
JAIL_NAME="bitwarden" JAIL_NAME="bitwarden"
DB_DATABASE=${JAIL_NAME} DB_DATABASE=${JAIL_NAME}
DB_USER=${JAIL_NAME} DB_USER=${JAIL_NAME}
# shellcheck disable=SC2154
INSTALL_TYPE=${bitwarden_type} INSTALL_TYPE=${bitwarden_type}
DB_HOST="$(sed 's|\(.*\)/.*|\1|' <<<"${mariadb_ip4_addr}"):3306" # shellcheck disable=SC2154
DB_HOST="${mariadb_ip4_addr%/*}:3306"
# shellcheck disable=SC2154
DB_PASSWORD="${bitwarden_db_password}" DB_PASSWORD="${bitwarden_db_password}"
DB_STRING="mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_DATABASE}" DB_STRING="mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_DATABASE}"
# shellcheck disable=SC2154
ADMIN_TOKEN=${bitwarden_admin_token} ADMIN_TOKEN=${bitwarden_admin_token}
if [ -z "${ADMIN_TOKEN}" ]; then if [ -z "${ADMIN_TOKEN}" ]; then
@ -36,12 +40,13 @@ fi
iocage exec ${JAIL_NAME} cp -r /usr/local/share/bitwarden/src/target/release /usr/local/share/bitwarden/bin iocage exec ${JAIL_NAME} cp -r /usr/local/share/bitwarden/src/target/release /usr/local/share/bitwarden/bin
# Download and install webvault # Download and install webvault
WEB_RELEASE_URL=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/dani-garcia/bw_web_builds/releases/latest) WEB_RELEASE_URL=$(curl -Ls -o /dev/null -w "%{url_effective}" https://github.com/dani-garcia/bw_web_builds/releases/latest)
WEB_TAG="${WEB_RELEASE_URL##*/}" WEB_TAG="${WEB_RELEASE_URL##*/}"
iocage exec ${JAIL_NAME} "fetch http://github.com/dani-garcia/bw_web_builds/releases/download/$WEB_TAG/bw_web_$WEB_TAG.tar.gz -o /usr/local/share/bitwarden" iocage exec ${JAIL_NAME} "fetch http://github.com/dani-garcia/bw_web_builds/releases/download/$WEB_TAG/bw_web_$WEB_TAG.tar.gz -o /usr/local/share/bitwarden"
iocage exec ${JAIL_NAME} "tar -xzvf /usr/local/share/bitwarden/bw_web_$WEB_TAG.tar.gz -C /usr/local/share/bitwarden/" iocage exec ${JAIL_NAME} "tar -xzvf /usr/local/share/bitwarden/bw_web_$WEB_TAG.tar.gz -C /usr/local/share/bitwarden/"
iocage exec ${JAIL_NAME} rm /usr/local/share/bitwarden/bw_web_$WEB_TAG.tar.gz iocage exec ${JAIL_NAME} rm /usr/local/share/bitwarden/bw_web_"$WEB_TAG".tar.gz
# shellcheck disable=SC2154
if [ -f "/mnt/${global_dataset_config}/${JAIL_NAME}/ssl/bitwarden-ssl.crt" ]; then if [ -f "/mnt/${global_dataset_config}/${JAIL_NAME}/ssl/bitwarden-ssl.crt" ]; then
echo "certificate exist... Skipping cert generation" echo "certificate exist... Skipping cert generation"
else else
@ -50,7 +55,7 @@ else
echo "cert folder not existing... creating..." echo "cert folder not existing... creating..."
iocage exec ${JAIL_NAME} mkdir /config/ssl iocage exec ${JAIL_NAME} mkdir /config/ssl
fi fi
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}/${JAIL_NAME}/ssl/bitwarden-ssl.key -out /mnt/${global_dataset_config}/${JAIL_NAME}/ssl/bitwarden-ssl.crt 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}"/${JAIL_NAME}/ssl/bitwarden-ssl.key -out /mnt/"${global_dataset_config}"/${JAIL_NAME}/ssl/bitwarden-ssl.crt
fi fi
if [ -f "/mnt/${global_dataset_config}/${JAIL_NAME}/bitwarden.log" ]; then if [ -f "/mnt/${global_dataset_config}/${JAIL_NAME}/bitwarden.log" ]; then
@ -67,10 +72,11 @@ fi
iocage exec ${JAIL_NAME} "pw user add bitwarden -c bitwarden -u 725 -d /nonexistent -s /usr/bin/nologin" iocage exec ${JAIL_NAME} "pw user add bitwarden -c bitwarden -u 725 -d /nonexistent -s /usr/bin/nologin"
iocage exec ${JAIL_NAME} chown -R bitwarden:bitwarden /usr/local/share/bitwarden /config iocage exec ${JAIL_NAME} chown -R bitwarden:bitwarden /usr/local/share/bitwarden /config
iocage exec ${JAIL_NAME} mkdir /usr/local/etc/rc.d /usr/local/etc/rc.conf.d iocage exec ${JAIL_NAME} mkdir /usr/local/etc/rc.d /usr/local/etc/rc.conf.d
cp ${SCRIPT_DIR}/jails/${JAIL_NAME}/includes/bitwarden.rc /mnt/${global_dataset_iocage}/jails/${JAIL_NAME}/root/usr/local/etc/rc.d/bitwarden # shellcheck disable=SC2154
cp ${SCRIPT_DIR}/jails/${JAIL_NAME}/includes/bitwarden.rc.conf /mnt/${global_dataset_iocage}/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden cp "${SCRIPT_DIR}"/jails/${JAIL_NAME}/includes/bitwarden.rc /mnt/"${global_dataset_iocage}"/jails/${JAIL_NAME}/root/usr/local/etc/rc.d/bitwarden
echo 'export DATABASE_URL="'${DB_STRING}'"' >> /mnt/${global_dataset_iocage}/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden cp "${SCRIPT_DIR}"/jails/${JAIL_NAME}/includes/bitwarden.rc.conf /mnt/"${global_dataset_iocage}"/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden
echo 'export ADMIN_TOKEN="'${ADMIN_TOKEN}'"' >> /mnt/${global_dataset_iocage}/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden echo 'export DATABASE_URL="'"${DB_STRING}"'"' >> /mnt/"${global_dataset_iocage}"/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden
echo 'export ADMIN_TOKEN="'"${ADMIN_TOKEN}"'"' >> /mnt/"${global_dataset_iocage}"/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden
if [ "${ADMIN_TOKEN}" == "NONE" ]; then if [ "${ADMIN_TOKEN}" == "NONE" ]; then
echo "Admin_token set to NONE, disabling admin portal" echo "Admin_token set to NONE, disabling admin portal"

View File

@ -7,10 +7,14 @@
JAIL_NAME="bitwarden" JAIL_NAME="bitwarden"
DB_DATABASE=${JAIL_NAME} DB_DATABASE=${JAIL_NAME}
DB_USER=${JAIL_NAME} DB_USER=${JAIL_NAME}
# shellcheck disable=SC2154
INSTALL_TYPE=${bitwarden_type} INSTALL_TYPE=${bitwarden_type}
DB_HOST="$(sed 's|\(.*\)/.*|\1|' <<<"${mariadb_ip4_addr}"):3306" # shellcheck disable=SC2154
DB_HOST="${mariadb_ip4_addr%/*}:3306"
# shellcheck disable=SC2154
DB_PASSWORD="${bitwarden_db_password}" DB_PASSWORD="${bitwarden_db_password}"
DB_STRING="mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_DATABASE}" DB_STRING="mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_DATABASE}"
# shellcheck disable=SC2154
ADMIN_TOKEN=${bitwarden_admin_token} ADMIN_TOKEN=${bitwarden_admin_token}
if [ -z "${ADMIN_TOKEN}" ]; then if [ -z "${ADMIN_TOKEN}" ]; then
@ -39,17 +43,18 @@ fi
iocage exec ${JAIL_NAME} cp -r /usr/local/share/bitwarden/src/target/release /usr/local/share/bitwarden/bin iocage exec ${JAIL_NAME} cp -r /usr/local/share/bitwarden/src/target/release /usr/local/share/bitwarden/bin
# Download and install webvault # Download and install webvault
WEB_RELEASE_URL=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/dani-garcia/bw_web_builds/releases/latest) WEB_RELEASE_URL=$(curl -Ls -o /dev/null -w "%{url_effective}" https://github.com/dani-garcia/bw_web_builds/releases/latest)
WEB_TAG="${WEB_RELEASE_URL##*/}" WEB_TAG="${WEB_RELEASE_URL##*/}"
iocage exec ${JAIL_NAME} "fetch http://github.com/dani-garcia/bw_web_builds/releases/download/$WEB_TAG/bw_web_$WEB_TAG.tar.gz -o /usr/local/share/bitwarden" iocage exec ${JAIL_NAME} "fetch http://github.com/dani-garcia/bw_web_builds/releases/download/$WEB_TAG/bw_web_$WEB_TAG.tar.gz -o /usr/local/share/bitwarden"
iocage exec ${JAIL_NAME} "tar -xzvf /usr/local/share/bitwarden/bw_web_$WEB_TAG.tar.gz -C /usr/local/share/bitwarden/" iocage exec ${JAIL_NAME} "tar -xzvf /usr/local/share/bitwarden/bw_web_$WEB_TAG.tar.gz -C /usr/local/share/bitwarden/"
iocage exec ${JAIL_NAME} rm /usr/local/share/bitwarden/bw_web_$WEB_TAG.tar.gz iocage exec ${JAIL_NAME} rm /usr/local/share/bitwarden/bw_web_"$WEB_TAG".tar.gz
iocage exec ${JAIL_NAME} chown -R bitwarden:bitwarden /usr/local/share/bitwarden /config iocage exec ${JAIL_NAME} chown -R bitwarden:bitwarden /usr/local/share/bitwarden /config
cp ${SCRIPT_DIR}/jails/${JAIL_NAME}/includes/bitwarden.rc /mnt/${global_dataset_iocage}/jails/${JAIL_NAME}/root/usr/local/etc/rc.d/bitwarden # shellcheck disable=SC2154
cp ${SCRIPT_DIR}/jails/${JAIL_NAME}/includes/bitwarden.rc.conf /mnt/${global_dataset_iocage}/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden cp "${SCRIPT_DIR}"/jails/${JAIL_NAME}/includes/bitwarden.rc /mnt/"${global_dataset_iocage}"/jails/${JAIL_NAME}/root/usr/local/etc/rc.d/bitwarden
echo 'export DATABASE_URL="'${DB_STRING}'"' >> /mnt/${global_dataset_iocage}/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden cp "${SCRIPT_DIR}"/jails/${JAIL_NAME}/includes/bitwarden.rc.conf /mnt/"${global_dataset_iocage}"/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden
echo 'export ADMIN_TOKEN="'${ADMIN_TOKEN}'"' >> /mnt/${global_dataset_iocage}/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden echo 'export DATABASE_URL="'"${DB_STRING}"'"' >> /mnt/"${global_dataset_iocage}"/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden
echo 'export ADMIN_TOKEN="'"${ADMIN_TOKEN}"'"' >> /mnt/"${global_dataset_iocage}"/jails/${JAIL_NAME}/root/usr/local/etc/rc.conf.d/bitwarden
if [ "${ADMIN_TOKEN}" == "NONE" ]; then if [ "${ADMIN_TOKEN}" == "NONE" ]; then
echo "Admin_token set to NONE, disabling admin portal" echo "Admin_token set to NONE, disabling admin portal"

View File

@ -9,11 +9,14 @@
# Initialise variables # Initialise variables
JAIL_NAME="influxdb" JAIL_NAME="influxdb"
JAIL_IP="$(sed 's|\(.*\)/.*|\1|' <<<"${influxdb_ip4_addr}" )" # shellcheck disable=SC2154
JAIL_IP="${influxdb_ip4_addr%/*}"
INCLUDES_PATH="${SCRIPT_DIR}/jails/influxdb/includes" INCLUDES_PATH="${SCRIPT_DIR}/jails/influxdb/includes"
DATABASE=${influxdb_database} # shellcheck disable=SC2154
DATABASE="${influxdb_database}"
# Mount and configure proper configuration location # Mount and configure proper configuration location
# shellcheck disable=SC2154
cp -rf "${INCLUDES_PATH}/influxd.conf" "/mnt/${global_dataset_config}/${JAIL_NAME}/influxd.conf" cp -rf "${INCLUDES_PATH}/influxd.conf" "/mnt/${global_dataset_config}/${JAIL_NAME}/influxd.conf"
iocage exec "${JAIL_NAME}" mkdir -p /config/db/data /config/db/meta /config/db/wal iocage exec "${JAIL_NAME}" mkdir -p /config/db/data /config/db/meta /config/db/wal
iocage exec "${JAIL_NAME}" chown -R influxd:influxd /config/db iocage exec "${JAIL_NAME}" chown -R influxd:influxd /config/db

View File

@ -7,7 +7,8 @@ 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 "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 chown -R jackett:jackett /usr/local/share/Jackett /config
iocage exec jackett mkdir /usr/local/etc/rc.d iocage exec jackett mkdir /usr/local/etc/rc.d
cp ${SCRIPT_DIR}/jails/jackett/includes/jackett.rc /mnt/${global_dataset_iocage}/jails/jackett/root/usr/local/etc/rc.d/jackett # shellcheck disable=SC2154
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 chmod u+x /usr/local/etc/rc.d/jackett
iocage exec jackett sysrc "jackett_enable=YES" iocage exec jackett sysrc "jackett_enable=YES"
iocage exec jackett service jackett restart iocage exec jackett service jackett restart

View File

@ -4,6 +4,7 @@
iocage exec jackett service jackett stop iocage exec jackett service jackett stop
#TODO insert code to update jacket itself here #TODO insert code to update jacket itself here
iocage exec jackett chown -R jackett:jackett /usr/local/share/Jackett /config 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 # shellcheck disable=SC2154
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 chmod u+x /usr/local/etc/rc.d/jackett
iocage exec jackett service jackett restart iocage exec jackett service jackett restart

View File

@ -6,7 +6,8 @@ iocage exec kms svn checkout https://github.com/SystemRage/py-kms/trunk/py-kms /
iocage exec kms "pw user add kms -c kms -u 666 -d /nonexistent -s /usr/bin/nologin" 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 chown -R kms:kms /usr/local/share/py-kms /config
iocage exec kms mkdir /usr/local/etc/rc.d 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 # shellcheck disable=SC2154
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 chmod u+x /usr/local/etc/rc.d/py_kms
iocage exec kms sysrc "py_kms_enable=YES" iocage exec kms sysrc "py_kms_enable=YES"
iocage exec kms service py_kms start iocage exec kms service py_kms start

View File

@ -4,6 +4,7 @@
iocage exec kms service py_kms stop 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 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 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 # shellcheck disable=SC2154
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 chmod u+x /usr/local/etc/rc.d/py_kms
iocage exec kms service py_kms start iocage exec kms service py_kms start

View File

@ -2,12 +2,14 @@
# This file contains the install script for lidarr # This file contains the install script for lidarr
# Check if dataset for completed download and it parent dataset exist, create if they do not. # Check if dataset for completed download and it parent dataset exist, create if they do not.
createmount lidarr ${global_dataset_downloads} # shellcheck disable=SC2154
createmount lidarr ${global_dataset_downloads}/complete /mnt/fetched createmount lidarr "${global_dataset_downloads}"
createmount lidarr "${global_dataset_downloads}"/complete /mnt/fetched
# Check if dataset for media library and the dataset for movies exist, create if they do not. # Check if dataset for media library and the dataset for movies exist, create if they do not.
createmount lidarr ${global_dataset_media} # shellcheck disable=SC2154
createmount lidarr ${global_dataset_media}/music /mnt/music createmount lidarr "${global_dataset_media}"
createmount lidarr "${global_dataset_media}"/music /mnt/music
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 "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"
@ -16,7 +18,8 @@ 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 "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 chown -R lidarr:lidarr /usr/local/share/Lidarr /config
iocage exec lidarr mkdir /usr/local/etc/rc.d 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 # shellcheck disable=SC2154
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 chmod u+x /usr/local/etc/rc.d/lidarr
iocage exec lidarr sysrc "lidarr_enable=YES" iocage exec lidarr sysrc "lidarr_enable=YES"
iocage exec lidarr service lidarr start iocage exec lidarr service lidarr start

View File

@ -4,6 +4,7 @@
iocage exec lidarr service lidarr stop iocage exec lidarr service lidarr stop
#TODO insert code to update lidarr itself here #TODO insert code to update lidarr itself here
iocage exec lidarr chown -R lidarr:lidarr /usr/local/share/lidarr /config 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 # shellcheck disable=SC2154
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 chmod u+x /usr/local/etc/rc.d/lidarr
iocage exec lidarr service lidarr restart iocage exec lidarr service lidarr restart

View File

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
# shellcheck disable=1091,2223,2154,2034
# #
# PROVIDE: caddy # PROVIDE: caddy
# REQUIRE: networking # REQUIRE: networking

View File

@ -8,9 +8,12 @@
# Initialise defaults # Initialise defaults
JAIL_NAME="mariadb" JAIL_NAME="mariadb"
JAIL_IP="$(sed 's|\(.*\)/.*|\1|' <<<"${mariadb_ip4_addr}" )" # shellcheck disable=SC2154
JAIL_IP="${mariadb_ip4_addr%/*}"
INCLUDES_PATH="${SCRIPT_DIR}/jails/mariadb/includes" INCLUDES_PATH="${SCRIPT_DIR}/jails/mariadb/includes"
# shellcheck disable=SC2154
CERT_EMAIL=${mariadb_cert_email} CERT_EMAIL=${mariadb_cert_email}
# shellcheck disable=SC2154
DB_ROOT_PASSWORD=${mariadb_db_root_password} DB_ROOT_PASSWORD=${mariadb_db_root_password}
DB_NAME="MariaDB" DB_NAME="MariaDB"
DL_FLAGS="" DL_FLAGS=""
@ -23,16 +26,16 @@ if [ -z "${mariadb_ip4_addr}" ]; then
fi fi
# Make sure DB_PATH is empty -- if not, MariaDB/PostgreSQL will choke # Make sure DB_PATH is empty -- if not, MariaDB/PostgreSQL will choke
# shellcheck disable=SC2154
if [ "$(ls -A "/mnt/${global_dataset_config}/${JAIL_NAME}/db")" ]; then if [ "$(ls -A "/mnt/${global_dataset_config}/${JAIL_NAME}/db")" ]; then
echo "Reinstall of mariadb detected... Continuing" echo "Reinstall of mariadb detected... Continuing"
REINSTALL="true" REINSTALL="true"
fi fi
# Mount database dataset and set zfs preferences # Mount database dataset and set zfs preferences
createmount ${JAIL_NAME} ${global_dataset_config}/${JAIL_NAME}/db /var/db/mysql createmount ${JAIL_NAME} "${global_dataset_config}"/${JAIL_NAME}/db /var/db/mysql
zfs set recordsize=16K ${global_dataset_config}/${JAIL_NAME}/db zfs set recordsize=16K "${global_dataset_config}"/${JAIL_NAME}/db
zfs set primarycache=metadata ${global_dataset_config}/${JAIL_NAME}/db zfs set primarycache=metadata "${global_dataset_config}"/${JAIL_NAME}/db
iocage exec "${JAIL_NAME}" chown -R 88:88 /var/db/mysql iocage exec "${JAIL_NAME}" chown -R 88:88 /var/db/mysql
@ -62,6 +65,7 @@ iocage exec "${JAIL_NAME}" sysrc mysql_enable="YES"
echo "Copying Caddyfile for no SSL" echo "Copying Caddyfile for no SSL"
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/caddy /usr/local/etc/rc.d/ iocage exec "${JAIL_NAME}" cp -f /mnt/includes/caddy /usr/local/etc/rc.d/
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile /usr/local/www/Caddyfile iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile /usr/local/www/Caddyfile
# shellcheck disable=SC2154
iocage exec "${JAIL_NAME}" sed -i '' "s/yourhostnamehere/${mariadb_host_name}/" /usr/local/www/Caddyfile iocage exec "${JAIL_NAME}" sed -i '' "s/yourhostnamehere/${mariadb_host_name}/" /usr/local/www/Caddyfile
iocage exec "${JAIL_NAME}" sed -i '' "s/JAIL-IP/${JAIL_IP}/" /usr/local/www/Caddyfile iocage exec "${JAIL_NAME}" sed -i '' "s/JAIL-IP/${JAIL_IP}/" /usr/local/www/Caddyfile

View File

@ -2,7 +2,8 @@
# This file contains the update script for mariadb # This file contains the update script for mariadb
JAIL_NAME="mariadb" JAIL_NAME="mariadb"
JAIL_IP="$(sed 's|\(.*\)/.*|\1|' <<<"${mariadb_ip4_addr}" )" # shellcheck disable=SC2154
JAIL_IP="${mariadb_ip4_addr%/*}"
INCLUDES_PATH="${SCRIPT_DIR}/jails/mariadb/includes" INCLUDES_PATH="${SCRIPT_DIR}/jails/mariadb/includes"
# Install includes fstab # Install includes fstab
@ -24,6 +25,7 @@ fi
echo "Copying Caddyfile for no SSL" echo "Copying Caddyfile for no SSL"
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/caddy /usr/local/etc/rc.d/ iocage exec "${JAIL_NAME}" cp -f /mnt/includes/caddy /usr/local/etc/rc.d/
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile /usr/local/www/Caddyfile iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile /usr/local/www/Caddyfile
# shellcheck disable=SC2154
iocage exec "${JAIL_NAME}" sed -i '' "s/yourhostnamehere/${mariadb_host_name}/" /usr/local/www/Caddyfile iocage exec "${JAIL_NAME}" sed -i '' "s/yourhostnamehere/${mariadb_host_name}/" /usr/local/www/Caddyfile
iocage exec "${JAIL_NAME}" sed -i '' "s/JAIL-IP/${JAIL_IP}/" /usr/local/www/Caddyfile iocage exec "${JAIL_NAME}" sed -i '' "s/JAIL-IP/${JAIL_IP}/" /usr/local/www/Caddyfile

View File

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
# shellcheck disable=1091,2223,2154,2034
# #
# PROVIDE: caddy # PROVIDE: caddy
# REQUIRE: networking # REQUIRE: networking

View File

@ -5,16 +5,26 @@
# Initialise defaults # Initialise defaults
JAIL_NAME="nextcloud" JAIL_NAME="nextcloud"
JAIL_IP="$(sed 's|\(.*\)/.*|\1|' <<<"${nextcloud_ip4_addr}" )" # shellcheck disable=SC2154
JAIL_IP="${nextcloud_ip4_addr%/*}"
# shellcheck disable=SC2154
DATABASE="$nextcloud_database" DATABASE="$nextcloud_database"
INCLUDES_PATH="${SCRIPT_DIR}/jails/nextcloud/includes" INCLUDES_PATH="${SCRIPT_DIR}/jails/nextcloud/includes"
# shellcheck disable=SC2154
STANDALONE_CERT=${nextcloud_standalone_cert} STANDALONE_CERT=${nextcloud_standalone_cert}
# shellcheck disable=SC2154
SELFSIGNED_CERT=${nextcloud_selfsigned_cert} SELFSIGNED_CERT=${nextcloud_selfsigned_cert}
# shellcheck disable=SC2154
DNS_CERT=${nextcloud_dns_cert} DNS_CERT=${nextcloud_dns_cert}
# shellcheck disable=SC2154
NO_CERT=${nextcloud_no_cert} NO_CERT=${nextcloud_no_cert}
# shellcheck disable=SC2154
DL_FLAGS=${nextcloud_dl_flags} DL_FLAGS=${nextcloud_dl_flags}
# shellcheck disable=SC2154
DNS_SETTING=${nextcloud_dns_settings} DNS_SETTING=${nextcloud_dns_settings}
# shellcheck disable=SC2154
CERT_EMAIL=${nextcloud_cert_email} CERT_EMAIL=${nextcloud_cert_email}
# shellcheck disable=SC2154
HOST_NAME=${nextcloud_host_name} HOST_NAME=${nextcloud_host_name}
# Only generate new DB passwords when using buildin database # Only generate new DB passwords when using buildin database
@ -22,9 +32,13 @@ HOST_NAME=${nextcloud_host_name}
if [ "${DATABASE}" = "pgsql-external" ]; then if [ "${DATABASE}" = "pgsql-external" ]; then
DB_NAME="PostgreSQL" DB_NAME="PostgreSQL"
# shellcheck disable=SC2154
DB_HOST="${nextcloud_db_host}" DB_HOST="${nextcloud_db_host}"
# shellcheck disable=SC2154
DB_DATABASE="${nextcloud_db_database}" DB_DATABASE="${nextcloud_db_database}"
# shellcheck disable=SC2154
DB_USER="${nextcloud_db_user}" DB_USER="${nextcloud_db_user}"
# shellcheck disable=SC2154
DB_PASSWORD="${nextcloud_db_password}" DB_PASSWORD="${nextcloud_db_password}"
elif [ "${DATABASE}" = "mariadb-external" ]; then elif [ "${DATABASE}" = "mariadb-external" ]; then
DB_NAME="MariaDB" DB_NAME="MariaDB"
@ -35,7 +49,8 @@ elif [ "${DATABASE}" = "mariadb-external" ]; then
elif [ "${DATABASE}" = "mariadb-jail" ]; then elif [ "${DATABASE}" = "mariadb-jail" ]; then
DB_DATABASE="nextcloud" DB_DATABASE="nextcloud"
DB_USER="nextcloud" DB_USER="nextcloud"
DB_HOST="$(sed 's|\(.*\)/.*|\1|' <<<"${mariadb_ip4_addr}"):3306" # shellcheck disable=SC2154
DB_HOST="${mariadb_ip4_addr%/*}:3306"
DB_PASSWORD="${nextcloud_db_password}" DB_PASSWORD="${nextcloud_db_password}"
else else
echo "Invalid ${JAIL_NAME}_database selected please select one from the following options:" echo "Invalid ${JAIL_NAME}_database selected please select one from the following options:"
@ -84,6 +99,7 @@ if [ -z "${DB_DATABASE}" ]; then
exit 1 exit 1
fi fi
# shellcheck disable=SC2154
if [ -z "${nextcloud_time_zone}" ]; then if [ -z "${nextcloud_time_zone}" ]; then
echo 'Configuration error: TIME_ZONE must be set' echo 'Configuration error: TIME_ZONE must be set'
exit 1 exit 1
@ -92,35 +108,36 @@ if [ -z "${HOST_NAME}" ]; then
echo 'Configuration error: HOST_NAME must be set' echo 'Configuration error: HOST_NAME must be set'
exit 1 exit 1
fi fi
if [ $STANDALONE_CERT -eq 0 ] && [ $DNS_CERT -eq 0 ] && [ $NO_CERT -eq 0 ] && [ $SELFSIGNED_CERT -eq 0 ]; then if [ "$STANDALONE_CERT" -eq 0 ] && [ "$DNS_CERT" -eq 0 ] && [ "$NO_CERT" -eq 0 ] && [ "$SELFSIGNED_CERT" -eq 0 ]; then
echo 'Configuration error: Either STANDALONE_CERT, DNS_CERT, NO_CERT,' echo 'Configuration error: Either STANDALONE_CERT, DNS_CERT, NO_CERT,'
echo 'or SELFSIGNED_CERT must be set to 1.' echo 'or SELFSIGNED_CERT must be set to 1.'
exit 1 exit 1
fi fi
if [ $STANDALONE_CERT -eq 1 ] && [ $DNS_CERT -eq 1 ] ; then if [ "$STANDALONE_CERT" -eq 1 ] && [ "$DNS_CERT" -eq 1 ] ; then
echo 'Configuration error: Only one of STANDALONE_CERT and DNS_CERT' echo 'Configuration error: Only one of STANDALONE_CERT and DNS_CERT'
echo 'may be set to 1.' echo 'may be set to 1.'
exit 1 exit 1
fi fi
if [ $DNS_CERT -eq 1 ] && [ -z "${DNS_PLUGIN}" ] ; then if [ "$DNS_CERT" -eq 1 ] && [ -z "${DNS_PLUGIN}" ] ; then
echo "DNS_PLUGIN must be set to a supported DNS provider." echo "DNS_PLUGIN must be set to a supported DNS provider."
echo "See https://caddyserver.com/docs under the heading of \"DNS Providers\" for list." echo "See https://caddyserver.com/docs under the heading of \"DNS Providers\" for list."
echo "Be sure to omit the prefix of \"tls.dns.\"." echo "Be sure to omit the prefix of \"tls.dns.\"."
exit 1 exit 1
fi fi
if [ $DNS_CERT -eq 1 ] && [ -z "${DNS_ENV}" ] ; then if [ "$DNS_CERT" -eq 1 ] && [ -z "${DNS_ENV}" ] ; then
echo "DNS_ENV must be set to a your DNS provider\'s authentication credentials." echo "DNS_ENV must be set to a your DNS provider\'s authentication credentials."
echo "See https://caddyserver.com/docs under the heading of \"DNS Providers\" for more." echo "See https://caddyserver.com/docs under the heading of \"DNS Providers\" for more."
exit 1 exit 1
fi fi
if [ $DNS_CERT -eq 1 ] ; then if [ "$DNS_CERT" -eq 1 ] ; then
DL_FLAGS="tls.dns.${DNS_PLUGIN}" DL_FLAGS="tls.dns.${DNS_PLUGIN}"
DNS_SETTING="dns ${DNS_PLUGIN}" DNS_SETTING="dns ${DNS_PLUGIN}"
fi fi
# Make sure DB_PATH is empty -- if not, MariaDB/PostgreSQL will choke # Make sure DB_PATH is empty -- if not, MariaDB/PostgreSQL will choke
# shellcheck disable=SC2154
if [ "$(ls -A "/mnt/${global_dataset_config}/${JAIL_NAME}/config")" ]; then if [ "$(ls -A "/mnt/${global_dataset_config}/${JAIL_NAME}/config")" ]; then
echo "Reinstall of Nextcloud detected... " echo "Reinstall of Nextcloud detected... "
echo "External database selected, unable to verify compatibility. REINSTALL MIGHT NOT WORK... Continuing" echo "External database selected, unable to verify compatibility. REINSTALL MIGHT NOT WORK... Continuing"
@ -135,9 +152,9 @@ fi
##### #####
# Create and Mount Nextcloud, Config and Files # Create and Mount Nextcloud, Config and Files
createmount ${JAIL_NAME} ${global_dataset_config}/${JAIL_NAME}/config /usr/local/www/nextcloud/config createmount ${JAIL_NAME} "${global_dataset_config}"/${JAIL_NAME}/config /usr/local/www/nextcloud/config
createmount ${JAIL_NAME} ${global_dataset_config}/${JAIL_NAME}/themes /usr/local/www/nextcloud/themes createmount ${JAIL_NAME} "${global_dataset_config}"/${JAIL_NAME}/themes /usr/local/www/nextcloud/themes
createmount ${JAIL_NAME} ${global_dataset_config}/${JAIL_NAME}/files /config/files createmount ${JAIL_NAME} "${global_dataset_config}"/${JAIL_NAME}/files /config/files
# Install includes fstab # Install includes fstab
iocage exec "${JAIL_NAME}" mkdir -p /mnt/includes iocage exec "${JAIL_NAME}" mkdir -p /mnt/includes
@ -197,7 +214,7 @@ iocage exec "${JAIL_NAME}" chown -R www:www /usr/local/www/nextcloud/
# Generate and install self-signed cert, if necessary # Generate and install self-signed cert, if necessary
if [ $SELFSIGNED_CERT -eq 1 ] && [ ! -f "/mnt/${global_dataset_config}/${JAIL_NAME}/ssl/privkey.pem" ]; then if [ "$SELFSIGNED_CERT" -eq 1 ] && [ ! -f "/mnt/${global_dataset_config}/${JAIL_NAME}/ssl/privkey.pem" ]; then
echo "No ssl certificate present, generating self signed certificate" echo "No ssl certificate present, generating self signed certificate"
if [ ! -d "/mnt/${global_dataset_config}/${JAIL_NAME}/ssl" ]; then if [ ! -d "/mnt/${global_dataset_config}/${JAIL_NAME}/ssl" ]; then
echo "cert folder not existing... creating..." echo "cert folder not existing... creating..."
@ -212,13 +229,13 @@ fi
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/php.ini /usr/local/etc/php.ini iocage exec "${JAIL_NAME}" cp -f /mnt/includes/php.ini /usr/local/etc/php.ini
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/redis.conf /usr/local/etc/redis.conf iocage exec "${JAIL_NAME}" cp -f /mnt/includes/redis.conf /usr/local/etc/redis.conf
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/www.conf /usr/local/etc/php-fpm.d/ iocage exec "${JAIL_NAME}" cp -f /mnt/includes/www.conf /usr/local/etc/php-fpm.d/
if [ $STANDALONE_CERT -eq 1 ] || [ $DNS_CERT -eq 1 ]; then if [ "$STANDALONE_CERT" -eq 1 ] || [ "$DNS_CERT" -eq 1 ]; then
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/remove-staging.sh /root/ iocage exec "${JAIL_NAME}" cp -f /mnt/includes/remove-staging.sh /root/
fi fi
if [ $NO_CERT -eq 1 ]; then if [ "$NO_CERT" -eq 1 ]; then
echo "Copying Caddyfile for no SSL" echo "Copying Caddyfile for no SSL"
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile-nossl /usr/local/www/Caddyfile iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile-nossl /usr/local/www/Caddyfile
elif [ $SELFSIGNED_CERT -eq 1 ]; then elif [ "$SELFSIGNED_CERT" -eq 1 ]; then
echo "Copying Caddyfile for self-signed cert" echo "Copying Caddyfile for self-signed cert"
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile-selfsigned /usr/local/www/Caddyfile iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile-selfsigned /usr/local/www/Caddyfile
else else
@ -277,7 +294,7 @@ else
iocage exec "${JAIL_NAME}" su -m www -c 'php /usr/local/www/nextcloud/occ config:system:set memcache.locking --value="\OC\Memcache\Redis"' iocage exec "${JAIL_NAME}" su -m www -c 'php /usr/local/www/nextcloud/occ config:system:set memcache.locking --value="\OC\Memcache\Redis"'
iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwritehost --value=\"${HOST_NAME}\"" iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwritehost --value=\"${HOST_NAME}\""
iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwriteprotocol --value=\"https\"" iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwriteprotocol --value=\"https\""
if [ $NO_CERT -eq 1 ]; then if [ "$NO_CERT" -eq 1 ]; then
iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwrite.cli.url --value=\"http://${HOST_NAME}/\"" iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwrite.cli.url --value=\"http://${HOST_NAME}/\""
else else
iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwrite.cli.url --value=\"https://${HOST_NAME}/\"" iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwrite.cli.url --value=\"https://${HOST_NAME}/\""
@ -303,7 +320,7 @@ iocage fstab -r "${JAIL_NAME}" "${INCLUDES_PATH}" /mnt/includes nullfs rw 0 0
# Done! # Done!
echo "Installation complete!" echo "Installation complete!"
if [ $NO_CERT -eq 1 ]; then if [ "$NO_CERT" -eq 1 ]; then
echo "Using your web browser, go to http://${HOST_NAME} to log in" echo "Using your web browser, go to http://${HOST_NAME} to log in"
else else
echo "Using your web browser, go to https://${HOST_NAME} to log in" echo "Using your web browser, go to https://${HOST_NAME} to log in"
@ -325,14 +342,14 @@ else
fi fi
echo "" echo ""
if [ $STANDALONE_CERT -eq 1 ] || [ $DNS_CERT -eq 1 ]; then if [ "$STANDALONE_CERT" -eq 1 ] || [ "$DNS_CERT" -eq 1 ]; then
echo "You have obtained your Let's Encrypt certificate using the staging server." echo "You have obtained your Let's Encrypt certificate using the staging server."
echo "This certificate will not be trusted by your browser and will cause SSL errors" echo "This certificate will not be trusted by your browser and will cause SSL errors"
echo "when you connect. Once you've verified that everything else is working" echo "when you connect. Once you've verified that everything else is working"
echo "correctly, you should issue a trusted certificate. To do this, run:" echo "correctly, you should issue a trusted certificate. To do this, run:"
echo " iocage exec ${JAIL_NAME} /root/remove-staging.sh" echo " iocage exec ${JAIL_NAME} /root/remove-staging.sh"
echo "" echo ""
elif [ $SELFSIGNED_CERT -eq 1 ]; then elif [ "$SELFSIGNED_CERT" -eq 1 ]; then
echo "You have chosen to create a self-signed TLS certificate for your Nextcloud" echo "You have chosen to create a self-signed TLS certificate for your Nextcloud"
echo "installation. This certificate will not be trusted by your browser and" echo "installation. This certificate will not be trusted by your browser and"
echo "will cause SSL errors when you connect. If you wish to replace this certificate" echo "will cause SSL errors when you connect. If you wish to replace this certificate"

View File

@ -8,10 +8,11 @@ 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 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?;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 iocage exec organizr sed -i '' -e 's?;cgi.fix_pathinfo=1?cgi.fix_pathinfo=0?g' /usr/local/etc/php.ini
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 # shellcheck disable=SC2154
cp ${SCRIPT_DIR}/jails/organizr/includes/nginx.conf /mnt/${global_dataset_iocage}/jails/organizr/root/usr/local/etc/nginx/nginx.conf 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 -Rf ${SCRIPT_DIR}/jails/organizr/includes/custom /mnt/${global_dataset_iocage}/jails/organizr/root/usr/local/etc/nginx/custom 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
# shellcheck disable=SC2154
if [ ! -d "/mnt/${global_dataset_config}/organizr/ssl" ]; then if [ ! -d "/mnt/${global_dataset_config}/organizr/ssl" ]; then
echo "cert folder doesn't exist... creating..." echo "cert folder doesn't exist... creating..."
iocage exec organizr mkdir /config/ssl iocage exec organizr mkdir /config/ssl
@ -21,7 +22,7 @@ if [ -f "/mnt/${global_dataset_config}/organizr/ssl/Organizr-Cert.crt" ]; then
echo "certificate exists... Skipping cert generation" echo "certificate exists... Skipping cert generation"
else else
echo "No ssl certificate present, generating self signed certificate" echo "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/ssl/Organizr-Cert.key -out /mnt/${global_dataset_config}/organizr/ssl/Organizr-Cert.crt 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/ssl/Organizr-Cert.key -out /mnt/"${global_dataset_config}"/organizr/ssl/Organizr-Cert.crt
fi fi
iocage exec organizr git clone https://github.com/causefx/Organizr.git /usr/local/www/Organizr iocage exec organizr git clone https://github.com/causefx/Organizr.git /usr/local/www/Organizr

View File

@ -1,11 +1,11 @@
#!/usr/local/bin/bash #!/usr/local/bin/bash
# This file contains the update script for Organizr # This file contains the update script for Organizr
iocage exec organizr service nginx stop iocage exec organizr service nginx stop
iocage exec organizr service php-fpm stop iocage exec organizr service php-fpm stop
# TODO setup cli update for Organizr here. # 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 # shellcheck disable=SC2154
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 "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 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 iocage exec organizr service nginx start

View File

@ -5,20 +5,23 @@ iocage exec plex mkdir -p /usr/local/etc/pkg/repos
# Change to to more frequent FreeBSD repo to stay up-to-date with plex more. # 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 # shellcheck disable=SC2154
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. # Check if datasets for media librarys exist, create them if they do not.
createmount plex ${global_dataset_media} /mnt/media # shellcheck disable=SC2154
createmount plex ${global_dataset_media}/movies /mnt/media/movies createmount plex "${global_dataset_media}" /mnt/media
createmount plex ${global_dataset_media}/music /mnt/media/music createmount plex "${global_dataset_media}"/movies /mnt/media/movies
createmount plex ${global_dataset_media}/shows /mnt/media/shows createmount plex "${global_dataset_media}"/music /mnt/media/music
createmount plex "${global_dataset_media}"/shows /mnt/media/shows
# Create plex ramdisk if specified # Create plex ramdisk if specified
# shellcheck disable=SC2154
if [ -z "${plex_ramdisk}" ]; then if [ -z "${plex_ramdisk}" ]; then
echo "no ramdisk specified for plex, continuing without randisk" echo "no ramdisk specified for plex, continuing without randisk"
else else
iocage fstab -a plex tmpfs /tmp_transcode tmpfs rw,size=${plex_ramdisk},mode=1777 0 0 iocage fstab -a plex tmpfs /tmp_transcode tmpfs rw,size="${plex_ramdisk}",mode=1777 0 0
fi fi
iocage exec plex chown -R plex:plex /config iocage exec plex chown -R plex:plex /config
@ -31,6 +34,7 @@ iocage exec plex pkg upgrade -y
iocage exec plex pw groupmod -n video -m plex iocage exec plex pw groupmod -n video -m plex
# Run different install procedures depending on Plex vs Plex Beta # Run different install procedures depending on Plex vs Plex Beta
# shellcheck disable=SC2154
if [ "$plex_beta" == "true" ]; then if [ "$plex_beta" == "true" ]; then
echo "beta enabled in config.yml... using plex beta for install" echo "beta enabled in config.yml... using plex beta for install"
iocage exec plex sysrc "plexmediaserver_plexpass_enable=YES" iocage exec plex sysrc "plexmediaserver_plexpass_enable=YES"

View File

@ -2,6 +2,7 @@
# This file contains the update script for Plex # This file contains the update script for Plex
# Run different update procedures depending on Plex vs Plex Beta # Run different update procedures depending on Plex vs Plex Beta
# shellcheck disable=SC2154
if [ "$plex_plexpass" == "true" ]; then if [ "$plex_plexpass" == "true" ]; then
echo "beta enabled in config.yml... using plex beta for update..." echo "beta enabled in config.yml... using plex beta for update..."
iocage exec plex service plexmediaserver_plexpass stop iocage exec plex service plexmediaserver_plexpass stop

View File

@ -2,12 +2,14 @@
# This file contains the install script for radarr # This file contains the install script for radarr
# Check if dataset for completed download and it parent dataset exist, create if they do not. # Check if dataset for completed download and it parent dataset exist, create if they do not.
createmount radarr ${global_dataset_downloads} # shellcheck disable=SC2154
createmount radarr ${global_dataset_downloads}/complete /mnt/fetched createmount radarr "${global_dataset_downloads}"
createmount radarr "${global_dataset_downloads}"/complete /mnt/fetched
# Check if dataset for media library and the dataset for movies exist, create if they do not. # Check if dataset for media library and the dataset for movies exist, create if they do not.
createmount radarr ${global_dataset_media} # shellcheck disable=SC2154
createmount radarr ${global_dataset_media}/movies /mnt/movies createmount radarr "${global_dataset_media}"
createmount radarr "${global_dataset_media}"/movies /mnt/movies
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 "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 "tar -xzvf /usr/local/share/Radarr.develop.0.2.0.1480.linux.tar.gz -C /usr/local/share"
@ -15,7 +17,8 @@ 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 "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 chown -R radarr:radarr /usr/local/share/Radarr /config
iocage exec radarr mkdir /usr/local/etc/rc.d 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 # shellcheck disable=SC2154
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 chmod u+x /usr/local/etc/rc.d/radarr
iocage exec radarr sysrc "radarr_enable=YES" iocage exec radarr sysrc "radarr_enable=YES"
iocage exec radarr service radarr restart iocage exec radarr service radarr restart

View File

@ -4,6 +4,7 @@
iocage exec radarr service radarr stop iocage exec radarr service radarr stop
#TODO insert code to update radarr itself here #TODO insert code to update radarr itself here
iocage exec radarr chown -R radarr:radarr /usr/local/share/Radarr /config 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 # shellcheck disable=SC2154
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 chmod u+x /usr/local/etc/rc.d/radarr
iocage exec radarr service radarr restart iocage exec radarr service radarr restart

View File

@ -2,12 +2,14 @@
# This file contains the install script for sonarr # This file contains the install script for sonarr
# Check if dataset for completed download and it parent dataset exist, create if they do not. # Check if dataset for completed download and it parent dataset exist, create if they do not.
createmount sonarr ${global_dataset_downloads} # shellcheck disable=SC2154
createmount sonarr ${global_dataset_downloads}/complete /mnt/fetched createmount sonarr "${global_dataset_downloads}"
createmount sonarr "${global_dataset_downloads}"/complete /mnt/fetched
# Check if dataset for media library and the dataset for tv shows exist, create if they do not. # Check if dataset for media library and the dataset for tv shows exist, create if they do not.
createmount sonarr ${global_dataset_media} # shellcheck disable=SC2154
createmount sonarr ${global_dataset_media}/shows /mnt/shows createmount sonarr "${global_dataset_media}"
createmount sonarr "${global_dataset_media}"/shows /mnt/shows
iocage exec sonarr "fetch http://download.sonarr.tv/v2/master/mono/NzbDrone.master.tar.gz -o /usr/local/share" 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 "tar -xzvf /usr/local/share/NzbDrone.master.tar.gz -C /usr/local/share"
@ -15,7 +17,8 @@ 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 "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 chown -R sonarr:sonarr /usr/local/share/NzbDrone /config
iocage exec sonarr mkdir /usr/local/etc/rc.d 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 # shellcheck disable=SC2154
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 chmod u+x /usr/local/etc/rc.d/sonarr
iocage exec sonarr sysrc "sonarr_enable=YES" iocage exec sonarr sysrc "sonarr_enable=YES"
iocage exec sonarr service sonarr restart iocage exec sonarr service sonarr restart

View File

@ -4,6 +4,7 @@
iocage exec sonarr service sonarr stop iocage exec sonarr service sonarr stop
#TODO insert code to update sonarr itself here #TODO insert code to update sonarr itself here
iocage exec sonarr chown -R sonarr:sonarr /usr/local/share/NzbDrone /config 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 # shellcheck disable=SC2154
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 chmod u+x /usr/local/etc/rc.d/sonarr
iocage exec sonarr service sonarr restart iocage exec sonarr service sonarr restart

View File

@ -2,13 +2,14 @@
# This file contains the install script for transmission # This file contains the install script for transmission
# Check if dataset Downloads dataset exist, create if they do not. # Check if dataset Downloads dataset exist, create if they do not.
createmount transmission ${global_dataset_downloads} /mnt/downloads # shellcheck disable=SC2154
createmount transmission "${global_dataset_downloads}" /mnt/downloads
# Check if dataset Complete Downloads dataset exist, create if they do not. # Check if dataset Complete Downloads dataset exist, create if they do not.
createmount transmission ${global_dataset_downloads}/complete /mnt/downloads/complete createmount transmission "${global_dataset_downloads}"/complete /mnt/downloads/complete
# Check if dataset InComplete Downloads dataset exist, create if they do not. # Check if dataset InComplete Downloads dataset exist, create if they do not.
createmount transmission ${global_dataset_downloads}/incomplete /mnt/downloads/incomplete createmount transmission "${global_dataset_downloads}"/incomplete /mnt/downloads/incomplete
iocage exec transmission chown -R transmission:transmission /config iocage exec transmission chown -R transmission:transmission /config

View File