FreeBSD upgrade to PlexMediaServer-1.25.2.5319

Server Version#: 1.24.1.4931
Player Version#:

I have downloaded the tar.bz2 file and wanted to know if someone can guide me howto upgrade from 1.24 to 1.25. The latest version has not been posted on the Freebsd ports so I was wondering what the manual steps are to upgrade to the latest version. I was looking for a readme file in the download file but could not find it.

I wrote a script to simplify this and skip understanding how to manually upgrade. The script will modify the port files and then trigger portmaster (you can use a different port manager if you want) to apply the update.

Pre-Reqs:
pkg install portmaster
portsnap fetch extract

Script (place in /usr/local/bin/plex-update)
The script takes the release URL as an argument and updates the Makefile and distinfo files.
usage from terminal:
sudo plex-update https://downloads.plex.tv/plex-media-server-new/1.25.3.5409-f11334058/freebsd/PlexMediaServer-1.25.3.5409-f11334058-FreeBSD-amd64.tar.bz2

#!/bin/sh

portsnap fetch update

> /usr/ports/multimedia/plexmediaserver-plexpass/distinfo

now=$(date +'%s')
fileName=$(echo $1 | cut -d "/" -f 7)
sha=$(curl -s $1|sha256)
fileLen=$(curl -sI $1 | awk '{RS="\r?\n"}/content-length/ { print $2 }')
appVersion=$(echo $1 | cut -d "-" -f 6)
distVersion=$(echo $1 | cut -d "-" -f 7)

echo "TIMESTAMP = $now" >> /usr/ports/multimedia/plexmediaserver-plexpass/distinfo
echo "SHA256 ($fileName) = $sha" >> /usr/ports/multimedia/plexmediaserver-plexpass/distinfo
echo "SIZE ($fileName) = $fileLen" >> /usr/ports/multimedia/plexmediaserver-plexpass/distinfo

sed -i.bak "s/PORTVERSION=.*$/PORTVERSION=\t"$appVersion"/" /usr/ports/multimedia/plexmediaserver-plexpass/Makefile
sed -i.bak "s/DISTVERSIONSUFFIX=.*$/DISTVERSIONSUFFIX="$distVersion"/" /usr/ports/multimedia/plexmediaserver-plexpass/Makefile

rm /usr/ports/multimedia/plexmediaserver-plexpass/Makefile.bak

portmaster -aGd
service plexmediaserver_plexpass restart
1 Like

Kudos for not just breaking the installed pkg or port! So many of the “upgrade” scripts are awful.

??

The last line in distinfo there is a DOS line ending (^M). Wasn’t sure why, but it was faster to just use dos2unix instead spending a bunch of time trying to identify the issue.

1 Like

Oh, gosh. Yes. That’s an old memory, painfully reactivated. HTTP headers. Telnet. All of the Old Internet protocols wanted CRLF.

awk 'BEGIN {FS=": "}/content-length/ { print $2 }'

That didn’t seem to work, but the following removes the carriage returns.

awk 'gsub(/\r/,"") {} /content-length/ { print $2 }'
1 Like

gsub() is clever.

But goddammit. Apparently I can’t copy and paste. I first tried FS=": " which obviously didn’t work.

This makes me happier!

awk '{RS="\r?\n"}/content-length/ { print $2 }'

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.