#!/bin/bash # File: # Description: install and configuration libdvdcss for LliureX # Authors: # José Carlos García # Alfons Lloret Sananton # # 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 of the License, 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., # 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA # -------- # 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 # Some variables needed to make the script a bit more manageable dist=$(lsb_release -cs) rooturl=http://packages.medibuntu.org/ pkglisturl=${rooturl}dists/${dist}/free/binary-i386/Packages CSSTMP=$(mktemp -t -d dvdcss-XXXXXX) soname=2 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 $pkglisturl -O "$CSSTMP"/Packages && url=${rooturl}$(grep "Filename: .*libdvdcss${soname}.*\.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-sqlmanager -s install-dvdcss 1 } # 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