[Script] upgrade madsonic on debian linux

Scripts for Madsonic
User avatar
Madsonic
Administrator
Administrator
Posts: 984
Joined: 07 Dec 2012, 03:58
Answers: 7
Has thanked: 1201 times
Been thanked: 470 times

[Script] upgrade madsonic on debian linux

Unread post by Madsonic »

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
UPDATE:
madsonicupdate.sh
(2.76 KiB) Downloaded 644 times
INSTRUCTIONS :
- copy this file to any folder
- start the script with sudo :

Code: Select all

sudo sh madsonicupdate.sh
These users thanked the author Madsonic for the post:
admin
Rating: 7.69%
uploadsucks
Posts: 6
Joined: 10 Feb 2013, 07:23
Has thanked: 0
Been thanked: 0

Re: [Script] upgrade madsonic on debian linux

Unread post by uploadsucks »

Doesn't exist anymore.
jonnymnemo
Contributor
Contributor
Posts: 26
Joined: 13 Dec 2012, 14:04
Has thanked: 3 times
Been thanked: 6 times

Re: [Script] upgrade madsonic on debian linux

Unread post by jonnymnemo »

Here it is (the previous link had a 30days validity, same for this one). http://dl.free.fr/gdUkFU6VD

Madsonic, could you upload it on your website please ? (we can't upload a .sh file as an attachment)

Anyways, you can always copy paste the code in a text file and name it madsonic.sh !
gurutech
Contributor
Contributor
Posts: 323
Joined: 02 Jan 2013, 04:56
Has thanked: 11 times
Been thanked: 105 times

Re: [Script] upgrade madsonic on debian linux

Unread post by gurutech »

Why not upload as a .TXT file (filename.sh.txt) and instruct the downloader to save then rename to .sh ?

I do that all the time with EXE files for customers (and even they understand... lol)
User avatar
Madsonic
Administrator
Administrator
Posts: 984
Joined: 07 Dec 2012, 03:58
Answers: 7
Has thanked: 1201 times
Been thanked: 470 times

Re: [Script] upgrade madsonic on debian linux

Unread post by Madsonic »

jonnymnemo wrote:Here it is (the previous link had a 30days validity, same for this one). http://dl.free.fr/gdUkFU6VD

Madsonic, could you upload it on your website please ? (we can't upload a .sh file as an attachment)
Anyways, you can always copy paste the code in a text file and name it madsonic.sh !
Hi, i Upload the script to the thread.

best regards
Post Reply