added transmission installer

This commit is contained in:
Snogard 2023-10-20 18:16:10 +02:00
parent 953a589778
commit 72fb065b66

View File

@ -0,0 +1,83 @@
#!/bin/bash
source /opt/kaido/src/libs/bash/lib.sh
# docs https://github.com/linuxserver/docker-transmission
# setup
imageName=docker.io/linuxserver/transmission:4.0.4-r0-ls203
containerName=transmission
dstBasePath="$CONTAINERS_FOLDER/$containerName"
dstConfigPath="$dstBasePath/config"
dstDownloadPath="$dstBasePath/downloads"
dstWatchPath="$dstBasePath/watch"
# envs
externalPort=10101
torrentPort=51413
timezone="Europe/Rome"
themePath="/config/flood-for-transmission/"
themeFileName="flood-for-transmission.zip"
themeDownloadUrl="https://github.com/johman10/flood-for-transmission/releases/download/latest/flood-for-transmission.zip"
secret_user=$containerName-user
secret_pass=$containerName-pass
if [ -f "/etc/kaido/containers/$containerName/envs.sh" ]; then
source /etc/kaido/containers/$containerName/envs.sh
fi
# pre install
create_folder "$dstConfigPath"
create_folder "$dstDownloadPath"
create_folder "$dstWatchPath"
stop_and_remove_container $containerName
res=0
secret_check $secret_user
res=$(($?+$res))
secret_check $secret_pass
res=$(($?+$res))
if [[ $res -gt 0 ]]; then
exit 1
fi
sudo ufw allow $torrentPort/tcp
sudo ufw allow $torrentPort/udp
# download theme
if [ ! -d "${dstBasePath}${themePath}" ]; then
wget "https://github.com/johman10/flood-for-transmission/releases/download/latest/flood-for-transmission.zip" -O "$dstConfigPath/$themeFileName"
unzip "$dstConfigPath/$themeFileName" -d "$dstConfigPath"
rm "$dstConfigPath/$themeFileName"
fi
# install
echo "Creating new container"
podman create \
--name $containerName \
--secret $secret_user,type=env,target=USER \
--secret $secret_pass,type=env,target=PASS \
-p $externalPort:9091/tcp \
-p $torrentPort:51413/tcp \
-p $torrentPort:51413/udp \
-v $dstConfigPath:/config \
-v $dstDownloadPath:/downloads \
-v $dstWatchPath:/watch \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=$timezone \
-e TRANSMISSION_WEB_HOME=$themePath \
$imageName
# systemd
create_systemd_services $containerName
systemctl --user enable --now $containerName