[Script] upgrade madsonic on debian linux

Madsonic Mashup Mod is a fork of the Subsonic 4.7 Server Build 3090 with some Subsonic Data schema modifications!

Moderator: moderators

[Script] upgrade madsonic on debian linux

Postby jonnymnemo » Tue Oct 09, 2012 10:02 pm

I previously put this post in the old thread, but now that it is possible to separate the topics, I post it again. :wink:

Some users seem to have problems to upgrade madsonic (from subsonic or a previous madsonic version), especially if it is a .war package.
To help some of them, I made a bash script for updating to the latest madsonic version.
My script works in ubuntu, but it could work for other distros.

Features :
- backup of the /var/subsonic folder in /var/subsonicYYMMDDhhmm
- java 7 install (with package list update and upgrade)
- madsonic .deb install
- madsonic .war update
- each feature is optionnal

Here is the code :
Code: Select all
#!/bin/bash
echo "######Madsonic update utility######"
echo "This script works for ubuntu"
echo "You should be in root mode for it to work"
echo "Yes or no questions are in capital : Y or N"

# Stop subsonic deamon

echo "First, we stop subsonic deamon"
service subsonic stop

# Prompt for backup
echo "Do you want to backup your subsonic folder before continuing ? IT IS HIGHLY RECOMMENDED !!!!! (default=Y) (Y/N)"
read reply
if [ "$reply" = N ]
   then    echo "OK OK, but don't complain then..."
   else   echo "Your subsonic database (only the /var/subsonic folder) will be saved in /var/subsonicYYMMDDhhmm"
      cp -R /var/subsonic /var/subsonic"$(date +%y%m%d%k%M)"

fi

# This part makes sure java 7 is installed
echo "Your java version is :"
java -version
echo "Java 7 is needed for madsonic (your version number should be starting with 1.7). If you can't install it, make sure to install a madsonic compatible edition (SE), and answer yes to the next question."

echo "Do you hava java 7 installed ? (default=Y) (Y/N)"
read reply
if [ "$reply" = "N" ]

# Package list update
   then    apt-get update

# Prompt for package upgrades
   echo "Before installing java, do you want to upgrade your packages ? (default=Y) (Y/N)"
   read reply
   if [ "$reply" = "N" ]
      then echo "Ok, skipping package upgrade !"
      else apt-get upgrade
   fi

# Java installation

   apt-get install openjdk-7-jre
   else    echo "Ok, we skip the java install..."
fi


# Prompt for debian madsonic
echo "Do you have the latest madsonic DEBIAN package ? (default=Y) (Y/N) "
read reply

if [ "$reply" = "N" ]
   then

# This part installs the madsonic .deb package
      echo "paste the link to the madsonic deb package"
      read deblink
      echo "which build number ?"
      read debno
      wget "$deblink" -O madsonic"$debno".deb
      dpkg -i madsonic"$debno".deb

   else echo "Ok, we skip the debian package install..." 
fi

# This part makes sure this is the latest version of madsonic

echo "Is your madsonic the latest version ? (default=Y) (Y/N)"
read reply

if [ "$reply" = "N" ]
   then
   echo "Make sure you installed a .deb package before, because the war packages doesn't contain everything !!!!!"
   echo "Are you sure you want to install the latest .war package ? (default=N) (Y/N)"
   read reply
   if [ "$reply" = "Y" ]
      then

# This part updates madsonic with the latest war package
         echo "Paste the link to the madsonic war package"
         read madlink
         echo "Which build number is it?"
         read buildno
         wget "$madlink" -O madsonic"$buildno".zip
         unzip -o madsonic"$buildno".zip -d /usr/share/subsonic
         chmod +x /usr/share/subsonic/*
         else echo "Ok, we skip the .war update..."
   fi
   else echo "Ok, we skip the .war update..."

fi

# Start subsonic deamon
echo "Madsonic starting again..."
service subsonic start

echo "Thank you for installing madsonic !"

exit



Link to download : http://dl.free.fr/mru6yayUZ

INSTRUCTIONS :
- copy this file to any folder
- start the script with sudo :
Code: Select all
sudo sh madsonicupdate.sh


If you have any suggestions to make it better, don't hesitate ! :wink:
Last edited by jonnymnemo on Mon Oct 15, 2012 12:20 pm, edited 1 time in total.
User avatar
jonnymnemo
 
Posts: 70
Joined: Thu Apr 12, 2012 8:11 am

Re: [Script] upgrade madsonic on linux

Postby gurutech » Fri Oct 12, 2012 4:13 am

Not a suggestion on code changes per se, but will this script work to upgrade an installation on a Fedora (*.rpm) version of Linux?
Image
gurutech
 
Posts: 492
Joined: Sun Jan 15, 2012 9:56 pm

Re: [Script] upgrade madsonic on linux

Postby jonnymnemo » Fri Oct 12, 2012 6:27 pm

gurutech wrote:Not a suggestion on code changes per se, but will this script work to upgrade an installation on a Fedora (*.rpm) version of Linux?


No, it won't, only debian, sorry.
If somebody would like to transpose it to fedora, there shouldn't be a lot of lines to change. :wink:
User avatar
jonnymnemo
 
Posts: 70
Joined: Thu Apr 12, 2012 8:11 am

Re: [Script] upgrade madsonic on linux

Postby gurutech » Mon Oct 15, 2012 1:32 am

The line in your script where you install a new .deb version - is that something that is mandatory, or is just the .WAR update sufficient? I can do the WAR update part manually, but the .deb part won't work for me, and I don't know where to get a .rpm version for my version of Linux.

Trying to figure out if the .war update will automatically update to the latest version...
Image
gurutech
 
Posts: 492
Joined: Sun Jan 15, 2012 9:56 pm

Re: [Script] upgrade madsonic on linux

Postby jonnymnemo » Mon Oct 15, 2012 10:58 am

gurutech wrote:The line in your script where you install a new .deb version - is that something that is mandatory, or is just the .WAR update sufficient? I can do the WAR update part manually, but the .deb part won't work for me, and I don't know where to get a .rpm version for my version of Linux.

Trying to figure out if the .war update will automatically update to the latest version...


.deb is for debian linux. That's why it won't work on fedora.

Although, I think the method is similar :
- install the latest .rpm package
- then, upgrade to the latest .war package

The WAR update is only a partial update, all the files are not included (transcode, subsonic.sh,...). That's why you have to update to the latest rpm before.

Have you checked this page on how to install subsonic on fedora ?
http://www.subsonic.org/pages/installation.jsp#rpm
User avatar
jonnymnemo
 
Posts: 70
Joined: Thu Apr 12, 2012 8:11 am

Re: [Script] upgrade madsonic on debian linux

Postby gurutech » Tue Oct 16, 2012 2:22 am

I must be overthinking this, but here's how I see it:

The WAR update will overwrite files under /usr/share/subsonic
The RPM (or DEB) install will create the files located in the "Jetty" folder path, which includes the login.jsp, etc...

If I upgrade using only the WAR file, I would still keep the "jetty" files as they are, which are currently (for me) under a 3112 folder.

Does the WAR update reinstall everything under 3112 with the latest version (aka 3152 or whatever it is now?) Or does it delete that folder and create a "new" 3152 folder?

I know it won't touch anything under my "web" (/var/www/html) folder, but I have a modified login.jsp file (with an almost complete facebook login/registration component!) that I don't want to lose. I do have a backup, but I'm just being overprotective... lol
Image
gurutech
 
Posts: 492
Joined: Sun Jan 15, 2012 9:56 pm

Re: [Script] upgrade madsonic on debian linux

Postby jonnymnemo » Tue Oct 16, 2012 8:34 am

Neither .war nor .deb (or .rpm) install will directly modify your jetty folder, but it will always change. :lol:

The deb (or rpm) folder contains :
Code: Select all
usr/share/subsonic/subsonic-booter-jar-with-dependencies.jar
usr/share/subsonic/subsonic.sh
usr/share/subsonic/subsonic.war

var/subsonic/transcode/ffmpeg
var/subsonic/transcode/lame

etc/init.d/subsonic
etc/default/subsonic  (with the .rpm package, it is etc/sysconfig)

The war folder contains the files in /usr/share/subsonic

The jetty folder is created from the files in /usr/share/subsonic.

So, actually, with a new build (from a .war or .deb or .rpm), a new jetty folder (with the build number) will ALWAYS be created.
The old jetty folder will be deleted, (except from a .war update, but don't count on that), so don't forget to backup your modified files.
Then, you just have to replace your modified login.jsp, if it was inside the jetty folder.
User avatar
jonnymnemo
 
Posts: 70
Joined: Thu Apr 12, 2012 8:11 am


Return to Madsonic

Who is online

Users browsing this forum: No registered users and 15 guests