Script for unattended setup/remove Multimedia packages -- Any Version?

Hi there,

I’ve built a script that should meet the requirements to pass the MMCHECK script written by J. McDaniels and RedDwarf.

Thanks to Frederic007 for ‘zypper tos’

Save anywhere, call anything, and then (must be run as root):

chmod +x <nameOfFile>
./<nameOfFile> setup|remove


#!/bin/bash

function addRepo() {
  zypper --no-gpg-checks --gpg-auto-import-keys addrepo -f $1 $2
}

function dropRepo() {
  zypper rr $1
}

function addLibDvdCss() {
  addRepo http://download.videolan.org/pub/vlc/SuSE/${SUSE_VERSION}/ vlc
  zypper mr -p 1 vlc
  zypper --quiet --non-interactive in libdvdcss
  dropRepo vlc
}

function addPackman() {
  addRepo http://packman.unixheads.com/suse/${SUSE_VERSION}/ packman
  zypper mr -r -p 70 packman
  zypper --quiet --non-interactive dup -r packman
}

function setup() {
  addLibDvdCss
  addPackman
  zypper --quiet --non-interactive in gst-fluendo-mp3 gstreamer-0_10-ffmpeg gstreamer-0_10-fluendo-mp3 gstreamer-0_10-fluendo-mpegdemux gstreamer-0_10-fluendo-mpegmux
  zypper --quiet --non-interactive in gstreamer-0_10-plugins-base gstreamer-0_10-plugins-good gstreamer-0_10-plugins-bad gstreamer-0_10-plugins-ugly gstreamer-0_10-plugins-good-extra
  zypper --quiet --non-interactive in libxvidcore4 xvidcore xvid4conf libavcodec52 libavdevice52 libdvdnav4 libdvdplay0 libdvdread4 libmad0 libquicktime0 libxine1 libxine1-codecs
  zypper --quiet --non-interactive in k3b-codecs phonon-backend-xine w32codec-all ffmpeg 
  zypper --quiet --non-interactive in xine-ui gnome-mplayer gecko-mediaplayer smplayer mplayer vlc
  zypper --quiet --non-interactive in --auto-agree-with-licenses flash-player 
  zypper --quiet --non-interactive remove java-1_6_0-openjdk
  zypper --quiet --non-interactive in --auto-agree-with-licenses java-1_6_0-sun java-1_6_0-sun-plugin
}

function remove() {
  zypper rr packman
  zypper --quiet --non-interactive remove gst-fluendo-mp3 gstreamer-0_10-ffmpeg gstreamer-0_10-fluendo-mp3 gstreamer-0_10-fluendo-mpegdemux gstreamer-0_10-fluendo-mpegmux
  zypper --quiet --non-interactive remove gstreamer-0_10-plugins-base gstreamer-0_10-plugins-good gstreamer-0_10-plugins-bad gstreamer-0_10-plugins-ugly gstreamer-0_10-plugins-good-extra
  zypper --quiet --non-interactive remove libxvidcore4 xvidcore xvid4conf libavcodec52 libavdevice52 libdvdnav4 libdvdplay0 libdvdread4 libmad0 libquicktime0 libxine1 libxine1-codecs
  zypper --quiet --non-interactive remove k3b-codecs phonon-backend-xine w32codec-all ffmpeg flash-player
  zypper --quiet --non-interactive remove xine-ui gnome-mplayer gecko-mediaplayer smplayer mplayer vlc
  zypper --quiet --non-interactive remove java-1_6_0-sun java-1_6_0-sun-plugin
}

# must be run as 'root'
#
if  $(whoami) != 'root' ]; then
        echo "Must be root to run $0."
        exit 1;
fi

#
# so, whatya wanna do?
#
if  $# != '1' ]; then
  echo "Usage: $0 setup|remove"
  exit 1;
fi

#
# which version for repos?
#
SUSE_VERSION=$(zypper tos | cut -d- -f2)

#
# so setup or remove?
#
if  $1 == "setup" ]; then
  setup
else
  remove
fi

Hum!

Looks interesting. I will test it. :slight_smile:

That’d be great, especially if you would let me know how it went for you. I had some trouble getting the repositories working properly. It would be nice to sort a way to try one a couple times and then drop back to whichever works. Better yet, try a few and use the quickest.