Last active
June 1, 2019 18:52
-
-
Save scrathe/ba29e50d95f71bfb207ccf6f74a425a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# credit; https://forums.unraid.net/topic/69255-cant-access-host-from-docker-container-when-using-br0/?do=findComment&comment=635402 | |
# note: the path to the script must be accessible from within the docker shell | |
# option 1) run from inside the docker shell (do this first to make sure it works) | |
# option 2) run-as unraid user-script scheduled on-first-array-start-only (run once in background to avoid unraid reboot) | |
# nohup docker events --filter "container=plex" | awk '/container start/ { system("docker exec -i plex /bin/bash -c '/media/scripts/docker-plexencode/script'") }' & | |
# nohup docker events --filter "container=radarr" | awk '/container start/ { system("docker exec -i radarr /bin/bash -c '/media/scripts/docker-plexencode/script'") }' & | |
# nohup docker events --filter "container=sonarr" | awk '/container start/ { system("docker exec -i sonarr /bin/bash -c '/media/scripts/docker-plexencode/script'") }' & | |
# option 3) modify unraid flash:/boot/config/go (requires unraid reboot) | |
# docker events --filter "container=plex" | awk '/container start/ { system("docker exec -i plex /bin/bash -c '/media/scripts/docker-plexencode/script'") }' & | |
# docker events --filter "container=radarr" | awk '/container start/ { system("docker exec -i radarr /bin/bash -c '/media/scripts/docker-plexencode/script'") }' & | |
# docker events --filter "container=sonarr" | awk '/container start/ { system("docker exec -i sonarr /bin/bash -c '/media/scripts/docker-plexencode/script'") }' & | |
export DEBIAN_FRONTEND=noninteractive | |
# default packages | |
packages="bc lsof ffmpeg mediainfo" | |
# optional swap ffmpeg with handbrake-cli / add atomicparsley | |
# packages="bc lsof mediainfo atomicparsley handbrake-cli" | |
# refresh apt repository | |
apt_size=$(du -sb /var/lib/apt/lists | awk '{print $1}') | |
if [[ $apt_size -le "100" ]]; then | |
# sometimes canonical mirrors have problems | |
sed -i 's/http:\/\/archive.ubuntu.com/http:\/\/us.archive.ubuntu.com/g' /etc/apt/sources.list | |
apt update | |
fi | |
package_install(){ | |
# check to see if a package is installed | |
dpkg -s $1 >/dev/null | |
if [[ $? != 0 ]]; then | |
apt install $1 -y | |
fi | |
} | |
for i in $packages; do | |
if [[ $i = "atomicparsley" ]]; then | |
prereq="autoconf automake build-essential unzip" | |
for j in $prereq; do | |
package_install $j | |
done | |
apt update | |
curl https://bitbucket.org/wez/atomicparsley/get/9183fff907bf.zip --output atomicparsley.zip | |
unzip atomicparsley.zip -d /opt && mv /opt/wez-* /opt/atomicparsley | |
cd /opt/atomicparsley && ./autogen.sh && ./configure && make && make install | |
fi | |
if [[ $i = "handbrake-cli" ]]; then | |
prereq="software-properties-common zlib1g-dev" | |
for j in $prereq; do | |
package_install $j | |
done | |
apt update | |
add-apt-repository ppa:stebbins/handbrake-releases -y | |
package_install handbrake-cli | |
fi | |
package_install $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment