#!/bin/sh # Check for Fedora Core 5 if ! rpm -q fedora-release-5 > /dev/null 2>&1 ; then echo "You must be running Fedora Core 5 to run Fedora Helper." exit 1 fi # Check for root user WHOAMI=`/usr/bin/whoami` if [ "$WHOAMI" != "root" ] ; then echo "You must be the root user to run Fedora Helper." exit 1 fi # Check for zenity if [ ! -f /usr/bin/zenity ] ; then echo -e "Fedora Helper requires \"zenity\" to provide its graphical user interface.\n" echo 'To install zenity, the "gnome-utils" package and its dependencies' echo -e "will be installed.\n" echo -n "Continue with zenity installation? (Y/n) " read YN # Default response is "Y" : ${YN:=Y} case $YN in [yY]|[yY][eE][sS]) yum -y install gnome-utils || exit 1 ;; *) exit 0 ;; esac fi STDOUT=`mktemp` zenity --title "Fedora Helper for FC5" \ --width=600 \ --height=395 \ --list \ --checklist \ --multiple \ --column " " \ --column "Item" \ --column "Description" \ FALSE "MP3 Support" "MP3 support for all installed MP3 applications" \ FALSE "DVD Support" "DVD support for all installed DVD applications" \ FALSE Win32codecs "Needed to play proprietary media formats" \ FALSE ATI "ATI graphics drivers" \ FALSE nVidia "nVidia graphics drivers" \ FALSE Acrobat "Adobe Acrobat Reader 7.0.5" \ FALSE Flash "Macromedia Flash Player 7" \ FALSE Java "Java Runtime Environment Version 5.0 Update 6" \ FALSE Opera "Opera 9 Web browser" \ FALSE LimeWire "LimeWire P2P file-sharing software" \ FALSE RealPlayer "RealPlayer 10" \ > $STDOUT rpmCheck() { rpm -q $1 > /dev/null 2>&1 } yumCheck() { # Is another program using yum? if [ -f /var/run/yum.pid ] ; then zenity --error \ --text "Another program is currently running the Yum package installer. You must exit from this program before continuing with Fedora Helper." exit 1 fi } requiresLivna() { rpmforgeCheck if ! rpmCheck livna-release-5 ; then zenity --question \ --text='In order to complete this operation, support for the Livna software repository must be installed. Click "OK" to install Livna support, or "Cancel" to quit the program.' if [ $? -eq 0 ] ; then cd /tmp wget -N http://rpm.livna.org/livna-release-5.rpm rpm -ivh livna-release-5.rpm rm livna-release-5.rpm else exit 1 fi fi } rpmforgeCheck() { if grep -i enabled=1 /etc/yum.repos.d/dag.repo > /dev/null 2>&1 \ || grep -i enabled=1 /etc/yum.repos.d/dries.repo > /dev/null 2>&1 \ || grep -i enabled=1 /etc/yum.repos.d/freshrpms.repo > /dev/null 2>&1 \ ; then zenity --error \ --text "Support for one or more RPMforge software repositories (FreshRPMS, Dries, Dag) was detected. This program uses the Livna software repository for MP3 and DVD support, which is not compatible with RPMforge repositories." exit 1 fi } # MP3 Support # amaroK requires gstreamer-plugins-ugly # Beep Media Player requires bmp-mp3 # K3b requires k3b-extras-nonfree # Noatun requires kdemultimedia-extras-nonfree # Rhythmbox requires gstreamer-plugins-ugly # Xmms requires xmms-mp3 if grep "MP3 Support" $STDOUT > /dev/null ; then requiresLivna # amaroK if rpmCheck amarok ; then if rpmCheck gstreamer-plugins-ugly ; then HAS_MP3_SUPPORT="$HAS_MP3_SUPPORT\namaroK" else NEEDS_MP3_SUPPORT="$NEEDS_MP3_SUPPORT\namaroK" PKGLIST="$PKGLIST gstreamer-plugins-ugly" fi fi # Beep Media Player (BMP) if rpmCheck bmp ; then if rpmCheck bmp-mp3 ; then HAS_MP3_SUPPORT="$HAS_MP3_SUPPORT\nBeep Media Player (BMP)" else NEEDS_MP3_SUPPORT="$NEEDS_MP3_SUPPORT\nBeep Media Player (BMP)" PKGLIST="$PKGLIST bmp-mp3" fi fi # K3b if rpmCheck k3b ; then if rpmCheck k3b-extras-nonfree ; then HAS_MP3_SUPPORT="$HAS_MP3_SUPPORT\nK3b" else NEEDS_MP3_SUPPORT="$NEEDS_MP3_SUPPORT\nK3b" PKGLIST="$PKGLIST k3b-extras-nonfree" fi fi # Noatun if rpmCheck kdemultimedia ; then if rpmCheck kdemultimedia-extras-nonfree ; then HAS_MP3_SUPPORT="$HAS_MP3_SUPPORT\nNoatun" else NEEDS_MP3_SUPPORT="$NEEDS_MP3_SUPPORT\nNoatun" PKGLIST="$PKGLIST kdemultimedia-extras-nonfree" fi fi # Rhythmbox if rpmCheck rhythmbox ; then if rpmCheck gstreamer-plugins-ugly ; then HAS_MP3_SUPPORT="$HAS_MP3_SUPPORT\nRhythmbox" else NEEDS_MP3_SUPPORT="$NEEDS_MP3_SUPPORT\nRhythmbox" PKGLIST="$PKGLIST gstreamer-plugins-ugly" fi fi # Xmms if rpmCheck xmms ; then if rpmCheck xmms-mp3 ; then HAS_MP3_SUPPORT="$HAS_MP3_SUPPORT\nXmms" else NEEDS_MP3_SUPPORT="$NEEDS_MP3_SUPPORT\nXmms" PKGLIST="$PKGLIST xmms-mp3" fi fi if [ -z "$NEEDS_MP3_SUPPORT" ] ; then zenity --info \ --text "MP3 support is already installed for all detected applications:\n$HAS_MP3_SUPPORT" elif [ -z "$NEEDS_MP3_SUPPORT" -a -z "$HAS_MP3_SUPPORT" ] ; then zenity --info \ --text "No applications needing MP3 support were detected." else zenity --info \ --text "MP3 support will be installed for the following applications:\n$NEEDS_MP3_SUPPORT" fi [ -n "$PKGLIST" ] && yumCheck && yum -y install $PKGLIST unset PKGLIST fi # DVD Support # All DVD applications need libdvdcss for encrypted DVD support # If totem is installed, remove and install totem-xine if grep "DVD Support" $STDOUT > /dev/null ; then requiresLivna # Kaboodle if rpmCheck kdemultimedia ; then if rpmCheck kdemultimedia-extras-nonfree ; then HAS_MP3_SUPPORT="$HAS_MP3_SUPPORT\nKaboodle" else NEEDS_MP3_SUPPORT="$NEEDS_MP3_SUPPORT\nKaboodle" PKGLIST="$PKGLIST kdemultimedia-extras-nonfree" fi fi # MPlayer if rpmCheck mplayer ; then if rpmCheck libdvdcss ; then HAS_DVD_SUPPORT="$HAS_DVD_SUPPORT\nMPlayer" else NEEDS_DVD_SUPPORT="$NEEDS_DVD_SUPPORT\nMPlayer" PKGLIST="$PKGLIST libdvdcss" fi fi # Totem if rpmCheck totem ; then NEEDS_DVD_SUPPORT="$NEEDS_DVD_SUPPORT Totem" # totem conflicts with totem-xine; totem-xine will be installed later rpm -e totem --nodeps PKGLIST="$PKGLIST totem-xine libdvdcss" fi # Totem compiled against xine-lib if rpmCheck totem-xine ; then if rpmCheck libdvdcss ; then HAS_DVD_SUPPORT="$HAS_DVD_SUPPORT\nTotem" else NEEDS_DVD_SUPPORT="$NEEDS_DVD_SUPPORT\nTotem" PKGLIST="$PKGLIST libdvdcss" fi fi # VLC if rpmCheck vlc ; then if rpmCheck libdvdcss ; then HAS_DVD_SUPPORT="$HAS_DVD_SUPPORT\nVLC" else NEEDS_DVD_SUPPORT="$NEEDS_DVD_SUPPORT\nVLC" PKGLIST="$PKGLIST libdvdcss" fi fi # xine if rpmCheck xine ; then if rpmCheck libdvdcss ; then HAS_DVD_SUPPORT="$HAS_DVD_SUPPORT\nxine" else NEEDS_DVD_SUPPORT="$NEEDS_DVD_SUPPORT\nxine" PKGLIST="$PKGLIST libdvdcss" fi fi if [ -z "$NEEDS_DVD_SUPPORT" ] ; then zenity --info \ --text "DVD support is already installed for all detected applications:\n$HAS_DVD_SUPPORT" elif [ -z "$NEEDS_DVD_SUPPORT" -a -z "$HAS_DVD_SUPPORT" ] ; then zenity --info \ --text "No applications needing DVD support were detected." else zenity --info \ --text "DVD support will be installed for the following applications:\n$NEEDS_DVD_SUPPORT" fi [ -n "$PKGLIST" ] && yumCheck && yum -y install $PKGLIST unset PKGLIST fi # Win32codecs if grep Win32codecs $STDOUT > /dev/null ; then cd /tmp CODECS_LOCATION="http://www.mplayerhq.hu/MPlayer/releases/codecs" OUTPUT_FILE=`mktemp` if ! wget -O $OUTPUT_FILE $CODECS_LOCATION > /dev/null 2>&1 ; then echo "Could not determine latest version of audio and video codecs." exit 1 fi export CODECS=`perl -ne 'print "$1\n" if / /dev/null ; then if rpmCheck AdobeReader_enu-7.0.5-1 ; then zenity --info \ --text "Adobe Acrobat Reader 7.0.5 is already installed." else zenity --info \ --text "Adobe Acrobat Reader 7.0.5 will now be installed." cd /tmp wget -N ftp://ftp.adobe.com/pub/adobe/reader/unix/7x/7.0.5/enu/AdobeReader_enu-7.0.5-1.i386.rpm # compat-libstdc++-33 is a prerequisite for Acrobat Reader yum -y localinstall AdobeReader_enu-7.0.5-1.i386.rpm [ -h /usr/lib/mozilla/plugins/nppdf.so ] && rm /usr/lib/mozilla/plugins/nppdf.so ln -s /usr/local/Adobe/Acrobat7.0/Browser/intellinux/nppdf.so /usr/lib/mozilla/plugins rm AdobeReader_enu-7.0.5-1.i386.rpm fi fi # Flash if grep Flash $STDOUT > /dev/null ; then if rpmCheck flash-plugin ; then zenity --info \ --text="The Macromedia Flash Plugin is already installed." else zenity --info \ --text="The Macromedia Flash Plugin will now be installed." cd /etc/yum.repos.d wget -N http://macromedia.mplug.org/macromedia-i386.repo yumCheck && yum -y install flash-plugin fi fi # Java if grep Java $STDOUT > /dev/null ; then if [ -d /usr/local/jre1.5.0_06 -o -d /opt/jre1.5.0_06 ] ; then zenity --info \ --text="Java Runtime Environment Version 5.0 Update 6 is already installed." else zenity --info \ --text="Java Runtime Environment Version 5.0 Update 6 will now be installed." cd /tmp wget -O jre-1_5_0_06-linux-i586.bin http://jdl.sun.com/webapps/download/AutoDL?BundleId=10336 zenity --info \ --text="You must read and accept the license agreement to complete installation of Java Runtime Environment Version 5.0 Update 6." sh ./jre-1_5_0_06-linux-i586.bin if [ $? -eq 0 ] ; then # Install in /opt if /opt is a separate partition OPT_FS=`df /opt 2>/dev/null | tail -1 | awk '{ print $NF }'` if [ "$OPT_FS" = "/opt" ] ; then mv jre1.5.0_06 /opt ln -f -s /opt/jre1.5.0_06/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/ /usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.5.0_06/bin/java 2 SELECTION=`echo -e "\n" | /usr/sbin/alternatives --config java | grep '/opt/jre1.5.0_06/bin/java' | cut -c4-6` else mv jre1.5.0_06 /usr/local ln -f -s /usr/local/jre1.5.0_06/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/ /usr/sbin/alternatives --install /usr/bin/java java /usr/local/jre1.5.0_06/bin/java 2 SELECTION=`echo -e "\n" | /usr/sbin/alternatives --config java | grep '/usr/local/jre1.5.0_06/bin/java' | cut -c4-6` fi echo $SELECTION | /usr/sbin/alternatives --config java > /dev/null fi fi fi # ATI drivers if grep ATI $STDOUT > /dev/null ; then requiresLivna if rpm -q kmod-fglrx xorg-x11-drv-ati > /dev/null 2>&1 ; then INSTALLED_KMOD_VER=`rpm -q kmod-fglrx --queryformat "%{DESCRIPTION}" | perl -ne 'print "$1\n" if /kernel ([0-9].*?) for/'` zenity --info \ --text="ATI drivers are already installed for kernel $INSTALLED_KMOD_VER." else zenity --info \ --text="ATI drivers will now be installed." yumCheck && yum -y install kmod-fglrx INSTALLED_KMOD_VER=`rpm -q kmod-fglrx --queryformat "%{DESCRIPTION}" | perl -ne 'print "$1\n" if /kernel ([0-9].*?) for/'` KERNEL_VER=`uname -r` if [ "$INSTALLED_KMOD_VER" != "$KERNEL_VER" ] ; then zenity --info \ --text="ATI drivers were installed for kernel $INSTALLED_KMOD_VER. You are currently running kernel $KERNEL_VER, and will not be able to use ATI drivers until you boot into kernel $INSTALLED_KMOD_VER." fi fi fi # nVidia drivers if grep nVidia $STDOUT > /dev/null ; then requiresLivna if rpm -q kmod-nvidia xorg-x11-drv-nvidia > /dev/null 2>&1 ; then INSTALLED_KMOD_VER=`rpm -q kmod-nvidia --queryformat "%{DESCRIPTION}" | perl -ne 'print "$1\n" if /kernel ([0-9].*?) for/'` zenity --info \ --text="nVidia drivers are already installed for kernel $INSTALLED_KMOD_VER." else zenity --info \ --text="nVidia drivers will now be installed." yumCheck && yum -y install kmod-nvidia INSTALLED_KMOD_VER=`rpm -q kmod-nvidia --queryformat "%{DESCRIPTION}" | perl -ne 'print "$1\n" if /kernel ([0-9].*?) for/'` KERNEL_VER=`uname -r` if [ "$INSTALLED_KMOD_VER" != "$KERNEL_VER" ] ; then zenity --info \ --text="nVidia drivers were installed for kernel $INSTALLED_KMOD_VER. You are currently running kernel $KERNEL_VER, and will not be able to use nVidia drivers until you boot into kernel $INSTALLED_KMOD_VER." fi fi fi # Opera if grep Opera $STDOUT > /dev/null ; then if rpmCheck opera ; then zenity --info \ --text="Opera 9 is already installed." else zenity --info \ --text="Opera 9 will now be installed." cd /tmp wget -O opera.rpm 'http://www.opera.com/download/get.pl?id=28205&location=148¬hanks=yes&sub=marine' rpm -Uvh opera.rpm rm opera.rpm fi fi # LimeWire if grep LimeWire $STDOUT > /dev/null ; then if [ -d /opt/LimeWire -o -d /usr/local/LimeWire ] ; then zenity --info \ --text="LimeWire is already installed." else zenity --info \ --text="LimeWire will now be installed." cd /tmp wget -O LimeWireOther.zip http://www.limewire.com/LimeWireSoftOther unzip LimeWireOther.zip # Install in /opt if /opt is a separate partition OPT_FS=`df /opt 2>/dev/null | tail -1 | awk '{ print $NF }'` if [ "$OPT_FS" = "/opt" ] ; then mv LimeWire /opt echo -e '#!/bin/sh\ncd /opt/LimeWire\n./runLime.sh' > /usr/bin/limewire else mv LimeWire /usr/local echo -e '#!/bin/sh\ncd /usr/local/LimeWire\n./runLime.sh' > /usr/bin/limewire fi chmod a+x /usr/bin/limewire rm LimeWireOther.zip fi fi # RealPlayer if grep RealPlayer $STDOUT > /dev/null ; then if rpmCheck RealPlayer ; then REALPLAYER_VERSION=`rpm -q RealPlayer --queryformat "%{VERSION}" | awk -F\. '{ print $1 }'` fi if [ "$REALPLAYER_VERSION" = 10 ] ; then zenity --info \ --text="RealPlayer 10 is already installed." else zenity --info \ --text="RealPlayer 10 will now be installed." cd /tmp wget -O RealPlayer10GOLD.rpm 'http://www.real.com/realcom/R?href=http%3A%2F%2Fforms.real.com%2Freal%2Fplayer%2Fdownload.html%3Ff%3Dunix%2FRealPlayer10GOLD.rpm%26product%3Dplayerplus%26system%3Dlinux&pageid=linuxPage&pageregion=advanced_install&src=linux&pcode=rn&opage=linux' rpm -Uvh RealPlayer10GOLD.rpm ln -f -s /usr/local/RealPlayer/mozilla/nphelix.so /usr/lib/mozilla/plugins ln -f -s /usr/local/RealPlayer/mozilla/nphelix.xpt /usr/lib/mozilla/plugins rm RealPlayer10GOLD.rpm fi fi