Auto Install for Linux (ubuntu/mint)

For help and support with Universal Media Server
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
Post Reply
douglasanpa
Posts: 2
Joined: Tue Jun 10, 2014 6:56 am

Auto Install for Linux (ubuntu/mint)

Post by douglasanpa »

I created a script to install the UMS, I'm sharing it here, maybe someone can help

You can choose to use the UMSBuilder or packages ready and want to install the alphas or not

The script takes the newest version found in http://www.universalmediaserver.com/news

The script now also adds to boot linux as tips found here in the forum even

To configure the boot UMS start as root (sudo /usr/ums/UMS.sh)

I only tested it on Ubuntu and Mint do not know if it works in other distros

as'm from Brazil and I hardly know English all my translations were made by google translator so may be bad

Hope this helps someone

Code: Select all

#!/bin/bash
function pause(){
   read -p "$*"
}

sudo echo "Teste de SUDO" | clear
echo Installing dialog...
sudo apt-get install dialog -y --force-yes  > /dev/null 2>&1
dialog --title 'Aguarde' --infobox '\nInstalling the dependencies UniversalMediaServer...' 0 0
sudo apt-get install ttf-ubuntu-font-family -y --force-yes  > /dev/null 2>&1
sudo apt-get install ttf-ubuntu-title  -y --force-yes  > /dev/null 2>&1
sudo apt-get install mencoder  -y --force-yes  > /dev/null 2>&1
sudo apt-get install ffmpeg -y --force-yes  > /dev/null 2>&1
sudo apt-get install mplayer -y --force-yes  > /dev/null 2>&1
sudo apt-get install vlc -y --force-yes  > /dev/null 2>&1
sudo apt-get install mediainfo -y --force-yes  > /dev/null 2>&1
sudo apt-get install w3m -y --force-yes  > /dev/null 2>&1
sudo apt-get install curl -y --force-yes  > /dev/null 2>&1
sudo rm -rf /usr/ums
pasta=${PWD}
dialog --stdout --defaultno --yesno 'Want to make a new Build the UniversalMediaServer?' 0 0
compileUMS=$?
	if [ "$compileUMS" == "0" ]; then 
	dialog --title 'Aguarde' --infobox '\nCreating a new Build the UniversalMediaServer (will take a long time).' 0 0
	BuilderUMS=$( curl -s -b "a=b" "http://www.universalmediaserver.com/news/" | w3m -dump -T text/html | grep UMSBuilder -F | cut -d ' ' -f 3 | grep -v "a" | sed -n 1p )
	cd /tmp
	rm -rf /tmp/UMSBuilder*
	wget "http://downloads.sourceforge.net/project/unimediaserver/Official%20Releases/Linux/UMSBuilder-$BuilderUMS.tgz" -O UMSBuilder.tgz  > /dev/null 2>&1
	mkdir /tmp/UMSBuilder && tar xvf UMSBuilder.tgz -C /tmp/UMSBuilder --strip-components=1  >/dev/null 2>&1
	cd UMSBuilder
	sudo mkdir /usr/ums
	sudo bash -c "./build.sh >/dev/null 2>&1 && tar xvf ums*distribution.tar.gz -C /usr/ums --strip-components=1 >/dev/null 2>&1"
	sudo echo "Teste de SUDO" | clear
else
	dialog --title 'Aguarde' --infobox '\nInstalling UniversalMediaServer...' 0 0
	dialog --stdout --defaultno --yesno 'You will accept installation including alpha versions of UniversalMediaServer?' 0 0
	alphaUMS=$?
	if [ "$alphaUMS" == "0" ]; then 
		VersionUMS=$( curl -s -b "a=b" "http://www.universalmediaserver.com/news/" | w3m -dump -T text/html | grep Version -F | cut -d ' ' -f 3 | sed -n 1p )
	else
		VersionUMS=$( curl -s -b "a=b" "http://www.universalmediaserver.com/news/" | w3m -dump -T text/html | grep Version -F | cut -d ' ' -f 3 | grep -v "a" | sed -n 1p )
	fi
	cd /tmp	
	rm -rf /tmp/UMS*
	wget "http://downloads.sourceforge.net/project/unimediaserver/Official%20Releases/Linux/UMS-$VersionUMS.tgz" -O UMS.tgz  > /dev/null 2>&1
	sudo mkdir /usr/ums
	sudo bash -c "tar xvf UMS.tgz -C /usr/ums --strip-components=1 >/dev/null 2>&1"
fi
sudo echo "Teste de SUDO" | clear
sudo touch /etc/init.d/UMS.sh
sudo chmod 755 /etc/init.d/UMS.sh
echo '#!/bin/bash' > /tmp/UMS.sh
echo "#" >> /tmp/UMS.sh
echo "### BEGIN INIT INFO" >> /tmp/UMS.sh
echo "# Provides:          ums" >> /tmp/UMS.sh
echo "# Required-Start:    \$local_fs \$remote_fs \$network" >> /tmp/UMS.sh
echo "# Required-Stop:     \$local_fs \$remote_fs \$network" >> /tmp/UMS.sh
echo "# Default-Start:     2 3 4 5" >> /tmp/UMS.sh
echo "# Default-Stop:      0 1 6" >> /tmp/UMS.sh
echo "# Short-Description: Starts UMS program." >> /tmp/UMS.sh
echo "# Description:       Java Upnp Media Server dedicated to PS3" >> /tmp/UMS.sh
echo "### END INIT INFO" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "#set -x" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "# Author: Papa Issa DIAKHATE <[email protected]>" >> /tmp/UMS.sh
echo "#" >> /tmp/UMS.sh
echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> /tmp/UMS.sh
echo "DESC=\"Universal Media Server\"" >> /tmp/UMS.sh
echo "NAME=UMS.sh" >> /tmp/UMS.sh
echo "UMS_PROFILE=/etc/\$NAME" >> /tmp/UMS.sh
echo "DAEMON=/usr/ums/\$NAME" >> /tmp/UMS.sh
echo "DAEMON_OPTS=\"console\"" >> /tmp/UMS.sh
echo "SCRIPTNAME=/etc/init.d/\$NAME" >> /tmp/UMS.sh
echo "UMS_START=1 # Wether to start or not UMS ver at boot time." >> /tmp/UMS.sh
echo "DODTIME=30  # Time to wait for the server to die, in seconds." >> /tmp/UMS.sh
echo "            # If this value is set too low you might not" >> /tmp/UMS.sh
echo "            # let the program to die gracefully and 'restart' will not work" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "test -x \$DAEMON || exit 1" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "# Load the VERBOSE setting and other rcS variables" >> /tmp/UMS.sh
echo ". /lib/init/vars.sh" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "# Define LSB log_* functions." >> /tmp/UMS.sh
echo "# Depend on lsb-base (>= 3.0-6) to ensure that this file is present." >> /tmp/UMS.sh
echo ". /lib/lsb/init-functions" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "# Include ums defaults if available" >> /tmp/UMS.sh
echo "if [[ -f \"/etc/default/\$NAME\" ]] ; then" >> /tmp/UMS.sh
echo "        . /etc/default/\$NAME" >> /tmp/UMS.sh
echo "fi" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "# May we run the init.d script ?" >> /tmp/UMS.sh
echo "[[ \$UMS_START = 1 ]] || exit 1" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
echo "# Some color codes" >> /tmp/UMS.sh
echo "txtred=\$'\e[0;31m' # Red" >> /tmp/UMS.sh
echo "txtylw=\$'\e[0;33m' # Yellow" >> /tmp/UMS.sh
echo "txtrst=\$'\e[0m'    # Text Reset" >> /tmp/UMS.sh
echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
echo "warnout(){" >> /tmp/UMS.sh
echo "    echo >&2 -e \"\"\$txtylw\"Warning:\$txtrst \$1\"" >> /tmp/UMS.sh
echo "}" >> /tmp/UMS.sh
echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
echo "running(){" >> /tmp/UMS.sh
echo "    pid=\`pgrep -f 'java .*ums.jar.*'\`" >> /tmp/UMS.sh
echo "}" >> /tmp/UMS.sh
echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
echo "do_start(){" >> /tmp/UMS.sh
echo "    running && { warnout \"\$NAME is already running \!\"; exit 0; }" >> /tmp/UMS.sh
echo "    echo \"Starting \$DESC : \$NAME\"" >> /tmp/UMS.sh
echo "    UMS_PROFILE=\"\$UMS_PROFILE\" start-stop-daemon --start --quiet --background --oknodo \\" >> /tmp/UMS.sh
echo "        --exec \$DAEMON -- \$DAEMON_OPTS" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "}" >> /tmp/UMS.sh
echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
echo "do_stop(){" >> /tmp/UMS.sh
echo "    running || { warnout \"\$NAME is NOT running \!\"; exit 0; }   " >> /tmp/UMS.sh
echo "    local countdown=\"\$DODTIME\"" >> /tmp/UMS.sh
echo "    echo -e \"Stopping \$DESC : \$NAME \c \"" >> /tmp/UMS.sh
echo "    kill -9 \$pid" >> /tmp/UMS.sh
echo "    while running; do" >> /tmp/UMS.sh
echo "        if ((\$countdown >= 0)); then" >> /tmp/UMS.sh
echo "            sleep 1; echo -n .;" >> /tmp/UMS.sh
echo "            ((--countdown))" >> /tmp/UMS.sh
echo "        else" >> /tmp/UMS.sh
echo "            break;" >> /tmp/UMS.sh
echo "        fi" >> /tmp/UMS.sh
echo "    done" >> /tmp/UMS.sh
echo "    echo" >> /tmp/UMS.sh
echo "    # If still running, then try to send SIGINT signal" >> /tmp/UMS.sh
echo "    running && { \\" >> /tmp/UMS.sh
echo "        echo >&2 \"Using kill -s SIGINT instead\"; \\" >> /tmp/UMS.sh
echo "        echo >&2 \"If you see this message again, then you should increase the value of DODTIME in '\$0'.\"; \\" >> /tmp/UMS.sh
echo "        kill -2 \$pid; \\" >> /tmp/UMS.sh
echo "    }" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "    if [ -e \"/usr/share/ums/debug.log\" ]; then" >> /tmp/UMS.sh
echo "    count=9" >> /tmp/UMS.sh
echo "    while [ \$count -ge 1 ]" >> /tmp/UMS.sh
echo "    do" >> /tmp/UMS.sh
echo "    if [ -e \"/usr/share/ums/debug.log.\$count\" ]; then" >> /tmp/UMS.sh
echo "        plus=\$((count+1))" >> /tmp/UMS.sh
echo "        mv \"/usr/share/ums/debug.log.\$count\" \"/usr/share/ums/debug.log.\$plus\"" >> /tmp/UMS.sh
echo "    fi" >> /tmp/UMS.sh
echo "        count=\$((count-1))" >> /tmp/UMS.sh
echo "    done" >> /tmp/UMS.sh
echo "    if [ -e \"/usr/share/ums/debug.log\" ]; then" >> /tmp/UMS.sh
echo "        mv \"/usr/share/ums/debug.log\" \"/usr/share/ums/debug.log.1\"" >> /tmp/UMS.sh
echo "    fi" >> /tmp/UMS.sh
echo "    fi" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "    return 0" >> /tmp/UMS.sh
echo "}" >> /tmp/UMS.sh
echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
echo "do_force-stop(){" >> /tmp/UMS.sh
echo "    running || { warnout \"\$NAME is NOT running \!\"; exit 0; }   " >> /tmp/UMS.sh
echo "    echo \"Stopping \$DESC : \$NAME\"" >> /tmp/UMS.sh
echo "    kill -9 \$pid" >> /tmp/UMS.sh
echo "    if [ -e \"/usr/share/ums/debug.log\" ]; then" >> /tmp/UMS.sh
echo "    count=9" >> /tmp/UMS.sh
echo "    while [ \$count -ge 1 ]" >> /tmp/UMS.sh
echo "    do" >> /tmp/UMS.sh
echo "    if [ -e \"/usr/share/ums/debug.log.\$count\" ]; then" >> /tmp/UMS.sh
echo "        plus=\$((count+1))" >> /tmp/UMS.sh
echo "   mv \"/usr/share/ums/debug.log.\$count\" \"/usr/share/ums/debug.log.\$plus\"" >> /tmp/UMS.sh
echo "    fi" >> /tmp/UMS.sh
echo "       count=\$((count-1))" >> /tmp/UMS.sh
echo "    done" >> /tmp/UMS.sh
echo "    if [ -e \"/usr/share/ums/debug.log\" ]; then" >> /tmp/UMS.sh
echo "   mv \"/usr/share/ums/debug.log\" \"/usr/share/ums/debug.log.1\"" >> /tmp/UMS.sh
echo "    fi" >> /tmp/UMS.sh
echo "    fi" >> /tmp/UMS.sh
echo "}" >> /tmp/UMS.sh
echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
echo "do_status(){" >> /tmp/UMS.sh
echo "    echo -n \" * \$NAME is \"" >> /tmp/UMS.sh
echo "    ( running || { echo \"NOT running \"; exit 0; } )" >> /tmp/UMS.sh
echo "    ( running && { echo \"running (PID -> \$(echo \$pid))\"; exit 0; } )" >> /tmp/UMS.sh
echo "}" >> /tmp/UMS.sh
echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
echo "case \"\$1\" in" >> /tmp/UMS.sh
echo "" >> /tmp/UMS.sh
echo "    start|stop|force-stop|status)" >> /tmp/UMS.sh
echo "        do_\${1}" >> /tmp/UMS.sh
echo "        ;;" >> /tmp/UMS.sh
echo "    restart|reload)" >> /tmp/UMS.sh
echo "        do_stop" >> /tmp/UMS.sh
echo "        do_start" >> /tmp/UMS.sh
echo "        ;;" >> /tmp/UMS.sh
echo "    force-restart|force-reload)" >> /tmp/UMS.sh
echo "        do_force-stop" >> /tmp/UMS.sh
echo "        do_start" >> /tmp/UMS.sh
echo "        ;;" >> /tmp/UMS.sh
echo "    *)" >> /tmp/UMS.sh
echo "        echo \"Usage: \$SCRIPTNAME {start|stop|force-stop|restart|force-restart|reload|force-reload|status}\"" >> /tmp/UMS.sh
echo "        exit 1" >> /tmp/UMS.sh
echo "        ;;" >> /tmp/UMS.sh
echo "esac" >> /tmp/UMS.sh
sudo mv /tmp/UMS.sh /etc/init.d/UMS.sh

sudo mkdir /root/.config/UMS  > /dev/null 2>&1
sudo touch /root/.config/UMS/UMS.conf  > /dev/null 2>&1
sudo touch /root/.config/UMS/UMS.cred  > /dev/null 2>&1
sudo ln -s /root/.config/UMS/UMS.conf /etc/UMS.sh  > /dev/null 2>&1
sudo ln -s /root/.config/UMS/UMS.cred /etc/UMS.cred  > /dev/null 2>&1
sudo chmod +x /etc/init.d/UMS.sh  > /dev/null 2>&1
sudo update-rc.d UMS.sh defaults  > /dev/null 2>&1
cd "$pasta"
douglasanpa
Posts: 2
Joined: Tue Jun 10, 2014 6:56 am

Re: Auto Install for Linux (ubuntu/mint)

Post by douglasanpa »

I updated the script to the new standard provided by UMS

Code: Select all

    #!/bin/bash
    function pause(){
       read -p "$*"
    }

    sudo echo "Teste de SUDO" | clear
    echo Installing dialog...
    sudo apt-get install dialog -y --force-yes  > /dev/null 2>&1
    dialog --title 'Aguarde' --infobox '\nInstalling the dependencies UniversalMediaServer...' 0 0
    sudo apt-get install ttf-ubuntu-font-family -y --force-yes  > /dev/null 2>&1
    sudo apt-get install ttf-ubuntu-title  -y --force-yes  > /dev/null 2>&1
    sudo apt-get install mencoder  -y --force-yes  > /dev/null 2>&1
    sudo apt-get install ffmpeg -y --force-yes  > /dev/null 2>&1
    sudo apt-get install mplayer -y --force-yes  > /dev/null 2>&1
    sudo apt-get install vlc -y --force-yes  > /dev/null 2>&1
    sudo apt-get install mediainfo -y --force-yes  > /dev/null 2>&1
    sudo apt-get install w3m -y --force-yes  > /dev/null 2>&1
    sudo apt-get install curl -y --force-yes  > /dev/null 2>&1
    sudo rm -rf /usr/ums
    pasta=${PWD}
    dialog --stdout --defaultno --yesno 'Want to make a new Build the UniversalMediaServer?' 0 0
    compileUMS=$?
       if [ "$compileUMS" == "0" ]; then
       dialog --title 'Aguarde' --infobox '\nCreating a new Build the UniversalMediaServer (will take a long time).' 0 0
       BuilderUMS=$( curl -s -b "a=b" "http://www.universalmediaserver.com/news/" | w3m -dump -T text/html | grep UMSBuilder -F | cut -d ' ' -f 3 | grep -v "a" | sed -n 1p )
       cd /tmp
       rm -rf /tmp/UMSBuilder*
       wget "http://downloads.sourceforge.net/project/unimediaserver/Official%20Releases/Linux/UMSBuilder-$BuilderUMS.tgz" -O UMSBuilder.tgz  > /dev/null 2>&1
       mkdir /tmp/UMSBuilder && tar xvf UMSBuilder.tgz -C /tmp/UMSBuilder --strip-components=1  >/dev/null 2>&1
       cd UMSBuilder
       sudo mkdir /usr/ums
       sudo bash -c "./build.sh >/dev/null 2>&1 && tar xvf ums*distribution.tar.gz -C /usr/ums --strip-components=1 >/dev/null 2>&1"
       sudo echo "Teste de SUDO" | clear
    else
       dialog --title 'Aguarde' --infobox '\nInstalling UniversalMediaServer...' 0 0
       dialog --stdout --defaultno --yesno 'You will accept installation including alpha versions of UniversalMediaServer?' 0 0
       alphaUMS=$?
       if [ "$alphaUMS" == "0" ]; then
          VersionUMS=$( curl -s -b "a=b" "http://www.universalmediaserver.com/news/" | w3m -dump -T text/html | grep Version -F | cut -d ' ' -f 3 | sed -n 1p )
       else
          VersionUMS=$( curl -s -b "a=b" "http://www.universalmediaserver.com/news/" | w3m -dump -T text/html | grep Version -F | cut -d ' ' -f 3 | grep -v "a" | sed -n 1p )
       fi
       cd /tmp   
       rm -rf /tmp/UMS*
       javaVersion=$( java -version 2>&1 | grep version | cut -d ' ' -f 3 | cut -d '.' -f 2 )
       wget "http://downloads.sourceforge.net/project/unimediaserver/Official%20Releases/Linux/UMS-$VersionUMS.tgz" -O UMS.tgz  > /dev/null 2>&1
       if [ $? -ne 0 ]; then
          wget "http://downloads.sourceforge.net/project/unimediaserver/Official%20Releases/Linux/UMS-$VersionUMS-Java$javaVersion.tgz" -O UMS.tgz  > /dev/null 2>&1
       fi

       sudo mkdir /usr/ums
       sudo bash -c "tar xvf UMS.tgz -C /usr/ums --strip-components=1 >/dev/null 2>&1"
    fi
    sudo echo "Teste de SUDO" | clear
    sudo touch /etc/init.d/UMS.sh
    sudo chmod 755 /etc/init.d/UMS.sh
    echo '#!/bin/bash' > /tmp/UMS.sh
    echo "#" >> /tmp/UMS.sh
    echo "### BEGIN INIT INFO" >> /tmp/UMS.sh
    echo "# Provides:          ums" >> /tmp/UMS.sh
    echo "# Required-Start:    \$local_fs \$remote_fs \$network" >> /tmp/UMS.sh
    echo "# Required-Stop:     \$local_fs \$remote_fs \$network" >> /tmp/UMS.sh
    echo "# Default-Start:     2 3 4 5" >> /tmp/UMS.sh
    echo "# Default-Stop:      0 1 6" >> /tmp/UMS.sh
    echo "# Short-Description: Starts UMS program." >> /tmp/UMS.sh
    echo "# Description:       Java Upnp Media Server dedicated to PS3" >> /tmp/UMS.sh
    echo "### END INIT INFO" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "#set -x" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "# Author: Papa Issa DIAKHATE <[email protected]>" >> /tmp/UMS.sh
    echo "#" >> /tmp/UMS.sh
    echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> /tmp/UMS.sh
    echo "DESC=\"Universal Media Server\"" >> /tmp/UMS.sh
    echo "NAME=UMS.sh" >> /tmp/UMS.sh
    echo "UMS_PROFILE=/etc/\$NAME" >> /tmp/UMS.sh
    echo "DAEMON=/usr/ums/\$NAME" >> /tmp/UMS.sh
    echo "DAEMON_OPTS=\"console\"" >> /tmp/UMS.sh
    echo "SCRIPTNAME=/etc/init.d/\$NAME" >> /tmp/UMS.sh
    echo "UMS_START=1 # Wether to start or not UMS ver at boot time." >> /tmp/UMS.sh
    echo "DODTIME=30  # Time to wait for the server to die, in seconds." >> /tmp/UMS.sh
    echo "            # If this value is set too low you might not" >> /tmp/UMS.sh
    echo "            # let the program to die gracefully and 'restart' will not work" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "test -x \$DAEMON || exit 1" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "# Load the VERBOSE setting and other rcS variables" >> /tmp/UMS.sh
    echo ". /lib/init/vars.sh" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "# Define LSB log_* functions." >> /tmp/UMS.sh
    echo "# Depend on lsb-base (>= 3.0-6) to ensure that this file is present." >> /tmp/UMS.sh
    echo ". /lib/lsb/init-functions" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "# Include ums defaults if available" >> /tmp/UMS.sh
    echo "if [[ -f \"/etc/default/\$NAME\" ]] ; then" >> /tmp/UMS.sh
    echo "        . /etc/default/\$NAME" >> /tmp/UMS.sh
    echo "fi" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "# May we run the init.d script ?" >> /tmp/UMS.sh
    echo "[[ \$UMS_START = 1 ]] || exit 1" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
    echo "# Some color codes" >> /tmp/UMS.sh
    echo "txtred=\$'\e[0;31m' # Red" >> /tmp/UMS.sh
    echo "txtylw=\$'\e[0;33m' # Yellow" >> /tmp/UMS.sh
    echo "txtrst=\$'\e[0m'    # Text Reset" >> /tmp/UMS.sh
    echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
    echo "warnout(){" >> /tmp/UMS.sh
    echo "    echo >&2 -e \"\"\$txtylw\"Warning:\$txtrst \$1\"" >> /tmp/UMS.sh
    echo "}" >> /tmp/UMS.sh
    echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
    echo "running(){" >> /tmp/UMS.sh
    echo "    pid=\`pgrep -f 'java .*ums.jar.*'\`" >> /tmp/UMS.sh
    echo "}" >> /tmp/UMS.sh
    echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
    echo "do_start(){" >> /tmp/UMS.sh
    echo "    running && { warnout \"\$NAME is already running \!\"; exit 0; }" >> /tmp/UMS.sh
    echo "    echo \"Starting \$DESC : \$NAME\"" >> /tmp/UMS.sh
    echo "    UMS_PROFILE=\"\$UMS_PROFILE\" start-stop-daemon --start --quiet --background --oknodo \\" >> /tmp/UMS.sh
    echo "        --exec \$DAEMON -- \$DAEMON_OPTS" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "}" >> /tmp/UMS.sh
    echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
    echo "do_stop(){" >> /tmp/UMS.sh
    echo "    running || { warnout \"\$NAME is NOT running \!\"; exit 0; }   " >> /tmp/UMS.sh
    echo "    local countdown=\"\$DODTIME\"" >> /tmp/UMS.sh
    echo "    echo -e \"Stopping \$DESC : \$NAME \c \"" >> /tmp/UMS.sh
    echo "    kill -9 \$pid" >> /tmp/UMS.sh
    echo "    while running; do" >> /tmp/UMS.sh
    echo "        if ((\$countdown >= 0)); then" >> /tmp/UMS.sh
    echo "            sleep 1; echo -n .;" >> /tmp/UMS.sh
    echo "            ((--countdown))" >> /tmp/UMS.sh
    echo "        else" >> /tmp/UMS.sh
    echo "            break;" >> /tmp/UMS.sh
    echo "        fi" >> /tmp/UMS.sh
    echo "    done" >> /tmp/UMS.sh
    echo "    echo" >> /tmp/UMS.sh
    echo "    # If still running, then try to send SIGINT signal" >> /tmp/UMS.sh
    echo "    running && { \\" >> /tmp/UMS.sh
    echo "        echo >&2 \"Using kill -s SIGINT instead\"; \\" >> /tmp/UMS.sh
    echo "        echo >&2 \"If you see this message again, then you should increase the value of DODTIME in '\$0'.\"; \\" >> /tmp/UMS.sh
    echo "        kill -2 \$pid; \\" >> /tmp/UMS.sh
    echo "    }" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "    if [ -e \"/usr/share/ums/debug.log\" ]; then" >> /tmp/UMS.sh
    echo "    count=9" >> /tmp/UMS.sh
    echo "    while [ \$count -ge 1 ]" >> /tmp/UMS.sh
    echo "    do" >> /tmp/UMS.sh
    echo "    if [ -e \"/usr/share/ums/debug.log.\$count\" ]; then" >> /tmp/UMS.sh
    echo "        plus=\$((count+1))" >> /tmp/UMS.sh
    echo "        mv \"/usr/share/ums/debug.log.\$count\" \"/usr/share/ums/debug.log.\$plus\"" >> /tmp/UMS.sh
    echo "    fi" >> /tmp/UMS.sh
    echo "        count=\$((count-1))" >> /tmp/UMS.sh
    echo "    done" >> /tmp/UMS.sh
    echo "    if [ -e \"/usr/share/ums/debug.log\" ]; then" >> /tmp/UMS.sh
    echo "        mv \"/usr/share/ums/debug.log\" \"/usr/share/ums/debug.log.1\"" >> /tmp/UMS.sh
    echo "    fi" >> /tmp/UMS.sh
    echo "    fi" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "    return 0" >> /tmp/UMS.sh
    echo "}" >> /tmp/UMS.sh
    echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
    echo "do_force-stop(){" >> /tmp/UMS.sh
    echo "    running || { warnout \"\$NAME is NOT running \!\"; exit 0; }   " >> /tmp/UMS.sh
    echo "    echo \"Stopping \$DESC : \$NAME\"" >> /tmp/UMS.sh
    echo "    kill -9 \$pid" >> /tmp/UMS.sh
    echo "    if [ -e \"/usr/share/ums/debug.log\" ]; then" >> /tmp/UMS.sh
    echo "    count=9" >> /tmp/UMS.sh
    echo "    while [ \$count -ge 1 ]" >> /tmp/UMS.sh
    echo "    do" >> /tmp/UMS.sh
    echo "    if [ -e \"/usr/share/ums/debug.log.\$count\" ]; then" >> /tmp/UMS.sh
    echo "        plus=\$((count+1))" >> /tmp/UMS.sh
    echo "   mv \"/usr/share/ums/debug.log.\$count\" \"/usr/share/ums/debug.log.\$plus\"" >> /tmp/UMS.sh
    echo "    fi" >> /tmp/UMS.sh
    echo "       count=\$((count-1))" >> /tmp/UMS.sh
    echo "    done" >> /tmp/UMS.sh
    echo "    if [ -e \"/usr/share/ums/debug.log\" ]; then" >> /tmp/UMS.sh
    echo "   mv \"/usr/share/ums/debug.log\" \"/usr/share/ums/debug.log.1\"" >> /tmp/UMS.sh
    echo "    fi" >> /tmp/UMS.sh
    echo "    fi" >> /tmp/UMS.sh
    echo "}" >> /tmp/UMS.sh
    echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
    echo "do_status(){" >> /tmp/UMS.sh
    echo "    echo -n \" * \$NAME is \"" >> /tmp/UMS.sh
    echo "    ( running || { echo \"NOT running \"; exit 0; } )" >> /tmp/UMS.sh
    echo "    ( running && { echo \"running (PID -> \$(echo \$pid))\"; exit 0; } )" >> /tmp/UMS.sh
    echo "}" >> /tmp/UMS.sh
    echo "#--------------------------------------------------------------------------" >> /tmp/UMS.sh
    echo "case \"\$1\" in" >> /tmp/UMS.sh
    echo "" >> /tmp/UMS.sh
    echo "    start|stop|force-stop|status)" >> /tmp/UMS.sh
    echo "        do_\${1}" >> /tmp/UMS.sh
    echo "        ;;" >> /tmp/UMS.sh
    echo "    restart|reload)" >> /tmp/UMS.sh
    echo "        do_stop" >> /tmp/UMS.sh
    echo "        do_start" >> /tmp/UMS.sh
    echo "        ;;" >> /tmp/UMS.sh
    echo "    force-restart|force-reload)" >> /tmp/UMS.sh
    echo "        do_force-stop" >> /tmp/UMS.sh
    echo "        do_start" >> /tmp/UMS.sh
    echo "        ;;" >> /tmp/UMS.sh
    echo "    *)" >> /tmp/UMS.sh
    echo "        echo \"Usage: \$SCRIPTNAME {start|stop|force-stop|restart|force-restart|reload|force-reload|status}\"" >> /tmp/UMS.sh
    echo "        exit 1" >> /tmp/UMS.sh
    echo "        ;;" >> /tmp/UMS.sh
    echo "esac" >> /tmp/UMS.sh
    sudo mv /tmp/UMS.sh /etc/init.d/UMS.sh

    sudo mkdir /root/.config/UMS  > /dev/null 2>&1
    sudo touch /root/.config/UMS/UMS.conf  > /dev/null 2>&1
    sudo touch /root/.config/UMS/UMS.cred  > /dev/null 2>&1
    sudo ln -s /root/.config/UMS/UMS.conf /etc/UMS.sh  > /dev/null 2>&1
    sudo ln -s /root/.config/UMS/UMS.cred /etc/UMS.cred  > /dev/null 2>&1
    sudo chmod +x /etc/init.d/UMS.sh  > /dev/null 2>&1
    sudo update-rc.d UMS.sh defaults  > /dev/null 2>&1
    cd "$pasta"
User avatar
SubJunk
Lead Developer
Posts: 3707
Joined: Sun May 27, 2012 4:12 pm

Re: Auto Install for Linux (ubuntu/mint)

Post by SubJunk »

Thanks!
Sgloub
Posts: 4
Joined: Thu Oct 16, 2014 12:32 am

Re: Auto Install for Linux (ubuntu/mint)

Post by Sgloub »

I don't want to troll and my questions is very naive.

- Why is it impossible to have a working installer for this application ? I really don't understand. For me, it's very strange to spend some time to develop and maintain a fully working app but make it impossible to install for most of the people ?
infidel
Developer
Posts: 571
Joined: Thu Jul 12, 2012 5:37 am

Re: Auto Install for Linux (ubuntu/mint)

Post by infidel »

Sgloub wrote:Why is it impossible to have a working installer for this application ?
Following the 'platform-independant' ethos of java all you actually need to do is to untar the tarball somewhere and run the app. Package maintenance and distribution in linux is distro-specific as you know and pretty much a full-time job for whoever undertakes it, plus it goes against the aforementioned ethos.

Btw, who said it was "impossible"? :)
Sgloub
Posts: 4
Joined: Thu Oct 16, 2014 12:32 am

Re: Auto Install for Linux (ubuntu/mint)

Post by Sgloub »

I am the one who said it's impossible because I never saw such a thing, neither on PS3 media server or UMS ! And you're right, I downloaded the last version (20141017) and it works out of the box on my Linux Cinnamon 64 bits version. I don't understand as last time I tried to install it (not so long ago) I had to fight with non working scripts or tutos, obsolete repos, problem with ffmepg, etc.

So I would prefer to have it install in my menu as a normal program but at least it woks now. I guess I can deal with launching UMS.sh from the extracted archive..
Sgloub
Posts: 4
Joined: Thu Oct 16, 2014 12:32 am

Re: Auto Install for Linux (ubuntu/mint)

Post by Sgloub »

hmm. I was too happy too fast ! :( I checked with several kind of movies and not everything works out od the bow as I thought. I still have to install mplayer, ffmpeg and friends. Here come the trouble again..
infidel
Developer
Posts: 571
Joined: Thu Jul 12, 2012 5:37 am

Re: Auto Install for Linux (ubuntu/mint)

Post by infidel »

Sgloub wrote: I still have to install mplayer, ffmpeg and friends. Here come the trouble again..
  • A static ffmpeg is included in the 'linux' subfolder. Post a set of TRACE logs if it's not working for you.
  • you can also try your distro's ffmpeg package (which is probably sourced from libav.org not ffmpeg.org, see here about the ffmpeg civil war) and may not be satisfactory.
  • some tips on how to build your own ffmpeg.
  • yes, you'll need to install the mplayer, mencoder, vlc packages for your distro if you want to use them
Sgloub
Posts: 4
Joined: Thu Oct 16, 2014 12:32 am

Re: Auto Install for Linux (ubuntu/mint)

Post by Sgloub »

I've finally installed ffmpeg trough this tuto

http://linuxg.net/how-to-install-ffmpeg ... rivatives/

I can play any kind of video now but sound is not working on some of them (instead I have a a horrible distorted buzzing sound) I don't see anything special in trace and remuxing with txmuxer is activated..

I already had this problem before and got ride of it but I don't remember how. :(
Post Reply