#!/bin/sh # Shell script to install libdvdcss under Debian GNU Linux # Many DVDs use css for encryption. To play these discs, a special library # is needed to decode them, libdvdcss. Due to legal problems, Debian and most # Linux distibutions cannot distribute libdvdcss # Use this shell script to install the libdvdcss under DEBIAN GNU/Linux # -------------------------------------------------------------------------- # Refer url for more info: # Copyright info - http://www.dtek.chalmers.se/~dvd/ # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ------------------------------------------------------------------------- # Addition of checking for current version. Gene Cumm # ------------------------------------------------------------------------- # Script messages l10n # Detects which language is set _langrc=0 echo $LANGUAGE | grep -q "^qcv_ES" || _langrc=1 # All message strings in both languages ES_SELECTIONMSG="Seleccione el directorio donde desea guardar el paquete" VA_SELECTIONMSG="Trieu el directori on desitgeu guardar el paquet" ES_COPIEDMSG="El archivo se ha copiado correctamente" VA_COPIEDMSG="El fitxer s'ha copiat correctament" ES_ERRORSELMSG="No ha seleccionado ningún archivo" VA_ERRORDOWN="No s'ha descarregat cap fitxer, comproveu la vostra conexió a internet" ES_ERRORDOWN="No se ha descargado ningún archivo, comprovar vuestra conexión a internet" VA_ERRORSELMSG="No heu seleccionat cap fitxer" ES_PKGSELMSG="Seleccione el paquete que desea instalar" VA_PKGSELMSG="Trieu el paquet que desitgeu instal·lar" ES_ACTIVATIONMSG="Visualización de DVD originales activada" VA_ACTIVATIONMSG="Visualització de DVD originals activada" ES_SELECTMSG="Escoja la acción que desea realizar" VA_SELECTMSG="Trieu l'acció que desitgeu realitzar" ES_DLDSETUPMSG="Descargar paquete e instalar" VA_DLDSETUPMSG="Baixar el paquet i instal·lar-lo" ES_DLDSAVEMSG="Descargar paquete y guardar" VA_DLDSAVEMSG="Baixar el paquet i guardar-lo" ES_SELECTSETUPMSG="Seleccionar paquete (local) e instalarlo" VA_SELECTSETUPMSG="Seleccionar el paquet (local) i instal·lar-lo" # Valencian is selected by default SELECTIONMSG="$VA_SELECTIONMSG" COPIEDMSG="$VA_COPIEDMSG" ERRORSELMSG="$VA_ERRORSELMSG" ERRORDOWN="$VA_ERRORDOWN" PKGSELMSG="$VA_PKGSELMSG" ACTIVATIONMSG="$VA_ACTIVATIONMSG" SELECTMSG="$VA_SELECTMSG" DLDSETUPMSG="$VA_DLDSETUPMSG" DLDSAVEMSG="$VA_DLDSAVEMSG" SELECTSETUPMSG="$VA_SELECTSETUPMSG" # But they could change if Spanish is detected if [ $_langrc -eq 1 ] ; then SELECTIONMSG="$ES_SELECTIONMSG" COPIEDMSG="$ES_COPIEDMSG" ERRORSELMSG="$ES_ERRORSELMSG" PKGSELMSG="$ES_PKGSELMSG" ACTIVATIONMSG="$ES_ACTIVATIONMSG" SELECTMSG="$ES_SELECTMSG" DLDSETUPMSG="$ES_DLDSETUPMSG" DLDSAVEMSG="$ES_DLDSAVEMSG" SELECTSETUPMSG="$ES_SELECTSETUPMSG" fi sitert=http://download.videolan.org/ site=${sitert}pub/debian/stable/ arch=$(dpkg --print-architecture) CSSTMP=$(mktemp -t -d dvdcss-XXXXXX) soname=2 uversion=1.2.13 available="i386 amd64" version=${uversion}-0 DESTINO="/home/"$SUDO_USER"/" # Downloads the package list and greps the most recent package to download and save it in $CSSTMP folder as libdvdcss.deb downloadcss() { rc=0 wget "${site}/Packages" -O "$CSSTMP"/Packages && \ url=${site}$(grep "Filename: .*libdvdcss${soname}.*${arch}.*\.deb" "$CSSTMP"/Packages|sed 's/Filename: //'|head -n 1) && \ wget "${url}" -O "$CSSTMP"/libdvdcss.deb || rc=1 if [ $rc -eq 1 ]; then zenity --error --text="$ERRORDOWN" exit 0 fi } # Copies $CSSTMP/libdvdcss.deb to the user selected location savecss() { FILE=`zenity --file-selection --save --filename=$DESTINO"libdvdcss.deb" --title="$SELECTIONMSG"` case $? in 0) cp $CSSTMP"/libdvdcss.deb" $FILE && zenity --info "\"$FILE\"" --text="$COPIEDMSG";; 1) zenity --error --text="$ERRORSELMSG";; -1) zenity --error --text="$ERRORSELMSG";; esac } # Copies the user selected package to $CSSTMP/libdvdcss.deb copycss() { FILE=`zenity --file-selection --filename=$DESTINO"libdvdcss.deb" --title="$PKGSELMSG"` case $? in 0) cp $FILE $CSSTMP ;; 1) zenity --error --text="$ERRORSELMSG";; -1) zenity --error --text="$ERRORSELMSG";; esac } # Installs libdvdcss package installcss() { gdebi -n "$CSSTMP"/libdvdcss.deb && zenity --info --text="$ACTIVATIONMSG" && zero-center set-configured install-dvdcss } # Main menu resp=`zenity --list --radiolist --hide-header --width="300" --title="$SELECTMSG" \ --column="Radio" --column="Number" --column="Action" \ TRUE 1 "$DLDSETUPMSG" \ FALSE 2 "$DLDSAVEMSG" \ FALSE 3 "$SELECTSETUPMSG"` case $resp in 1) downloadcss && installcss;; 2) downloadcss && savecss;; 3) copycss && installcss;; esac exit 0