[Script] upgrade madsonic on debian linux

Scripts for Madsonic

[Script] upgrade madsonic on debian linux

Unread postby Madevil » 10 Dec 2012, 04:41

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 434 times


INSTRUCTIONS :
- copy this file to any folder
- start the script with sudo :

Code: Select all
sudo sh madsonicupdate.sh
User avatar
Madevil
Administrator
Administrator
 
Posts: 911
Joined: 07 Dec 2012, 03:58
Has thanked: 1323 times
Been thanked: 951 times

Re: [Script] upgrade madsonic on debian linux

Unread postby uploadsucks » 19 Feb 2013, 04:47

Doesn't exist anymore.
uploadsucks
 
Posts: 6
Joined: 10 Feb 2013, 07:23
Has thanked: 0 time
Been thanked: 0 time

Re: [Script] upgrade madsonic on debian linux

Unread postby jonnymnemo » 06 Mar 2013, 11:31

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 !
jonnymnemo
Contributor
Contributor
 
Posts: 27
Joined: 13 Dec 2012, 14:04
Has thanked: 5 times
Been thanked: 7 times

Re: [Script] upgrade madsonic on debian linux

Unread postby gurutech » 06 Mar 2013, 19:30

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)
gurutech
Contributor
Contributor
 
Posts: 323
Joined: 02 Jan 2013, 04:56
Has thanked: 12 times
Been thanked: 130 times

Re: [Script] upgrade madsonic on debian linux

Unread postby Madevil » 06 Mar 2013, 23:27

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
User avatar
Madevil
Administrator
Administrator
 
Posts: 911
Joined: 07 Dec 2012, 03:58
Has thanked: 1323 times
Been thanked: 951 times


Return to Scripts

Who is online

Users browsing this forum: No registered users and 1 guest