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.
- 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
- copy this file to any folder
- start the script with sudo :
Code: Select all
sudo sh madsonicupdate.sh