Script to enable multimedia support and update system

I am writing a script to:

1 Install full multimedia support from packman and libdvdcss from vlc

2 Update the system.

#!/bin/bash
tput setaf 2; echo "Habilitando soporte multimedia" 
tput setaf 5; echo ""
tput setaf 5; echo "################################"
tput setaf 2; echo "Habilitando repositorio packman"
tput setaf 5; echo "################################"
tput setaf 5; echo ""

zypper ar http://ftp.gwdg.de/pub/linux/packman/suse/openSUSE_Leap_42.1/ packman

tput setaf 5; echo ""
tput setaf 5; echo "######################################"
tput setaf 2; echo "Deshabilitando todos los repositorios"
tput setaf 5; echo "######################################"
tput setaf 5; echo ""

zypper mr -d -all

tput setaf 5; echo ""
tput setaf 5; echo "##################################################"
tput setaf 2; echo "Habilitando los repositorios Packman, OSS y Update"
tput setaf 5; echo "##################################################"
tput setaf 5; echo ""

zypper mr  --enable packman repo-oss repo-update 

tput setaf 5; echo ""
tput setaf 5; echo "#########################################"
tput setaf 2; echo "Habilitando el cache en los repositorios"
tput setaf 5; echo "#########################################"
tput setaf 5; echo ""

zypper mr -kr packman repo-oss repo-update

tput setaf 5; echo ""
tput setaf 5; echo "######################################"
tput setaf 2; echo "Cambiando prioridad a los repositorios"
tput setaf 5; echo "######################################"
tput setaf 5; echo ""

zypper mr -p 90 packman
zypper mr -p 95 repo-update

tput setaf 5; echo ""
tput setaf 5; echo "######################################"
tput setaf 2; echo "Refrescando repositorios"
tput setaf 5; echo "######################################"
tput setaf 5; echo ""

zypper refresh

tput setaf 5; echo ""
tput setaf 5; echo "##########################################"
tput setaf 2; echo "Instalado el soporte para DVD encriptados"
tput setaf 5; echo "##########################################"
tput setaf 5; echo ""

zypper --non-interactive --no-gpg-checks in http://download.videolan.org/pub/videolan/vlc/SuSE/Leap_42.1/x86_64/libdvdcss2-1.4.0-1.2.x86_64.rpm

tput setaf 5; echo ""
tput setaf 5; echo "######################################"
tput setaf 2; echo "Instalando el soporte full multimedia"
tput setaf 5; echo "######################################"
tput setaf 5; echo ""

zypper dup --from packman

tput setaf 5; echo ""
tput setaf 5; echo "######################################"
tput setaf 2; echo "Instalando todo el soporte multimedia"
tput setaf 5; echo "######################################"
tput setaf 5; echo ""

zypper --non-interactive in --no-recommends vlc devede ffmpeg mjpegtools mplayer xine-ui libxine2-codecs avidemux3 avidemux3-qt5 audacity pacpl kde4-pacpl-plugins smplayer mediainfo kde4-mediainfo isomaster transcode dvdrip asunder lame k3b k3b-codecs amarok libbluray-tools handbrake-gtk handbrake-cli phonon-backend-vlc

tput setaf 5; echo ""
tput setaf 5; echo "################################################"
tput setaf 2; echo "Instalando actualizaciones del sistema operativo"
tput setaf 5; echo "################################################"
tput setaf 5; echo ""

zypper up

tput setaf 5; echo ""
tput setaf 5; echo "######################################"
tput setaf 2; echo "Limpiando la cache de la instalacion"
tput setaf 5; echo "######################################"
tput setaf 5; echo ""

zypper clean

tput setaf 5; echo ""
tput setaf 5; echo "#####################"
tput setaf 2; echo "Instalacion Terminada"
tput setaf 5; echo "#####################"
tput setaf 5; echo ""

what do you think?
anything else to improve it?

thanks

First,
I think it’s cool that you have an interest in writing installation scripts.

I’ve collected some related script code and posted in my openSUSE wiki, in particular for this situation these are some useful zypper commands if you’re interested in creating a script that would work not just for the current LEAP, but other LEAP (in the future), TW and others
https://en.opensuse.org/User:Tsu2/BASH_zypper

As for your current script,

  • Isn’t the libdvdcss package provided by the packman repo? I’m pretty sure it is, and if so you shouldn’t be installing from elsewhere.

  • Is there a reason to disable all repos and then re-enable your chosen few? Don’t unless you have a reason to do so.

  • Modifying repo priorities is likely unnecessary.

  • When you install your multimedia packages, you specify “no-recommends” Why? And, if you don’t specify “no-recommends” you should be able to shorten the explicit list of packages. By relying on the package manager reading the rpm specifications instead of explicitly listing the packages, your script becomes more flexible and self-adjusting should the rpm specs change.

  • Do not run “zypper clean” unless that is really what you want to do. Ordinarily, you’d want to save install packages in the zypper cache so they can be referenced without re-downloading if needed, and this command makes this not possible.

  • If you’re going to run a “zypper up” (often advisable), you should run it at the beginning… not at the end of your script. Think about why this is.

HTH,
TSU

Thanks for the comments

  • Isn’t the libdvdcss package provided by the packman repo? I’m pretty sure it is, and if so you shouldn’t be installing from elsewhere.

no it doesn’t, I did a search and it is not there PackMan :: Search results

  • Is there a reason to disable all repos and then re-enable your chosen few? Don’t unless you have a reason to do so.

this script is desing to be run just after a new installation, by disabling all repos and enabling just those three garantee that a repo added by the user will not interfere with the installation mixing things, that should not be there.

  • Modifying repo priorities is likely unnecessary.

Enabling repo cache garantees that problems by a loss connection will not arise, and the downloaded packages can be used latter as a local repo, modifying repo priorities garantee even more that problems will not arise by an extra post installation added repo.

When you install your multimedia packages, you specify “no-recommends” Why?

that reduce the number of packages to be downloaded, thus saving time in the download process.

Do not run “zypper clean” unless

totally right, option removed

If you’re going to run a “zypper up” (often advisable), you should run it at the beginning… not at the end of your script. Think about why this is.

if I do that, it will download package updates that will be replaced latter by a zypper dup -from packman, once again this reduce the amount of downloaded data.

I have read your wiki and there is some interesting info, I will check out and test to see what happens

thanks

First, regarding libdvdcss…
Libdvdcss is required only for certain burner apps, so you should probably not install if the target machine isn’t going to be burning optical media. And, if a burner app really needed libdvdcss, there is a reasonable chance it will be included in the app package(like the following in kodi).

You can find libdvdcss(in Packman or any other enabled repo) with the following command

zypper se --provides libdvdcss

It can be found within kodi, the upside to installing kodi to get libdvdcss is that the library file is managed by someone so that if there is an update (newer version, patch, etc) you’ll likely get it automatically. Installing libdvdcss as you did it involves less “extra” files but is unmanaged, you won’t know if there is any newer version available automatically.

Verifying libdvdcss is installed with the kodi package

rpm -ql kodi | grep libdvdcss

Verifying origins of the kodi package

 zypper info kodiLoading repository data...
Reading installed packages...




Information for package kodi:
-----------------------------
Repository: Packman Repository
Name: kodi
Version: 16.1-3.3
Arch: x86_64
Vendor: http://packman.links2linux.de
Installed: Yes
Status: up-to-date
Installed Size: 41.8 MiB
Summary: Media center (formerly known as XBMC)
Description: 
  KODI media center is a free cross-platform media-player jukebox and
  entertainment hub.  KODI can play a spectrum of of multimedia formats,
  and featuring playlist, audio visualizations, slideshow, and weather
  forecast functions, together third-party plugins.

Repo priorities are likely not relevant or desirable…
You want the latest <package> versions from whatever repo they may reside in, and your package manager will do that for you by default.

I would still accept the packager’s recommendations, those recommendations are generally based on possible/probable use. By declining recommendations, you run the risk that the User will at some time find the app broken for a task.

My SOP is to run “zypper up” before everything else because it ensures bindings to latest files, is system-wide and not just affecting Packman apps. It provides a solid foundation for all that might follow. When you run “zypper dup --from packman” you’ll be switching vendors for only a relatively small part of your system and I’m wondering if there is any diff for <those> apps. For best stability and least amount of risk, you should follow my recommendation.

IMO (and always open to alternative methods for good reasons)
TSU

That depends fully on your project specifications. You know what is the goal to reach with the script. We don’t.

I e.g. would never want to change the priorities of my repos, thus I would write a different script. And I might want to write one when I had many installations to do (say more then a few each month), which is not the case. And If I would write one, I probably would add more “after installation” actions in the script, that I do now from a list.

Also, I am not so concerned about network capacity as you are. Thus I would not take much trouble in optimising the script for it, as you seem to do. Again, it is all very personal.

Where it only for having the most up to date versions of the software management software (zypper and underlying libraries). It is often the first and only thing a zypper up does direct after installation, then restarting itself to do the rest of the packages.

I do not think it is very clever to do a lot of installing without having fully patched installation software.

Another thing you could do is enabling the network repos during installation (there is an option for that somewhere), it will install most packages from the repos instead of from the installation medium, giving you an already zupper up system direct after installation.

Not completely like this. Enabling the online resources enables the ‘update’ as well as the ‘distribution’ repos. The latter contain a lot more software packages than a DVD image can contain, so you’ve got the option to extend the software selection to be installed. Having the ‘update’ repos active means, that packages newer than on the DVD image ( and hence in the distribution repos ) will be installed instead of the distribution’s packages. But … if you have a slow internetconnection this can make the install take hours to complete, given the huge number of updates that have been released since Leap’s release.

Re. the script:

  • I would not mess with repo priorities, never.
  • Rather than hard coding a mirror ( and you picked the one from the University of Göttingen, which had it’s entire mirror service down for a couple of days lately ), I’d use an array of mirror URLs and pick the best option ( if one doesn’t work the script won’t fail )

Thanks, the goal of the script is that at the end the system must have all the multimedia support enabled, multimedia aplications must come from the packman repository to archive and garantee this goal, the system must be fully updated (not upgraded) from the official update repo, the user must have aplications to: play video and music of a variety of formats, also to convert video and music between the different formats, there must be variety of programs but not too much, the script must be design to download the less data possible to save time in a low bandwith scenario, this is important because the first time the script is run it takes a considerable amount of time, the second time the script is run it takes only minutes, but it depends of how much must be updated.

I changed the repo priorities because I first run a zypper -dup from packman after that I do a “zypper in” and I want that “zypper in” to take the programs from the packman repo as much as possible, and since I run a “zypper up” after that, I don’t want that zypper up (for some unknown reason) to replace a package of the packman repo with an update from the update repo, which will not have the full multimedia support.

There is no such reason. zypper up does not do a Vendor change.

https://forums.opensuse.org/showthread.php/397419-Do-you-use-repository-priorities

about the repo priorities

and what about zypper in, I haven’t foud info about that subject in zypper in

I am not sure I even want to read that whole thread from 2008! lol!

Of course not. A zypper in can not do a Vendor change because there wasn’t already a vendor.

But you could indeed give Packman a bit higher priority to let a zypper in install prefarably from Packman. But I assume not many people need that.

After an installation you will have enough players, etc. in the broken form. After the switch (either through YaST, or by zypper dup --from Packman) you will have enough for a full multi-media experience. Enough for most people.

Look, for some reason you want a script to do something you would like to do using a script. That is fine. You will learn a lot doing that about writing scripts and in this case about using zypper and repos and multi-media.

But the moment you ask others how to improve/add to the script, you must be prepared for people that are not interested in doing these things using a script or even doing them at all. I do a default installation and a switch to Packman. Since
openSUSE 10.1 or maybe earlier. Fits me completely.

And the moment you say somewhere in your story that you use priorities to avoid vendor change on zypper up, I will try to help you puting that misunderstanding right. That is all.

And the moment you say somewhere in your story that you use priorities to avoid vendor change on zypper up, I will try to help you puting that misunderstanding right. That is all.

Ok that is clear

But you could indeed give Packman a bit higher priority to let a zypper in install prefarably from Packman.

that is what I thought, play with priorities just in case.

But the moment you ask others how to improve/add to the script, you must be prepared for people that are not interested in doing these things using a script or even doing them at all. I do a default installation and a switch to Packman. Since
openSUSE 10.1 or maybe earlier. Fits me completely.

After an installation you will have enough players, etc. in the broken form. After the switch (either through YaST, or by zypper dup --from Packman) you will have enough for a full multi-media experience. Enough for most people.

you are right, but what about those few who need from time to time avidemux or handbrake, or something like pacpl and media info, in my case I like full multimedia support in my pc, not only for playing but also for editing and converting and I like to have options too, have the application until it is need it, not running to install in the last moment.

what is better than having all that by just running a script and whatching how all the work is done automatically?.

Thanks

I already said, that is fine! And I mean it. Your requirements are perfectly valid.

But for others it simply might mean to install such a thing from packman. After all, in YaST, you see the several versions and can choose. They will only install such a thing once or twice a year. Then make a note of it (list of products to add to new installation) and do it again on a new openSUSE version after one-and-a-half year.

You can only improve on the script by using experience in using it and seeing if the effects are what they should be in the long term. Not many people will create such a script. Thus you can only expect piecemeal remarks (like mine on the vendor change), but not real assessment of your script.