simplify config, precreate symlinks

This commit is contained in:
aptalca
2022-08-29 14:29:22 -04:00
parent 41bc10b367
commit eb3fedc2b7
9 changed files with 94 additions and 45 deletions
+16 -44
View File
@@ -1,54 +1,32 @@
#!/usr/bin/with-contenv bash
#Install dependancies
apt install -y python3-click python3-yaml openssh-client
apt-get install -y --no-install-recommends \
iputils-ping \
openssh-client \
python3-click \
python3-yaml \
wakeonlan
#Grab Config
mkdir -p /etc/rffmpeg
mkdir -p /config/rffmpeg/.ssh
mkdir -p \
/etc/rffmpeg \
/config/rffmpeg/.ssh
touch /config/rffmpeg/.ssh/id_rsa
chmod 600 /config/rffmpeg/.ssh/id_rsa
if [ -f /config/rffmpeg/rffmpeg.yml ]; then
echo "**** rffmpeg.yml already present ****"
else
echo "**** Grabbing rffmpeg.yml from upstream ****"
curl -L -o /config/rffmpeg/rffmpeg.yml https://raw.githubusercontent.com/joshuaboniface/rffmpeg/master/rffmpeg.yml.sample
else
echo "**** Creating rffmpeg.yml from sample ****"
cp /defaults/rffmpeg.yml.sample /config/rffmpeg/rffmpeg.yml
fi
ln -s /config/rffmpeg/rffmpeg.yml /etc/rffmpeg/rffmpeg.yml
#Grab rffmpeg
mkdir -p /usr/local/bin/
echo "**** Grabbing rffmpeg from upstream ****"
if [ -f /usr/local/bin/rffmpeg ]; then
rm /usr/local/bin/rffmpeg
fi
rm -rf /usr/local/bin/rffmpeg
curl -L -o /usr/local/bin/rffmpeg https://raw.githubusercontent.com/joshuaboniface/rffmpeg/master/rffmpeg
chmod +x /usr/local/bin/rffmpeg
ln -s /usr/local/bin/rffmpeg /usr/local/bin/ffprobe
ln -s /usr/local/bin/rffmpeg /usr/local/bin/ffmpeg
#WOL Support
if [ $RFFMPEG_WOL = "native" ] && [ ! -f /usr/local/bin/wol_rffmpeg/wol ]
then
echo "**** Adding WOL Support ****"
apt install -y wakeonlan iputils-ping
mkdir -p /usr/local/bin/wol_rffmpeg
curl -L -o /usr/local/bin/wol_rffmpeg/wol https://raw.githubusercontent.com/junkman690/docker-mods/jellyfin-rffmpeg/wol
chmod +x /usr/local/bin/wol_rffmpeg/wol
ln -s /usr/local/bin/wol_rffmpeg/wol /usr/local/bin/wol_rffmpeg/ffmpeg
ln -s /usr/local/bin/wol_rffmpeg/wol /usr/local/bin/wol_rffmpeg/ffprobe
fi
if [ $RFFMPEG_WOL = "api" ] && [ ! -f /usr/local/bin/wol_rffmpeg/wol ]
then
echo "**** Adding WOL Support ****"
apt install -y iputils-ping
mkdir -p /usr/local/bin/wol_rffmpeg
curl -L -o /usr/local/bin/wol_rffmpeg/wol https://raw.githubusercontent.com/junkman690/docker-mods/jellyfin-rffmpeg/wol
chmod +x /usr/local/bin/wol_rffmpeg/wol
ln -s /usr/local/bin/wol_rffmpeg/wol /usr/local/bin/wol_rffmpeg/ffmpeg
ln -s /usr/local/bin/wol_rffmpeg/wol /usr/local/bin/wol_rffmpeg/ffprobe
fi
##Update rffmpeg.yml
sed -i 's~#persist: "/run/shm"~persist: "/dev/shm"~' /config/rffmpeg/rffmpeg.yml
@@ -60,9 +38,8 @@ sed -i 's~#group: sudo~group: abc~' /config/rffmpeg/rffmpeg.yml
sed -i 's~#args:~args:~' /config/rffmpeg/rffmpeg.yml
sed -i 's~# - "-i"~ - "-i"~' /config/rffmpeg/rffmpeg.yml
sed -i 's~# - "/var/lib/jellyfin/id_rsa"~ - "/config/rffmpeg/.ssh/id_rsa"~' /config/rffmpeg/rffmpeg.yml
if [ ! -z "$RFFMPEG_USER" ]
then
sed -i "s~#user: jellyfin~user: $RFFMPEG_USER~" /config/rffmpeg/rffmpeg.yml
if [ ! -z "$RFFMPEG_USER" ]; then
sed -i "s~#user: jellyfin~user: $RFFMPEG_USER~" /config/rffmpeg/rffmpeg.yml
fi
#Fix permissions
@@ -75,12 +52,7 @@ else
echo "**** Initialize database ****"
/usr/local/bin/rffmpeg init --yes
#Add host
if [ ! -z "$RFFMPEG_HOST" ]
then
if [ ! -z "$RFFMPEG_HOST" ]; then
s6-setuidgid abc /usr/local/bin/rffmpeg add --weight 1 $RFFMPEG_HOST
fi
fi
exit 0
+1
View File
@@ -0,0 +1 @@
/config/rffmpeg/rffmpeg.yml