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

@ -5,10 +5,14 @@
JAIL_NAME="bitwarden"
DB_DATABASE=${JAIL_NAME}
DB_USER=${JAIL_NAME}
# shellcheck disable=SC2154
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_STRING="mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_DATABASE}"
# shellcheck disable=SC2154
ADMIN_TOKEN=${bitwarden_admin_token}
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
# 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##*/}"
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} 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
echo "certificate exist... Skipping cert generation"
else
@ -50,7 +55,7 @@ else
echo "cert folder not existing... creating..."
iocage exec ${JAIL_NAME} mkdir /config/ssl
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
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} 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
cp ${SCRIPT_DIR}/jails/${JAIL_NAME}/includes/bitwarden.rc /mnt/${global_dataset_iocage}/jails/${JAIL_NAME}/root/usr/local/etc/rc.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 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
# shellcheck disable=SC2154
cp "${SCRIPT_DIR}"/jails/${JAIL_NAME}/includes/bitwarden.rc /mnt/"${global_dataset_iocage}"/jails/${JAIL_NAME}/root/usr/local/etc/rc.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 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
echo "Admin_token set to NONE, disabling admin portal"

View File

@ -7,10 +7,14 @@
JAIL_NAME="bitwarden"
DB_DATABASE=${JAIL_NAME}
DB_USER=${JAIL_NAME}
# shellcheck disable=SC2154
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_STRING="mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_DATABASE}"
# shellcheck disable=SC2154
ADMIN_TOKEN=${bitwarden_admin_token}
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
# 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##*/}"
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} 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
cp ${SCRIPT_DIR}/jails/${JAIL_NAME}/includes/bitwarden.rc /mnt/${global_dataset_iocage}/jails/${JAIL_NAME}/root/usr/local/etc/rc.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 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
# shellcheck disable=SC2154
cp "${SCRIPT_DIR}"/jails/${JAIL_NAME}/includes/bitwarden.rc /mnt/"${global_dataset_iocage}"/jails/${JAIL_NAME}/root/usr/local/etc/rc.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 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
echo "Admin_token set to NONE, disabling admin portal"

View File

@ -9,11 +9,14 @@
# Initialise variables
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"
DATABASE=${influxdb_database}
# shellcheck disable=SC2154
DATABASE="${influxdb_database}"
# Mount and configure proper configuration location
# shellcheck disable=SC2154
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}" 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 chown -R jackett:jackett /usr/local/share/Jackett /config
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 sysrc "jackett_enable=YES"
iocage exec jackett service jackett restart

View File

@ -4,6 +4,7 @@
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
# 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 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 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
# 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 sysrc "py_kms_enable=YES"
iocage exec kms service py_kms start

View File

@ -4,6 +4,7 @@
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
# 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 service py_kms start

View File

@ -2,12 +2,14 @@
# This file contains the install script for lidarr
# Check if dataset for completed download and it parent dataset exist, create if they do not.
createmount lidarr ${global_dataset_downloads}
createmount lidarr ${global_dataset_downloads}/complete /mnt/fetched
# shellcheck disable=SC2154
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.
createmount lidarr ${global_dataset_media}
createmount lidarr ${global_dataset_media}/music /mnt/music
# shellcheck disable=SC2154
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"
@ -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 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
# 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 sysrc "lidarr_enable=YES"
iocage exec lidarr service lidarr start

View File

@ -4,6 +4,7 @@
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
# 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 service lidarr restart

View File

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

View File

@ -8,9 +8,12 @@
# Initialise defaults
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"
# shellcheck disable=SC2154
CERT_EMAIL=${mariadb_cert_email}
# shellcheck disable=SC2154
DB_ROOT_PASSWORD=${mariadb_db_root_password}
DB_NAME="MariaDB"
DL_FLAGS=""
@ -23,16 +26,16 @@ if [ -z "${mariadb_ip4_addr}" ]; then
fi
# 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
echo "Reinstall of mariadb detected... Continuing"
REINSTALL="true"
fi
# Mount database dataset and set zfs preferences
createmount ${JAIL_NAME} ${global_dataset_config}/${JAIL_NAME}/db /var/db/mysql
zfs set recordsize=16K ${global_dataset_config}/${JAIL_NAME}/db
zfs set primarycache=metadata ${global_dataset_config}/${JAIL_NAME}/db
createmount ${JAIL_NAME} "${global_dataset_config}"/${JAIL_NAME}/db /var/db/mysql
zfs set recordsize=16K "${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
@ -62,6 +65,7 @@ iocage exec "${JAIL_NAME}" sysrc mysql_enable="YES"
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/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/JAIL-IP/${JAIL_IP}/" /usr/local/www/Caddyfile

View File

@ -2,7 +2,8 @@
# This file contains the update script for 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"
# Install includes fstab
@ -24,6 +25,7 @@ fi
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/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/JAIL-IP/${JAIL_IP}/" /usr/local/www/Caddyfile

View File

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

View File

@ -5,16 +5,26 @@
# Initialise defaults
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"
INCLUDES_PATH="${SCRIPT_DIR}/jails/nextcloud/includes"
# shellcheck disable=SC2154
STANDALONE_CERT=${nextcloud_standalone_cert}
# shellcheck disable=SC2154
SELFSIGNED_CERT=${nextcloud_selfsigned_cert}
# shellcheck disable=SC2154
DNS_CERT=${nextcloud_dns_cert}
# shellcheck disable=SC2154
NO_CERT=${nextcloud_no_cert}
# shellcheck disable=SC2154
DL_FLAGS=${nextcloud_dl_flags}
# shellcheck disable=SC2154
DNS_SETTING=${nextcloud_dns_settings}
# shellcheck disable=SC2154
CERT_EMAIL=${nextcloud_cert_email}
# shellcheck disable=SC2154
HOST_NAME=${nextcloud_host_name}
# Only generate new DB passwords when using buildin database
@ -22,9 +32,13 @@ HOST_NAME=${nextcloud_host_name}
if [ "${DATABASE}" = "pgsql-external" ]; then
DB_NAME="PostgreSQL"
# shellcheck disable=SC2154
DB_HOST="${nextcloud_db_host}"
# shellcheck disable=SC2154
DB_DATABASE="${nextcloud_db_database}"
# shellcheck disable=SC2154
DB_USER="${nextcloud_db_user}"
# shellcheck disable=SC2154
DB_PASSWORD="${nextcloud_db_password}"
elif [ "${DATABASE}" = "mariadb-external" ]; then
DB_NAME="MariaDB"
@ -35,7 +49,8 @@ elif [ "${DATABASE}" = "mariadb-external" ]; then
elif [ "${DATABASE}" = "mariadb-jail" ]; then
DB_DATABASE="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}"
else
echo "Invalid ${JAIL_NAME}_database selected please select one from the following options:"
@ -84,6 +99,7 @@ if [ -z "${DB_DATABASE}" ]; then
exit 1
fi
# shellcheck disable=SC2154
if [ -z "${nextcloud_time_zone}" ]; then
echo 'Configuration error: TIME_ZONE must be set'
exit 1
@ -92,35 +108,36 @@ if [ -z "${HOST_NAME}" ]; then
echo 'Configuration error: HOST_NAME must be set'
exit 1
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 'or SELFSIGNED_CERT must be set to 1.'
exit 1
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 'may be set to 1.'
exit 1
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 "See https://caddyserver.com/docs under the heading of \"DNS Providers\" for list."
echo "Be sure to omit the prefix of \"tls.dns.\"."
exit 1
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 "See https://caddyserver.com/docs under the heading of \"DNS Providers\" for more."
exit 1
fi
if [ $DNS_CERT -eq 1 ] ; then
if [ "$DNS_CERT" -eq 1 ] ; then
DL_FLAGS="tls.dns.${DNS_PLUGIN}"
DNS_SETTING="dns ${DNS_PLUGIN}"
fi
# 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
echo "Reinstall of Nextcloud detected... "
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
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}/files /config/files
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}/files /config/files
# Install includes fstab
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
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"
if [ ! -d "/mnt/${global_dataset_config}/${JAIL_NAME}/ssl" ]; then
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/redis.conf /usr/local/etc/redis.conf
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/
fi
if [ $NO_CERT -eq 1 ]; then
if [ "$NO_CERT" -eq 1 ]; then
echo "Copying Caddyfile for no SSL"
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"
iocage exec "${JAIL_NAME}" cp -f /mnt/includes/Caddyfile-selfsigned /usr/local/www/Caddyfile
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 overwritehost --value=\"${HOST_NAME}\""
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}/\""
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}/\""
@ -303,7 +320,7 @@ iocage fstab -r "${JAIL_NAME}" "${INCLUDES_PATH}" /mnt/includes nullfs rw 0 0
# Done!
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"
else
echo "Using your web browser, go to https://${HOST_NAME} to log in"
@ -325,14 +342,14 @@ else
fi
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 "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 "correctly, you should issue a trusted certificate. To do this, run:"
echo " iocage exec ${JAIL_NAME} /root/remove-staging.sh"
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 "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"

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 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/${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
# shellcheck disable=SC2154
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
# shellcheck disable=SC2154
if [ ! -d "/mnt/${global_dataset_config}/organizr/ssl" ]; then
echo "cert folder doesn't exist... creating..."
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"
else
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
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
# This file contains the update script for Organizr
iocage exec organizr service nginx stop
iocage exec organizr service php-fpm stop
# 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 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

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.
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.
createmount plex ${global_dataset_media} /mnt/media
createmount plex ${global_dataset_media}/movies /mnt/media/movies
createmount plex ${global_dataset_media}/music /mnt/media/music
createmount plex ${global_dataset_media}/shows /mnt/media/shows
# shellcheck disable=SC2154
createmount plex "${global_dataset_media}" /mnt/media
createmount plex "${global_dataset_media}"/movies /mnt/media/movies
createmount plex "${global_dataset_media}"/music /mnt/media/music
createmount plex "${global_dataset_media}"/shows /mnt/media/shows
# Create plex ramdisk if specified
# shellcheck disable=SC2154
if [ -z "${plex_ramdisk}" ]; then
echo "no ramdisk specified for plex, continuing without randisk"
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
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
# Run different install procedures depending on Plex vs Plex Beta
# shellcheck disable=SC2154
if [ "$plex_beta" == "true" ]; then
echo "beta enabled in config.yml... using plex beta for install"
iocage exec plex sysrc "plexmediaserver_plexpass_enable=YES"

View File

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

View File

@ -2,12 +2,14 @@
# This file contains the install script for radarr
# Check if dataset for completed download and it parent dataset exist, create if they do not.
createmount radarr ${global_dataset_downloads}
createmount radarr ${global_dataset_downloads}/complete /mnt/fetched
# shellcheck disable=SC2154
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.
createmount radarr ${global_dataset_media}
createmount radarr ${global_dataset_media}/movies /mnt/movies
# shellcheck disable=SC2154
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 "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 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
# 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 sysrc "radarr_enable=YES"
iocage exec radarr service radarr restart

View File

@ -4,6 +4,7 @@
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
# 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 service radarr restart

View File

@ -2,12 +2,14 @@
# This file contains the install script for sonarr
# Check if dataset for completed download and it parent dataset exist, create if they do not.
createmount sonarr ${global_dataset_downloads}
createmount sonarr ${global_dataset_downloads}/complete /mnt/fetched
# shellcheck disable=SC2154
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.
createmount sonarr ${global_dataset_media}
createmount sonarr ${global_dataset_media}/shows /mnt/shows
# shellcheck disable=SC2154
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 "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 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
# 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 sysrc "sonarr_enable=YES"
iocage exec sonarr service sonarr restart

View File

@ -4,6 +4,7 @@
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
# 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 service sonarr restart

View File

@ -2,13 +2,14 @@
# This file contains the install script for transmission
# 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.
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.
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