From 1a346d2db93844b99959e59c333931686abbcb62 Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Sat, 22 Mar 2025 16:02:40 -0400 Subject: [PATCH 01/12] Change Custom updates to download the tcz generated by lyrion.org --- Custom.pm | 21 ++++++++++++++------- picore-update.html | 6 +++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Custom.pm b/Custom.pm index 6c9d864..b2a0f5f 100644 --- a/Custom.pm +++ b/Custom.pm @@ -73,17 +73,13 @@ sub dirsFor { } sub canAutoUpdate { 1 } -sub installerExtension { 'tgz' } -sub installerOS { 'nocpan' } +sub installerExtension { 'tcz' } +sub installerOS { 'pcp' } sub getUpdateParams { my ($class, $url) = @_; if ($url) { - my ($version, $revision) = $url =~ /(\d+\.\d+\.\d+)(?:.*?(\d{10,}))?/; - $revision ||= ''; - $::newVersion = Slim::Utils::Strings::string('PICORE_UPDATE_AVAILABLE', "$version - $revision", $url); - require File::Slurp; my $updateFile = UPDATE_DIR . '/update_url'; @@ -94,9 +90,20 @@ sub getUpdateParams { else { Slim::Utils::Log::logger('server.update')->warn("Unable to update version file: $updateFile"); } + } - return; + return { + cb => sub { + my ($file) = @_; + + if ($file) { + my ($version, $revision) = $file =~ /(\d+\.\d+\.\d+)(?:.*?(\d{5,}))?/; + $revision ||= 0; + $::newVersion = Slim::Utils::Strings::string('PICORE_UPDATE_AVAILABLE', "$version - $revision", $file); + } + } + }; } sub logRotate { diff --git a/picore-update.html b/picore-update.html index cd3c117..f955813 100644 --- a/picore-update.html +++ b/picore-update.html @@ -1,12 +1,12 @@ [%# Helper web page for piCore and piCorePlayer with instructions as to how to update slimserver. - Revision 1.1 + Revision 1.2 %] [% pagetitle = 'How to update your Lyrion Music Server on your piCore system' %] [% PROCESS helpheader.html %] -[% extension = installerFile.match('\.(tgz)$'); +[% extension = installerFile.match('\.(tcz)$'); IF extension; distro = extension.0; END; @@ -23,7 +23,7 @@
sudo [% distro == 'tgz' ? 'lms-update.sh -r ' : 'Error' %] sudo [% distro == 'tcz' ? 'lms-update.sh -r ' : 'Error' %] For users of piCorePlayer please use From d595b71238e0815afd4b1ee16e8d4fe91f84c04a Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Sat, 22 Mar 2025 16:07:26 -0400 Subject: [PATCH 02/12] Update script to support direct tcz downloads from lms --- lms-update.sh | 329 ++++++++++++++++++++++++++------------------------ 1 file changed, 172 insertions(+), 157 deletions(-) diff --git a/lms-update.sh b/lms-update.sh index 27fa830..de1cb86 100755 --- a/lms-update.sh +++ b/lms-update.sh @@ -169,17 +169,23 @@ else sed -E -i 's/>/>\n/g' $tmp while read line; do - echo $line | grep -q nocpan - if [ $? -eq 0 ]; then - NOCPAN=$(echo $line) - fi + echo $line | grep -q nocpan + if [ $? -eq 0 ]; then + UPDPKG=$(echo $line) + fi + echo $line | grep -q pcp + if [ $? -eq 0 ]; then + UPDPKG=$(echo $line) + fi + done < $tmp rm -f $tmp - if [ "$NOCPAN" != "" ]; then - NEW_REVISION=$(echo $NOCPAN | awk -F'revision=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') - NEW_URL=$(echo $NOCPAN | awk -F'url=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') - NEW_VERSION=$(echo $NOCPAN | awk -F'version=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') + if [ "$UPDPKG" != "" ]; then + NEW_REVISION=$(echo $UPDPKG | awk -F'revision=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') + NEW_URL=$(echo $UPDPKG | awk -F'url=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') + NEW_VERSION=$(echo $UPDPKG | awk -F'version=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') + NEW_md5=$(echo $UPDPKG | awk -F'md5=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') else echo "${YELLOW}No update information returned from the download site. There may not be current packages for the" echo "release branch selected.${NORMAL}" @@ -229,170 +235,179 @@ else echo "${GREEN}Downloading update from ${LINK}" fi -rm -f $DL_DIR/*.tgz -wget -P $DL_DIR $LINK -if [ "$?" != "0" ]; then - echo "${RED}Download FAILED...... exiting!${NORMAL}" - [ -n "$DEBUG" ] || rm -f $DL_DIR/'*.tgz' - exit 1 +#Check for extension packages already downloaded +PKG=$(ls -1 $DL_DIR/lyrionmusicserver*.tcz 2>/dev/null) +if [ "$PKG" = "" ]; then + rm -f $DL_DIR/*.t?z + wget -P $DL_DIR $LINK + if [ "$?" != "0" ]; then + echo "${RED}Download FAILED...... exiting!${NORMAL}" + [ -n "$DEBUG" ] || rm -f $DL_DIR/'*.t?z' + exit 1 + fi + NEWUPDATE=`find ${DL_DIR} -name "*.t?z"` + if [ -z $NEWUPDATE ]; then + echo "${BLUE}No Update Found, please make sure Automatic updates and Automatic Downloads are enable in LMS.${NORMAL}" + echo + exit 0 + fi fi -NEWUPDATE=`find ${DL_DIR} -name "*.tgz"` -if [ -z $NEWUPDATE ]; then - echo "${BLUE}No Update Found, please make sure Automatic updates and Automatic Downloads are enable in LMS.${NORMAL}" +PKG=$(ls -1 $DL_DIR/lyrionmusicserver*.tcz 2>/dev/null) +if [ "$PKG" != "" ]; then + #Downloaded md5 was checked by LMS + mv $DL_DIR/lyrionmusicserver*.tcz /tmp/slimserver.tcz +else + #Check for depednancy of mksquashfs + if [ ! -x /usr/local/bin/mksquashfs ]; then + if [ ! -f $TCEDIR/optional/squashfs-tools.tcz ]; then + echo "${GREEN}Downloading required extension squashfs-tools.tcz${NORMAL}" + echo + su - tc -c "pcp-load -r https://repo.picoreplayer.org/repo -liw squashfs-tools.tcz" + else + echo "${GREEN}Loading Local Extension squashfs-tools.tcz${NORMAL}" + echo + su - tc -c "pcp-load -r https://repo.picoreplayer.org/repo -li squashfs-tools.tcz" + fi + if [ "$?" != "0" ]; then echo "${RED}Failed to load required extension!. ${NORMAL} Check by manually installing extension squashfs-tools.tcz"; exit 1; fi + fi + echo - exit 0 -fi + echo "${GREEN}Updating from ${NEWUPDATE}" -#Check for depednancy of mksquashfs -if [ ! -x /usr/local/bin/mksquashfs ]; then - if [ ! -f $TCEDIR/optional/squashfs-tools.tcz ]; then - echo "${GREEN}Downloading required extension squashfs-tools.tcz${NORMAL}" - echo - su - tc -c "pcp-load -r https://repo.picoreplayer.org/repo -liw squashfs-tools.tcz" - else - echo "${GREEN}Loading Local Extension squashfs-tools.tcz${NORMAL}" - echo - su - tc -c "pcp-load -r https://repo.picoreplayer.org/repo -li squashfs-tools.tcz" - fi - if [ "$?" != "0" ]; then echo "${RED}Failed to load required extension!. ${NORMAL} Check by manually installing extension squashfs-tools.tcz"; exit 1; fi -fi + # Extract Downloaded File + echo + echo -ne "${GREEN}Extracting Update..." -echo -echo "${GREEN}Updating from ${NEWUPDATE}" + SRC_DIR=`mktemp -d` + f=`mktemp` + ( tar -xzf ${NEWUPDATE} -C $SRC_DIR; echo -n $? > $f ) & -# Extract Downloaded File -echo -echo -ne "${GREEN}Extracting Update..." - -SRC_DIR=`mktemp -d` -f=`mktemp` -( tar -xzf ${NEWUPDATE} -C $SRC_DIR; echo -n $? > $f ) & - -rotdash $! -read e < $f -if [ "$e" != "0" ]; then - echo "${RED}File Extraction FAILED.....exiting!${NORMAL}" - [ -n "$DEBUG" ] || rm -rf $SRC_DIR - exit 1 -fi -rm -f $f + rotdash $! + read e < $f + if [ "$e" != "0" ]; then + echo "${RED}File Extraction FAILED.....exiting!${NORMAL}" + [ -n "$DEBUG" ] || rm -rf $SRC_DIR + exit 1 + fi + rm -f $f -echo -echo -e "${BLUE}Tar Extraction Complete, Building Updated Extension Filesystem" -echo -echo "Press Enter to continue, or Ctrl-c to exit${NORMAL}" + echo + echo -e "${BLUE}Tar Extraction Complete, Building Updated Extension Filesystem" + echo + echo "Press Enter to continue, or Ctrl-c to exit${NORMAL}" -[ -z "$UNATTENDED" ] && read key + [ -z "$UNATTENDED" ] && read key -echo -echo -ne "${GREEN}Update in progress ..." - -BUILD_DIR=`mktemp -d` - -f=`mktemp` -echo 0 > $f - -# Each command has an error trap -(mkdir -p $BUILD_DIR/usr/local/bin -[ "$?" != "0" ] && echo -n "1" > $f -mkdir -p $BUILD_DIR/usr/local/etc/init.d -[ "$?" != "0" ] && echo -n "1" > $f -mv $SRC_DIR/*-noCPAN $BUILD_DIR/usr/local/slimserver -[ "$?" != "0" ] && echo -n "1" > $f - -# Remove the Font directory, separate package is needed to work anyway -rm -rf $BUILD_DIR/usr/local/slimserver/CPAN/Font - -#Copy in piCore custom files -FDIR="usr/local/slimserver/Slim/Utils/OS" -F="Custom.pm" -if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version - cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} -else # Copy version from current Extension - cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} -fi -[ "$?" != "0" ] && echo -n "1" > $f - -FDIR="usr/local/slimserver/HTML/EN/html/docs" -F="picore-update.html" -if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version - cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} -else # Copy version from current Extension - cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} -fi -[ "$?" != "0" ] && echo -n "1" > $f - -FDIR="usr/local/slimserver" -F="custom-strings.txt" -if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version - cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} -else # Copy version from current Extension - cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} -fi -[ "$?" != "0" ] && echo -n "1" > $f - -###tarfile comes with only user ownership, which breaks symlinks on TC -#Change all files to 644 -chmod -R 644 $BUILD_DIR -[ "$?" != "0" ] && echo -n "1" > $f -#Change mode for directories to 755 -find $BUILD_DIR -type d | xargs -t -I {} chmod 755 {} > /dev/null 2>&1 -[ "$?" != "0" ] && echo -n "1" > $f -#Change mod for executables -find $BUILD_DIR -name "*.pl" | xargs -t -I {} chmod 755 {} > /dev/null 2>&1 -[ "$?" != "0" ] && echo -n "1" > $f -find $BUILD_DIR -name "dbish" | xargs -t -I {} chmod 755 {} > /dev/null 2>&1 -[ "$?" != "0" ] && echo -n "1" > $f - -#Copy in new init.d script -FDIR="usr/local/etc/init.d" -F="slimserver" -if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version - cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} - chmod 755 $BUILD_DIR/${FDIR}/${F} -else # Copy version from current Extension - cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} -fi -[ "$?" != "0" ] && echo -n "1" > $f - -#Copy Update Script -FDIR="usr/local/bin" -F="lms-update.sh" -echo "${DL_DIR}/${F}" -if [ -x "${DL_DIR}/${F}" ]; then # Copy Updated Version - cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} -else # Copy version from current Extension - cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} -fi -[ "$?" != "0" ] && echo -n "1" > $f + echo + echo -ne "${GREEN}Update in progress ..." + + BUILD_DIR=`mktemp -d` + + f=`mktemp` + echo 0 > $f + + # Each command has an error trap + (mkdir -p $BUILD_DIR/usr/local/bin + [ "$?" != "0" ] && echo -n "1" > $f + mkdir -p $BUILD_DIR/usr/local/etc/init.d + [ "$?" != "0" ] && echo -n "1" > $f + mv $SRC_DIR/*-noCPAN $BUILD_DIR/usr/local/slimserver + [ "$?" != "0" ] && echo -n "1" > $f + + # Remove the Font directory, separate package is needed to work anyway + rm -rf $BUILD_DIR/usr/local/slimserver/CPAN/Font + + #Copy in piCore custom files + FDIR="usr/local/slimserver/Slim/Utils/OS" + F="Custom.pm" + if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version + cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} + else # Copy version from current Extension + cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} + fi + [ "$?" != "0" ] && echo -n "1" > $f + + FDIR="usr/local/slimserver/HTML/EN/html/docs" + F="picore-update.html" + if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version + cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} + else # Copy version from current Extension + cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} + fi + [ "$?" != "0" ] && echo -n "1" > $f + + FDIR="usr/local/slimserver" + F="custom-strings.txt" + if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version + cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} + else # Copy version from current Extension + cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} + fi + [ "$?" != "0" ] && echo -n "1" > $f + + ###tarfile comes with only user ownership, which breaks symlinks on TC + #Change all files to 644 + chmod -R 644 $BUILD_DIR + [ "$?" != "0" ] && echo -n "1" > $f + #Change mode for directories to 755 + find $BUILD_DIR -type d | xargs -t -I {} chmod 755 {} > /dev/null 2>&1 + [ "$?" != "0" ] && echo -n "1" > $f + #Change mod for executables + find $BUILD_DIR -name "*.pl" | xargs -t -I {} chmod 755 {} > /dev/null 2>&1 + [ "$?" != "0" ] && echo -n "1" > $f + find $BUILD_DIR -name "dbish" | xargs -t -I {} chmod 755 {} > /dev/null 2>&1 + [ "$?" != "0" ] && echo -n "1" > $f + + #Copy in new init.d script + FDIR="usr/local/etc/init.d" + F="slimserver" + if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version + cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} + chmod 755 $BUILD_DIR/${FDIR}/${F} + else # Copy version from current Extension + cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} + fi + [ "$?" != "0" ] && echo -n "1" > $f + + #Copy Update Script + FDIR="usr/local/bin" + F="lms-update.sh" + echo "${DL_DIR}/${F}" + if [ -x "${DL_DIR}/${F}" ]; then # Copy Updated Version + cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} + else # Copy version from current Extension + cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} + fi + [ "$?" != "0" ] && echo -n "1" > $f -) & + ) & -rotdash $! -read e < $f -if [ "$e" != "0" ]; then - echo "${RED}Update FAILED.....exiting!${NORMAL}" - [ -n "$DEBUG" ] || (rm -rf $SRC_DIR; rm -rf $BUILD_DIR) - exit 1 -fi -rm -f $f + rotdash $! + read e < $f + if [ "$e" != "0" ]; then + echo "${RED}Update FAILED.....exiting!${NORMAL}" + [ -n "$DEBUG" ] || (rm -rf $SRC_DIR; rm -rf $BUILD_DIR) + exit 1 + fi + rm -f $f -echo -echo -echo -e "${BLUE}Done Updating Files. The files are ready to be packed into the new extension" -echo -echo "${BLUE}Press Enter to continue, or Ctrl-c to exit${NORMAL}" + echo + echo + echo -e "${BLUE}Done Updating Files. The files are ready to be packed into the new extension" + echo + echo "${BLUE}Press Enter to continue, or Ctrl-c to exit${NORMAL}" -[ -z "$UNATTENDED" ] && read key + [ -z "$UNATTENDED" ] && read key -echo "${GREEN}Creating extension, it may take a while ... especially on rpi 0/A/B/A+/B+" + echo "${GREEN}Creating extension, it may take a while ... especially on rpi 0/A/B/A+/B+" -mksquashfs $BUILD_DIR /tmp/slimserver.tcz -noappend -force-uid 0 -force-gid 50 -b 16384 -if [ "$?" != "0" ]; then - echo "${RED}Building Extension FAILED...... exiting!${NORMAL}" - [ -n "$DEBUG" ] || (rm -rf $SRC_DIR; rm -rf $BUILD_DIR) - exit 1 + mksquashfs $BUILD_DIR /tmp/slimserver.tcz -noappend -force-uid 0 -force-gid 50 -b 16384 + if [ "$?" != "0" ]; then + echo "${RED}Building Extension FAILED...... exiting!${NORMAL}" + [ -n "$DEBUG" ] || (rm -rf $SRC_DIR; rm -rf $BUILD_DIR) + exit 1 + fi fi REBOOT="" From 9b54e0efd2a32ddf9646ad0a36ee2e5ef41ed2d0 Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Thu, 27 Mar 2025 20:02:42 -0400 Subject: [PATCH 03/12] Use server downloaded package, or download if manually changing versions. Remove old package build sections. --- lms-update.sh | 171 +++++--------------------------------------------- 1 file changed, 17 insertions(+), 154 deletions(-) diff --git a/lms-update.sh b/lms-update.sh index de1cb86..e222dbd 100755 --- a/lms-update.sh +++ b/lms-update.sh @@ -15,6 +15,9 @@ checkroot TCEDIR=$(readlink "/etc/sysconfig/tcedir") DL_DIR="/tmp/slimupdate" +# Future +LMS_DIR="/usr/local/slimserver/Cache/updates" +# UPDATELINK="${DL_DIR}/update_url" SCRIPT=$(readlink -f $0) NEWARGS="${@}" @@ -185,7 +188,7 @@ else NEW_REVISION=$(echo $UPDPKG | awk -F'revision=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') NEW_URL=$(echo $UPDPKG | awk -F'url=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') NEW_VERSION=$(echo $UPDPKG | awk -F'version=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') - NEW_md5=$(echo $UPDPKG | awk -F'md5=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') + NEW_MD5=$(echo $UPDPKG | awk -F'md5=' '{print $2}' | cut -d' ' -f1 | sed 's|/>||' | sed 's|"||g') else echo "${YELLOW}No update information returned from the download site. There may not be current packages for the" echo "release branch selected.${NORMAL}" @@ -232,11 +235,11 @@ if [ "$LINK" = "0" ]; then fi else echo - echo "${GREEN}Downloading update from ${LINK}" + echo "${GREEN}Updating from ${LINK}" fi #Check for extension packages already downloaded -PKG=$(ls -1 $DL_DIR/lyrionmusicserver*.tcz 2>/dev/null) +PKG=$(ls -1 ${DL_DIR}/lyrionmusicserver*.tcz 2>/dev/null) if [ "$PKG" = "" ]; then rm -f $DL_DIR/*.t?z wget -P $DL_DIR $LINK @@ -245,6 +248,9 @@ if [ "$PKG" = "" ]; then [ -n "$DEBUG" ] || rm -f $DL_DIR/'*.t?z' exit 1 fi + FILENAME="$(echo $NEW_URL | awk -F'/' '{ print $NF }')" + echo "$NEW_MD5 $FILENAME" > ${DL_DIR}/$FILENAME + NEWUPDATE=`find ${DL_DIR} -name "*.t?z"` if [ -z $NEWUPDATE ]; then echo "${BLUE}No Update Found, please make sure Automatic updates and Automatic Downloads are enable in LMS.${NORMAL}" @@ -253,159 +259,16 @@ if [ "$PKG" = "" ]; then fi fi +#This package was manually downloaded PKG=$(ls -1 $DL_DIR/lyrionmusicserver*.tcz 2>/dev/null) if [ "$PKG" != "" ]; then - #Downloaded md5 was checked by LMS - mv $DL_DIR/lyrionmusicserver*.tcz /tmp/slimserver.tcz -else - #Check for depednancy of mksquashfs - if [ ! -x /usr/local/bin/mksquashfs ]; then - if [ ! -f $TCEDIR/optional/squashfs-tools.tcz ]; then - echo "${GREEN}Downloading required extension squashfs-tools.tcz${NORMAL}" - echo - su - tc -c "pcp-load -r https://repo.picoreplayer.org/repo -liw squashfs-tools.tcz" - else - echo "${GREEN}Loading Local Extension squashfs-tools.tcz${NORMAL}" - echo - su - tc -c "pcp-load -r https://repo.picoreplayer.org/repo -li squashfs-tools.tcz" - fi - if [ "$?" != "0" ]; then echo "${RED}Failed to load required extension!. ${NORMAL} Check by manually installing extension squashfs-tools.tcz"; exit 1; fi - fi - - echo - echo "${GREEN}Updating from ${NEWUPDATE}" - - # Extract Downloaded File - echo - echo -ne "${GREEN}Extracting Update..." - - SRC_DIR=`mktemp -d` - f=`mktemp` - ( tar -xzf ${NEWUPDATE} -C $SRC_DIR; echo -n $? > $f ) & - - rotdash $! - read e < $f - if [ "$e" != "0" ]; then - echo "${RED}File Extraction FAILED.....exiting!${NORMAL}" - [ -n "$DEBUG" ] || rm -rf $SRC_DIR - exit 1 - fi - rm -f $f - - echo - echo -e "${BLUE}Tar Extraction Complete, Building Updated Extension Filesystem" - echo - echo "Press Enter to continue, or Ctrl-c to exit${NORMAL}" - - [ -z "$UNATTENDED" ] && read key - - echo - echo -ne "${GREEN}Update in progress ..." - - BUILD_DIR=`mktemp -d` - - f=`mktemp` - echo 0 > $f - - # Each command has an error trap - (mkdir -p $BUILD_DIR/usr/local/bin - [ "$?" != "0" ] && echo -n "1" > $f - mkdir -p $BUILD_DIR/usr/local/etc/init.d - [ "$?" != "0" ] && echo -n "1" > $f - mv $SRC_DIR/*-noCPAN $BUILD_DIR/usr/local/slimserver - [ "$?" != "0" ] && echo -n "1" > $f - - # Remove the Font directory, separate package is needed to work anyway - rm -rf $BUILD_DIR/usr/local/slimserver/CPAN/Font - - #Copy in piCore custom files - FDIR="usr/local/slimserver/Slim/Utils/OS" - F="Custom.pm" - if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version - cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} - else # Copy version from current Extension - cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} - fi - [ "$?" != "0" ] && echo -n "1" > $f - - FDIR="usr/local/slimserver/HTML/EN/html/docs" - F="picore-update.html" - if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version - cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} - else # Copy version from current Extension - cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} - fi - [ "$?" != "0" ] && echo -n "1" > $f - - FDIR="usr/local/slimserver" - F="custom-strings.txt" - if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version - cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} - else # Copy version from current Extension - cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} - fi - [ "$?" != "0" ] && echo -n "1" > $f - - ###tarfile comes with only user ownership, which breaks symlinks on TC - #Change all files to 644 - chmod -R 644 $BUILD_DIR - [ "$?" != "0" ] && echo -n "1" > $f - #Change mode for directories to 755 - find $BUILD_DIR -type d | xargs -t -I {} chmod 755 {} > /dev/null 2>&1 - [ "$?" != "0" ] && echo -n "1" > $f - #Change mod for executables - find $BUILD_DIR -name "*.pl" | xargs -t -I {} chmod 755 {} > /dev/null 2>&1 - [ "$?" != "0" ] && echo -n "1" > $f - find $BUILD_DIR -name "dbish" | xargs -t -I {} chmod 755 {} > /dev/null 2>&1 - [ "$?" != "0" ] && echo -n "1" > $f - - #Copy in new init.d script - FDIR="usr/local/etc/init.d" - F="slimserver" - if [ -e ${DL_DIR}/${F} ]; then # Copy Updated Version - cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} - chmod 755 $BUILD_DIR/${FDIR}/${F} - else # Copy version from current Extension - cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} - fi - [ "$?" != "0" ] && echo -n "1" > $f - - #Copy Update Script - FDIR="usr/local/bin" - F="lms-update.sh" - echo "${DL_DIR}/${F}" - if [ -x "${DL_DIR}/${F}" ]; then # Copy Updated Version - cp -f ${DL_DIR}/${F} $BUILD_DIR/${FDIR}/${F} - else # Copy version from current Extension - cp -f /tmp/tcloop/slimserver/${FDIR}/${F} $BUILD_DIR/${FDIR}/${F} - fi - [ "$?" != "0" ] && echo -n "1" > $f - - ) & - - rotdash $! - read e < $f - if [ "$e" != "0" ]; then - echo "${RED}Update FAILED.....exiting!${NORMAL}" - [ -n "$DEBUG" ] || (rm -rf $SRC_DIR; rm -rf $BUILD_DIR) - exit 1 - fi - rm -f $f - - echo - echo - echo -e "${BLUE}Done Updating Files. The files are ready to be packed into the new extension" - echo - echo "${BLUE}Press Enter to continue, or Ctrl-c to exit${NORMAL}" - - [ -z "$UNATTENDED" ] && read key - - echo "${GREEN}Creating extension, it may take a while ... especially on rpi 0/A/B/A+/B+" - - mksquashfs $BUILD_DIR /tmp/slimserver.tcz -noappend -force-uid 0 -force-gid 50 -b 16384 - if [ "$?" != "0" ]; then - echo "${RED}Building Extension FAILED...... exiting!${NORMAL}" - [ -n "$DEBUG" ] || (rm -rf $SRC_DIR; rm -rf $BUILD_DIR) + mv ${DL_DIR}/lyrionmusicserver*.tcz /tmp/slimserver.tcz + mv ${DL_DIR}/lyrionmusicserver*.tcz.md5.txt /tmp/slimserver.tcz.md5.txt + sed -i 's/lyrionmusicserver-.*/slimserver.tcz/' /tmp/slimserver.tcz.md5.txt + cd /tmp + md5sum -cs slimserver.tcz.md5.txt + if [ $? -ne 0 ]; then + echo "$PKG MD5 does not verify, please try again." exit 1 fi fi From 843e7f3943eb2e33c26e6b7fbdff5678f14118fb Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Fri, 28 Mar 2025 19:21:34 -0400 Subject: [PATCH 04/12] Remove pCP customizations. LMS now has direct support for pCP --- Custom.pm | 135 --------------------------------------------- custom-strings.txt | 12 ---- picore-update.html | 34 ------------ 3 files changed, 181 deletions(-) delete mode 100644 Custom.pm delete mode 100644 custom-strings.txt delete mode 100644 picore-update.html diff --git a/Custom.pm b/Custom.pm deleted file mode 100644 index b2a0f5f..0000000 --- a/Custom.pm +++ /dev/null @@ -1,135 +0,0 @@ -package Slim::Utils::OS::Custom; - -# Custom OS file for pCP 3.5.0 https://www.picoreplayer.org -# -# This version only downloads the update link to -# /tmp/slimupdate/update_url -# -# Revision 1.1 -# 2017-04-16 Removed /proc from a music path -# -# Revision 1.2 -# 2017-08-14 Added Manual Plugin directory at Cache/Plugins - - -use strict; -use warnings; - -use base qw(Slim::Utils::OS::Linux); - -use File::Spec::Functions qw(catdir); - -use constant MAX_LOGSIZE => 1024*1024*1; # maximum log size: 1 MB -use constant UPDATE_DIR => '/tmp/slimupdate'; - -sub initDetails { - my $class = shift; - - $class->{osDetails} = $class->SUPER::initDetails(); - $class->{osDetails}->{osName} = 'piCore'; - - return $class->{osDetails}; -} - -sub getSystemLanguage { 'EN' } - -sub localeDetails { - my $lc_ctype = 'utf8'; - my $lc_time = 'C'; - - return ($lc_ctype, $lc_time); -} - -=head2 dirsFor( $dir ) - -Return OS Specific directories. - -Argument $dir is a string to indicate which of the server directories we -need information for. - -=cut - -sub dirsFor { - my ($class, $dir) = @_; - - my @dirs; - - if ($dir eq 'updates') { - - mkdir UPDATE_DIR unless -d UPDATE_DIR; - - @dirs = (UPDATE_DIR); - } - else { - @dirs = $class->SUPER::dirsFor($dir); - - if ($dir eq "Plugins") { - push @dirs, catdir( Slim::Utils::Prefs::preferences('server')->get('cachedir'), 'Plugins' ); - unshift @INC, catdir( Slim::Utils::Prefs::preferences('server')->get('cachedir') ); - } - } - - return wantarray() ? @dirs : $dirs[0]; -} - -sub canAutoUpdate { 1 } -sub installerExtension { 'tcz' } -sub installerOS { 'pcp' } - -sub getUpdateParams { - my ($class, $url) = @_; - - if ($url) { - require File::Slurp; - - my $updateFile = UPDATE_DIR . '/update_url'; - - if ( File::Slurp::write_file($updateFile, $url) ) { - main::INFOLOG && Slim::Utils::Log::logger('server.update')->info("Setting update url file to: $url"); - } - else { - Slim::Utils::Log::logger('server.update')->warn("Unable to update version file: $updateFile"); - } - - } - - return { - cb => sub { - my ($file) = @_; - - if ($file) { - my ($version, $revision) = $file =~ /(\d+\.\d+\.\d+)(?:.*?(\d{5,}))?/; - $revision ||= 0; - $::newVersion = Slim::Utils::Strings::string('PICORE_UPDATE_AVAILABLE', "$version - $revision", $file); - } - } - }; -} - -sub logRotate { - # only keep small log files (1MB) because they are in RAM - Slim::Utils::OS->logRotate($_[1], MAX_LOGSIZE); -} - -sub ignoredItems { - return ( - 'bin' => '/', - 'dev' => '/', - 'etc' => '/', - 'opt' => '/', - 'init' => '/', - 'root' => '/', - 'sbin' => '/', - 'tmp' => '/', - 'var' => '/', - 'lib' => '/', - 'run' => '/', - 'sys' => '/', - 'usr' => '/', - 'proc' => '/', - 'lost+found'=> 1, - ); -} - -1; - diff --git a/custom-strings.txt b/custom-strings.txt deleted file mode 100644 index 2fba044..0000000 --- a/custom-strings.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Custom String File for piCore and piCorePlayer. -# -# Release 1.0 -# -PICORE_UPDATE_AVAILABLE - DE Eine neue Version von Lyrion Music Server ist verfügbar (%s). Klicken Sie hier für weitere Instruktionen. - EN A new version of Lyrion Music Server is available (%s). Click here for further information. - FR Une nouvelle version de Lyrion Music Server est disponible (%s). Cliquez ici pour plus d'info. - NL Er is een nieuwe versie van Lyrion Music Server beschikbaar (%s). Klik op hier. - NO En ny versjon av Lyrion Music Server er tilgjengelig (%s). Klikk her for å få mer informasjon. - PL Nowa wersja Lyrion Music Server jest dostępna (%s). Kliknij tutaj w celu uzyskania dodatkowej wiadomości. - \ No newline at end of file diff --git a/picore-update.html b/picore-update.html deleted file mode 100644 index f955813..0000000 --- a/picore-update.html +++ /dev/null @@ -1,34 +0,0 @@ -[%# Helper web page for piCore and piCorePlayer with instructions as to how to - update slimserver. - - Revision 1.2 -%] - -[% pagetitle = 'How to update your Lyrion Music Server on your piCore system' %] -[% PROCESS helpheader.html %] -[% extension = installerFile.match('\.(tcz)$'); -IF extension; - distro = extension.0; -END; -%] -
On piCore distributions we provide script to download and Update Lyrion Music Server. -These will update your local copy of LMS to the latest source code.
- -
The download URL for your Lyrion Music Server has set to the latest installer:
- -[% installerFile %]- -
Please execute the following steps to bring your Lyrion Music Server installation up to date:
- -sudo [% distro == 'tcz' ? 'lms-update.sh -r ' : 'Error' %] For users of piCorePlayer please use -
- -[% PROCESS helpfooter.html %] From b3ce1fdd838b4ac7c812fe6f0507a42517627267 Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Sat, 29 Mar 2025 11:18:23 -0400 Subject: [PATCH 05/12] Change to prebuilt_tcz branch for getting new scripts. Remove downloading custom files, as these are now directly in the tcz. Fix regenerating md5, it was already downloaded/checked earlier. --- lms-update.sh | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/lms-update.sh b/lms-update.sh index e222dbd..55722aa 100755 --- a/lms-update.sh +++ b/lms-update.sh @@ -21,7 +21,7 @@ LMS_DIR="/usr/local/slimserver/Cache/updates" UPDATELINK="${DL_DIR}/update_url" SCRIPT=$(readlink -f $0) NEWARGS="${@}" -GIT_REPO="https://raw.githubusercontent.com/piCorePlayer/lms-update-script/Master" +GIT_REPO="https://raw.githubusercontent.com/piCorePlayer/lms-update-script/prebuilt_tcz" RELEASE="" FORCE=0 [ -d ${DL_DIR} ] || mkdir -p ${DL_DIR} @@ -133,20 +133,6 @@ if [ -z "$RESUME" ]; then fi fi -if [ "$SKIPUPDATE" != "1" ]; then - echo "${GREEN}Updateing Slimserver customizations from Github..." - FILES="custom-strings.txt picore-update.html Custom.pm slimserver" - for F in $FILES - do - rm -f ${DL_DIR}/${F} - wget -O ${DL_DIR}/${F} ${GIT_REPO}/${F} - if [ "$?" != "0" ]; then - echo "${RED}Download FAILED......Please Check or Relauch script with with -s option!${NORMAL}" - exit 1 - fi - done -fi - if [ -z "$MANUAL" ]; then #Not running with manual options, look for URL saved from LMS if [ -f "${UPDATELINK}" ]; then @@ -304,9 +290,8 @@ if [ -z "$TEST" ]; then fi rm -f /usr/local/tce.installed/slimserver echo "${GREEN}Moving new Extension to $TCEDIR/optional${NORMAL}" - md5sum /tmp/slimserver.tcz > $TCEDIR/optional/slimserver.tcz.md5.txt - sed -i 's|/tmp/||' $TCEDIR/optional/slimserver.tcz.md5.txt mv -f /tmp/slimserver.tcz $TCEDIR/optional + mv -f /tmp/slimserver.tcz.md5.txt $TCEDIR/optional chown tc.staff $TCEDIR/optional/slimserver.tcz* echo echo "${GREEN}Syncing filesystems${NORMAL}" @@ -329,8 +314,8 @@ if [ -z "$TEST" ]; then else echo "${GREEN}Moving new Extension to $TCEDIR/optional${NORMAL}" md5sum /tmp/slimserver.tcz > $TCEDIR/optional/slimserver.tcz.md5.txt - sed -i 's|/tmp/||' $TCEDIR/optional/slimserver.tcz.md5.txt mv -f /tmp/slimserver.tcz $TCEDIR/optional + mv -f /tmp/slimserver.tcz.md5.txt $TCEDIR/optional chown tc.staff $TCEDIR/optional/slimserver.tcz* echo echo "${GREEN}Syncing filesystems${NORMAL}" @@ -339,8 +324,6 @@ if [ -z "$TEST" ]; then echo "${BLUE}Extension copied and will be loaded on next reboot${NORMAL}" fi else - md5sum /tmp/slimserver.tcz > /tmp/slimserver.tcz.md5.txt - sed -i 's|/tmp/||' /tmp/slimserver.tcz.md5.txt echo echo -e "${BLUE}Done, the new extension was left at /tmp/slimserver.tcz" echo From 45442adc7b189c4ae83f5b35600928084e03ac71 Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Sun, 30 Mar 2025 13:06:28 -0400 Subject: [PATCH 06/12] Create new md5.txt from xml data when downloading tcz. --- lms-update.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lms-update.sh b/lms-update.sh index 55722aa..a1c0082 100755 --- a/lms-update.sh +++ b/lms-update.sh @@ -158,10 +158,6 @@ else sed -E -i 's/>/>\n/g' $tmp while read line; do - echo $line | grep -q nocpan - if [ $? -eq 0 ]; then - UPDPKG=$(echo $line) - fi echo $line | grep -q pcp if [ $? -eq 0 ]; then UPDPKG=$(echo $line) @@ -227,7 +223,7 @@ fi #Check for extension packages already downloaded PKG=$(ls -1 ${DL_DIR}/lyrionmusicserver*.tcz 2>/dev/null) if [ "$PKG" = "" ]; then - rm -f $DL_DIR/*.t?z + rm -f $DL_DIR/*.tcz* wget -P $DL_DIR $LINK if [ "$?" != "0" ]; then echo "${RED}Download FAILED...... exiting!${NORMAL}" @@ -235,9 +231,9 @@ if [ "$PKG" = "" ]; then exit 1 fi FILENAME="$(echo $NEW_URL | awk -F'/' '{ print $NF }')" - echo "$NEW_MD5 $FILENAME" > ${DL_DIR}/$FILENAME + echo "$NEW_MD5 $FILENAME" > ${DL_DIR}/${FILENAME}.md5.txt - NEWUPDATE=`find ${DL_DIR} -name "*.t?z"` + NEWUPDATE=`find ${DL_DIR} -name "*.tcz"` if [ -z $NEWUPDATE ]; then echo "${BLUE}No Update Found, please make sure Automatic updates and Automatic Downloads are enable in LMS.${NORMAL}" echo @@ -245,7 +241,7 @@ if [ "$PKG" = "" ]; then fi fi -#This package was manually downloaded +#This package may have been manually downloaded. Check MD5 PKG=$(ls -1 $DL_DIR/lyrionmusicserver*.tcz 2>/dev/null) if [ "$PKG" != "" ]; then mv ${DL_DIR}/lyrionmusicserver*.tcz /tmp/slimserver.tcz @@ -283,7 +279,7 @@ if [ -z "$TEST" ]; then if [ -z "$REBOOT" ]; then echo "${GREEN}Unmounting Extension${NORMAL}" umount -d -f /tmp/tcloop/slimserver - if [ "$?" != "0" ]; then + if [ "$?" != "0" ]; then echo "${RED}Unmounting Filesystem failed......extension will be replaced, but reboot is requried${NORMAL}" REBOOT=1 fi From a8bdff352862d3a7367d8746425a26f1e4f7cb06 Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Sun, 30 Mar 2025 14:15:44 -0400 Subject: [PATCH 07/12] Convert from noCPAN.tgz to tcz package. --- lms-update.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lms-update.sh b/lms-update.sh index a1c0082..a4238bc 100755 --- a/lms-update.sh +++ b/lms-update.sh @@ -220,10 +220,40 @@ else echo "${GREEN}Updating from ${LINK}" fi +function get_tcz_link() { + echo "" + echo "Converting from noCPAN build to direct LMS build...." + NEW_URL=$(echo $1 | sed 's/-noCPAN\.tgz/\.tcz/') + rm -f ${DL_DIR}/*.json + echo "Retreiving complete server package listing....${BLUE}" + wget -P "${DL_DIR}" "https://lms-community.github.io/lms-server-repository/servers.json" + echo "${GREEN}Finding new package and checksum...." + PARSEMD5=$(cat ${DL_DIR}/servers.json | JSON.awk - | grep "$NEW_URL" | awk '{print $1}' | sed 's/url/md5/' | sed 's/\[//' | sed 's/\]//') + NEW_MD5=$(eval echo $(cat ${DL_DIR}/servers.json | JSON.awk - | grep "$PARSEMD5" | awk '{print $2}')) + LINK="$NEW_URL" + echo "" + echo "${GREEN}New Update link: $LINK" + echo "Checksum of the new package: $NEW_MD5" + echo "" +} + #Check for extension packages already downloaded PKG=$(ls -1 ${DL_DIR}/lyrionmusicserver*.tcz 2>/dev/null) if [ "$PKG" = "" ]; then rm -f $DL_DIR/*.tcz* + case "$LINK" in + *.tgz) + NEW_URL="" + NEW_MD5="" + get_tcz_link $LINK + if [ "$NEW_URL" = "" -o "$NEW_MD5" = "" ]; then + echo "${RED}Error finding new Lyrion extension from servers. Please try again." + exit 1 + fi + ;; + *);; + esac + wget -P $DL_DIR $LINK if [ "$?" != "0" ]; then echo "${RED}Download FAILED...... exiting!${NORMAL}" @@ -258,6 +288,8 @@ fi REBOOT="" if [ -z "$TEST" ]; then if [ -n "$RELOAD" ]; then + echo "" + echo "${BLUE}New Server extension downloaded and tested..." echo "${BLUE}Ready to Reload LMS, Press Enter to Continue${NORMAL}" [ -z "$UNATTENDED" ] && read key echo "${GREEN}Stopping LMS" From 1ad6cd5c4692c04574481b9eed724c39b6d67381 Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Mon, 31 Mar 2025 19:20:20 -0400 Subject: [PATCH 08/12] There could be extra md5 files floating around, use the one that matches the tcz --- lms-update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lms-update.sh b/lms-update.sh index a4238bc..a715cb7 100755 --- a/lms-update.sh +++ b/lms-update.sh @@ -274,8 +274,8 @@ fi #This package may have been manually downloaded. Check MD5 PKG=$(ls -1 $DL_DIR/lyrionmusicserver*.tcz 2>/dev/null) if [ "$PKG" != "" ]; then - mv ${DL_DIR}/lyrionmusicserver*.tcz /tmp/slimserver.tcz - mv ${DL_DIR}/lyrionmusicserver*.tcz.md5.txt /tmp/slimserver.tcz.md5.txt + mv ${PKG} /tmp/slimserver.tcz + mv ${PKG}.md5.txt /tmp/slimserver.tcz.md5.txt sed -i 's/lyrionmusicserver-.*/slimserver.tcz/' /tmp/slimserver.tcz.md5.txt cd /tmp md5sum -cs slimserver.tcz.md5.txt From a38e89c07e751964cc9dc41c340a5d0ea641feeb Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Mon, 31 Mar 2025 19:31:39 -0400 Subject: [PATCH 09/12] Remove old file links that could conflict with new builtin support --- lms-update.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lms-update.sh b/lms-update.sh index a715cb7..93534f0 100755 --- a/lms-update.sh +++ b/lms-update.sh @@ -325,6 +325,9 @@ if [ -z "$TEST" ]; then echo "${GREEN}Syncing filesystems${NORMAL}" sync if [ -z "$REBOOT" ]; then + #Remove old file links. + rm -f /usr/local/slimserver/custom-strings.txt + rm -f /usr/local/slimserver/Slim/Utils/OS/Custom.pm echo "${GREEN}Loading new Extension${NORMAL}" su - tc -c "tce-load -li slimserver.tcz" if [ "$?" != "0" ]; then From d8cd2dddda6e370515501508f3f78e06ea221933 Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Wed, 2 Apr 2025 19:23:18 -0400 Subject: [PATCH 10/12] Add some comments to the script --- lms-update.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lms-update.sh b/lms-update.sh index 93534f0..a7099db 100755 --- a/lms-update.sh +++ b/lms-update.sh @@ -15,8 +15,9 @@ checkroot TCEDIR=$(readlink "/etc/sysconfig/tcedir") DL_DIR="/tmp/slimupdate" -# Future -LMS_DIR="/usr/local/slimserver/Cache/updates" +# This is the default donwload location, currently overriden in pCP.pm +# The pCP web interface currently uses DL_DIR/update_url to determine if an update is needed +# LMS_DIR="/usr/local/slimserver/Cache/updates" # UPDATELINK="${DL_DIR}/update_url" SCRIPT=$(readlink -f $0) @@ -91,7 +92,7 @@ if [ -z "$RESUME" ]; then [ -z "$UNATTENDED" ] && read key if [ "$SKIPUPDATE" != "1" ]; then - #Check for depednancy of openssl for wget to work with https:// + # Check for depednancy of openssl for wget to work with https:// if [ ! -x /usr/local/bin/openssl ]; then if [ ! -f $TCEDIR/optional/openssl.tcz ]; then echo "${GREEN} Downloading required extension openssl.tcz${NORMAL}" @@ -141,6 +142,7 @@ if [ -z "$MANUAL" ]; then LINK="0" fi else + # This will download the branch xml file to determine the current version VERSION=$(fgrep "our \$VERSION" /usr/local/slimserver/slimserver.pl | cut -d"'" -f2) REVISION=$(head -n 1 /usr/local/slimserver/revision.txt) echo "${YELLOW}Current Version is: $VERSION r${REVISION}.${NORMAL}" @@ -237,10 +239,11 @@ function get_tcz_link() { echo "" } -#Check for extension packages already downloaded +# Check for extension packages already downloaded PKG=$(ls -1 ${DL_DIR}/lyrionmusicserver*.tcz 2>/dev/null) if [ "$PKG" = "" ]; then rm -f $DL_DIR/*.tcz* + # Check for file extension in link, if it is a tgz, it needs converted to tcz case "$LINK" in *.tgz) NEW_URL="" @@ -271,7 +274,8 @@ if [ "$PKG" = "" ]; then fi fi -#This package may have been manually downloaded. Check MD5 +# LMS checks md5 when downloading automatically, but if this is a manual check, then the md5 needs checked +# so just check the md5. PKG=$(ls -1 $DL_DIR/lyrionmusicserver*.tcz 2>/dev/null) if [ "$PKG" != "" ]; then mv ${PKG} /tmp/slimserver.tcz @@ -325,7 +329,7 @@ if [ -z "$TEST" ]; then echo "${GREEN}Syncing filesystems${NORMAL}" sync if [ -z "$REBOOT" ]; then - #Remove old file links. + # Make sure Custom.pm is removed, pCP has direct support in the downloaded extension rm -f /usr/local/slimserver/custom-strings.txt rm -f /usr/local/slimserver/Slim/Utils/OS/Custom.pm echo "${GREEN}Loading new Extension${NORMAL}" @@ -366,9 +370,7 @@ echo if [ -z "$DEBUG" ]; then echo -e "${GREEN}Deleting the temp folders" - rm -rf $BUILD_DIR - rm -rf $SRC_DIR - #Erase Downloaded Files + # Remove Downloaded Files rm -f ${DL_DIR}/* fi From 787bd0bdcc453785851befa56227eb51d1ca6c39 Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Tue, 8 Apr 2025 20:15:46 -0400 Subject: [PATCH 11/12] Allow switching back to release/stable branch, and use CPAN method to upgrade. --- lms-update.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lms-update.sh b/lms-update.sh index a7099db..c47957f 100755 --- a/lms-update.sh +++ b/lms-update.sh @@ -69,6 +69,27 @@ while true; do shift done +VERSION=$(fgrep "our \$VERSION" /usr/local/slimserver/slimserver.pl | cut -d"'" -f2) +if [ "$RELEASE" = "release" -o "$RELEASE" = "stable" ]; then + # An manual update is occuring, but those branches still use the CPAN update method. + GIT_REPO="https://raw.githubusercontent.com/piCorePlayer/lms-update-script/Master" + echo "${BLUE}********************************************************" + echo "${BLUE}Updating Script for use CPAN method..." + echo "${BLUE}********************************************************" + F="lms-update.sh" + rm -f ${DL_DIR}/new-${F} + wget -O ${DL_DIR}/new-${F} ${GIT_REPO}/${F} + if [ "$?" != "0" ]; then + echo "${RED}Download FAILED......Please Check or Relauch script with with -s option!${NORMAL}" + exit 1 + fi + echo "${GREEN}Relaunching Script in 3 seconds${NORMAL}" + chmod 755 ${DL_DIR}/new-${F} + sleep 3 + set -- "--sss" $NEWARGS + exec /bin/sh ${DL_DIR}/new-${F} "${@}" +fi + if [ -z "$RESUME" ]; then echo From ef549df05e655aa915a5a657ca9cc0843d55b6b3 Mon Sep 17 00:00:00 2001 From: paul-1 <6473457+paul-1@users.noreply.github.com> Date: Fri, 16 Jan 2026 23:20:45 -0500 Subject: [PATCH 12/12] Stable Branch is now using the the buildin pCP support. --- lms-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms-update.sh b/lms-update.sh index c47957f..1e09751 100755 --- a/lms-update.sh +++ b/lms-update.sh @@ -70,7 +70,7 @@ while true; do done VERSION=$(fgrep "our \$VERSION" /usr/local/slimserver/slimserver.pl | cut -d"'" -f2) -if [ "$RELEASE" = "release" -o "$RELEASE" = "stable" ]; then +if [ "$RELEASE" = "release" ]; then # An manual update is occuring, but those branches still use the CPAN update method. GIT_REPO="https://raw.githubusercontent.com/piCorePlayer/lms-update-script/Master" echo "${BLUE}********************************************************"