#!/bin/bash # # Mplayer install script for OLPC XO-1 computer # # Copyright ©2008 by Richard Hitt # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Installing mplayer on olpc (with all the bad non-free codecs) # This document tries to be a bit of a tutorial rather than just a list of what to do, # This script does four commands: # * Installs the livna repository # * Installs the libdvdread package # * Installs the libdvdnav package # * Installs the mplayer package and other packages it needs # Note that when the OLPC repository gets updated to have libdvdnav, # we will need only the first and last steps. The middle two should # be regarded as ugly but temporarily necessary. # # Throughout, we avoid having to execute this script as root by using the form # su -c "command line" # # The livna repository includes non-free codecs, which is why it's not in # the standard repository. # # Output from the install commands will be redirected to /tmp/mplayer-install.log # OUTLOG=/tmp/mplayer-install.log rm -f $OUTLOG echo "Install started at $(date)" >> $OUTLOG # # Zeroth, if there's already an installed mplayer, abandon ship # if [ -x $(which mplayer) ]; then echo "Oops, I see you already have a valid mplayer command. If you want to" echo "use this script to install the official one, please uninstall it." echo "The mplayer command's full path is $(which mplayer)." exit 1 fi # # First, install the livna repository package --- # if /bin/rpm -q livna-release 2>1 >/dev/null; then echo "Good, the livna-release package is already installed." else echo "I'm installing the livna-release package; most of the" echo "mplayer stuff is in the livna repositories." su -c "rpm -i http://rpm.livna.org/livna-release-7.rpm" 2>1 >> $OUTLOG if rpm -q livna-release 2>1 >/dev/null; then echo "Good, looks like that worked." else echo "Oops, somehow I cannot install the livna-release package. Sorry!!" exit 1 fi fi # # Our third step will install libdvdnav; but that package requires libdvdread! And since # we are using a URL to get libdvdnav we cannot install it with yum-install and thereby # automatically resolve dependencies. So Let's install libdvdread now. # if rpm -q libdvdread 2>1 >/dev/null; then echo "Good, libdvdread is already installed, needed for libdvdnav." else echo "I'll install libdvdread now, because libdvdnav will need it." su -c "yum -y install libdvdread" 2>1 >> $OUTLOG if rpm -q libdvdread 2>1 >/dev/null; then echo "Good, looks like libdvdread installed okay." else echo "Oops, somehow libdvdread didn't want to install! Sorry!!" exit 1 fi fi # # Now we're ready to install libdvdnav. We use a copy we found at rpm.pbone.net. # if rpm -q libdvdnav 2>1 >/dev/null; then echo "Good, libdvdnav is already installed too!" else echo "I will install libdvdnav from rpm.pbone.net now." su -c "rpm -i ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/linux/updates/7/x86_64/libdvdnav-4.1.1-2.fc7.i386.rpm" 2>1 >> $OUTLOG if rpm -q libdvdnav 2>1 >/dev/null; then echo "Good, seems as if libdvdnav installed correctly." else echo "Oops, we couldn't install libdvdnav, what's up with that?? Sorry!!" exit 1 fi fi # # Finally we install mplayer; yum will probably find 20 or so dependencies # so we warn that it may take several minutes. # if rpm -q mplayer 2>1 >/dev/null; then echo "Hmm, it does look like mplayer is already installed! Hope this is okay." else echo "Now I'm installing mplayer. WARNING: Since mplayer requires" echo "several additional packages (which I'll install too), count on" echo "this step to take several minutes!" su -c "yum -y install --nogpgcheck mplayer" 2>1 >> $OUTLOG if rpm -q mplayer 2>1 >/dev/null; then echo "Congratulations!! mplayer is now installed!" echo "For a log of the output of the install steps," echo "read file $OUTLOG." else echo "Oooooooops! Apparently the install failed! Please check" echo "the log of the install commands we used, at $OUTLOG." exit 1 fi fi echo "Install ended at $(date)" >> $OUTLOG