Skip to content

Commit

Permalink
Move folders to /data
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbelgium authored Nov 3, 2023
1 parent 7ba5b76 commit 95d7bab
Showing 1 changed file with 22 additions and 59 deletions.
81 changes: 22 additions & 59 deletions jellyfin/rootfs/etc/cont-init.d/20-folders.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,71 +18,34 @@ if [ -z "$LOCATIONOK" ]; then
fi

# Set folders

if [ ! -d /jellyfin ]; then
echo "Creating /jellyfin"
mkdir -p /jellyfin
chown -R "$PUID:$PGID" /jellyfin
fi

if [ ! -d "$LOCATION"/tv ]; then
echo "Creating $LOCATION/tv"
mkdir -p "$LOCATION"/tv
chown -R "$PUID:$PGID" "$LOCATION"/tv
fi

if [ ! -d "$LOCATION"/movies ]; then
echo "Creating $LOCATION/movies"
mkdir -p "$LOCATION"/movies
chown -R "$PUID:$PGID" "$LOCATION"/movies
fi

if [ ! -d "$LOCATION" ]; then
echo "Creating $LOCATION"
mkdir -p "$LOCATION"
chown -R "$PUID:$PGID" "$LOCATION"
fi

# links

if [ ! -d /jellyfin/cache ]; then
echo "Creating link for /jellyfin/cache"
mkdir -p "$LOCATION"/cache
chown -R "$PUID:$PGID" "$LOCATION"/cache
ln -s "$LOCATION"/cache /jellyfin/cache
fi

if [ ! -d /jellyfin/data ]; then
echo "Creating link for /jellyfin/data"
mkdir -p "$LOCATION"/data
chown -R "$PUID:$PGID" "$LOCATION"/data
ln -s "$LOCATION"/data /jellyfin/data
fi

if [ ! -d /jellyfin/log ]; then
echo "Creating link for /jellyfin/log"
mkdir -p "$LOCATION"/log
chown -R "$PUID:$PGID" "$LOCATION"/log
ln -s "$LOCATION"/log /jellyfin/log
fi

if [ ! -d /jellyfin/metadata ]; then
echo "Creating link for /jellyfin/metadata"
mkdir -p "$LOCATION"/metadata
chown -R "$PUID:$PGID" "$LOCATION"/metadata
ln -s "$LOCATION"/metadata /jellyfin/metadata
fi
for folders in "tv" "movie"; do
echo "Creating $LOCATION/$folders"
mkdir -p "$LOCATION/$folders"
chown -R "$PUID:$PGID" "$LOCATION/$folders"
done

if [ ! -d /jellyfin/plugins ]; then
echo "Creating link for /jellyfin/plugins"
mkdir -p "$LOCATION"/plugins
chown -R "$PUID:$PGID" "$LOCATION"/plugins
ln -s "$LOCATION"/plugins /jellyfin/plugins
fi
# links in /data
for folders in "cache" "log" "data/metadata"; do
echo "Creating link for /jellyfin/$folders"
mkdir -p /data/"$folders"
chown -R "$PUID:$PGID" /data/"$folders"
ln -s /data/"$folders" /jellyfin/"$folders"
if [ -d "$LOCATION/$folders" ]; then
cp -r "$LOCATION/$folders/*" /data/"$folders"/
rm -r "$LOCATION/$folders"
fi
done

if [ ! -d /jellyfin/root ]; then
echo "Creating link for /jellyfin/root"
mkdir -p "$LOCATION"/root
chown -R "$PUID:$PGID" "$LOCATION"/root
ln -s "$LOCATION"/root /jellyfin/root
# links in /config
for folders in "data" "plugins" "root"; do
echo "Creating link for /jellyfin/$folders"
mkdir -p "$LOCATION/$folders"
chown -R "$PUID:$PGID" "$LOCATION/$folders"
ln -s "$LOCATION/$folders" /jellyfin/"$folders"
fi

0 comments on commit 95d7bab

Please sign in to comment.