Questo script permnette di creare in pacchetto debian per MPlayer scaricando e compilando tutto il necessario: pacchetti debian, sorgenti mplayer, skin, codec, font, libreria LIVE.COM. Tramite un interfaccia 'dialog' è possibile scegliere cosa installare e cosa no e se usare l'ultima versione stabile o lo snapshot giornaliero del cvs per MPlayer.
Questo script permnette di creare in pacchetto debian per MPlayer scaricando e compilando tutto il necessario: pacchetti debian, sorgenti mplayer, skin, codec, font, libreria LIVE.COM. Tramite un interfaccia 'dialog' è possibile scegliere cosa installare e cosa no e se usare l'ultima versione stabile o lo snapshot giornaliero del cvs per MPlayer.
- Lo script si auto-aggiorna in modo che se cambiano gli URL e io li aggiorno tutti ne beneficiano. Questa funzionalità si può disattivare con l'opzione -f (oppure --nofresh) dalla linea di comando.
- Lo script usa del testo colorato, e si presuppone che lo sfondo del terminale sia nero (o scuro). Se hai problemi nel visualizzare certe parole e non vuoi cambiare lo sfondo del tuo terminale, puoi disattivare i colori per lo script con l'opzione da linea di comando -n (oppure --nocolor).
Ecco a voi lo script:
# Antonio Ingargiola (debian@fastwebnet.it) 10 Sept - 2004 # Updated versions of this script can be found here: # http://gnuaction.altervista.org/sections/About/Antonio/compilamplayer # # Briefly, WHAT does this script? # - Create a .deb package for MPlayer with all the optimization for # your machine, with your locale, with the only proprietary codecs that # don't have a free equivalent. You can chose a lot of parameters througth # a user-friendly 'dialog' interface. # # WHAT steps does it follow? # - Install all the needed packages througth apt-get (customizable) # - Download: MPlayer source, font, skin, livemedia lib, codecs # - Put the codecs in the appropriate system dir (customizable) # - Tweaks debian/rules in the MPlayer source to make a .deb optimized for # your system. # - Compile MPlayer througth fakeroot to make the .deb package # - Put font and skin in the appropriate system dir (customizable) # # WHY to use? # - If you are lazy and want MPlayer compiled with all the optimization for # your machine, with your locale, with the only proprietary codecs that # don't have a free equivalentand and want a .deb for it for an easy # [un]installation. # - If you want to install only font and/or skin for an MPlayer that you # installed your own. # - If you want to install the LIVE.COM library, indipendently from the fact # that you have or not MPlayer. # # What are the good thinks of this script? # - Don't donwload twice the files (if found in the current dir) # - Easily chose what step to perform and what not through a user-friendly # 'dialog' interface. For example, can be installed only font and skin, or # you can make only the configure step (and don't compile MPlayer). # - Don't overwrite the old codecs dir, creating codecs.old. If codecs.old # exist will not be overwritten: the first backup is preserved. So if you # run the script twice, you don't lose the first backup of your codecs. # - The same also for the skin and the LIVE.COM dir. # - It tweaks debian/rules in the MPlayer source to make a .deb optimized for # your system. # - You can easily change: font encoding, font size, language, configure # options, archive's URLs and directories througth dedicated variables # putted at the beginnig of the file. # - It's an example of what nice thinks can be done with bash. # - Just one file. # - Under GNU GPL. # # What are the bad thinks? # - You must be root (or give the root's password) to run it. # - Works only for Debian Sarge and Sid. # - One file: it's increasing a lot. # - Maybe some bug? Tell me if you find some... # # *** Distributed under the GNU GPL Licence *** # # USAGE: compilamplayer [-s|--script] [-d|--dummy] # -s or --script: no confirm will be asked at each step # -l or --live : download and use the LIVE.COM library # -c or --cvs : use the daily cvs snapshot of MPlayer # -d or --dummy : only configure will be made, then exits (usefull for debug) # -n or --nocolor: don't use colorized text # -f or --nofresh: don't try to download newer version of this script # -h or --help : only this help will be showed then exits # # NOTE: The LIVE.COM library is compilable only with the cvs snapshot # # # Based on : # compilamplayer.sh by Benno Senoner (benno@linuxdesktop.it) # modificata da krakz (krakz@spacelab.it) # distributed under the GNU GPL License # http://www.linuxdesktop.it/mplayer # ___
#!/bin/bash # %%%%%%%%%% BEGIN USER MODIFICABLE VARIABLES %%%%%%%%%% LANGUAGE="it" # Available: bg cz de dk el en es fr hu it ja ko mk nl no pl ro ru sk tr uk pt_BR zh_CN zh_TW all FONT_SIZE="24" # The osd font, choose between: 14, 18, 24, 28 FONT_ENCODING="iso-8859-1" # Archives's URL for source, codecs, skin, font. CHANGE ONLY THEESE (ideally) IF THE UPSTREAM ARCHIVES CHANGE. URL_MPLAYER="http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0pre5.tar.bz2" URL_ESSENTIAL_CODECS="http://www1.mplayerhq.hu/MPlayer/releases/codecs/essential-20040809.tar.bz2" URL_DEFAULT_SKIN="http://www1.mplayerhq.hu/MPlayer/Skin/Blue-1.4.tar.bz2" URL_FONTS="http://www1.mplayerhq.hu/MPlayer/releases/fonts/font-arial-$FONT_ENCODING.tar.bz2" URL_LIVEMEDIA="http://live.com/liveMedia/public/live.2004.09.09.tar.gz" URL_MPLAYER_CVS="http://www1.mplayerhq.hu/MPlayer/cvs/MPlayer-current.tar.bz2" # System dirs (they are here because CONFIGURE_OPTION may need them) CODECS_DIR="/usr/local/lib/codecs" # *** Default positions taken from README *** MPLAYER_DIR="/usr/share/mplayer" # --> System directory for skins e fonts FONTS_SUBDIR="font" # -> Sub-directory of MPLAYER_DIR used for the fonts SKIN_SUBDIR="Skin" # -> Sub-directory di MPLAYER_DIR used for the skins LIVEMEDIA_DIR="/usr/local/lib" # Dir for the LIVE.COM library # Option passed to the configure, keep present that the following options are yet in debian/rules: # --prefix=/usr --confdir=/etc/mplayer --disable-runtime-cpudetection --enable-gui # If -l or --live is passed then will be automatically added --enable-live CONFIGURE_OPTIONS="--language=$LANGUAGE --enable-menu --with-codecsdir=$CODECS_DIR" # Packages needed for the download and compilation BUILD_PACKAGES="autoconf libconfhelper-perl dh-make dh-buildinfo debconf fakeroot wget" LIBRARY_PACKAGES="libpng3-dev libjpeg-dev libvorbis-dev xlibs-dev libgtk1.2-dev libsdl1.2-dev" # %%%%%%%%%% END OF USER MODIFICABLE VARIABLES %%%%%%%%%% # Subdir of the choosen font (choose the dimention) FONT_NAME="font-arial-$FONT_SIZE-$FONT_ENCODING" # Dir names impossible to extrapolate and thus setted manually DIR_LIVEMEDIA_TAR="live" # Archives names (don't need to change, it's robust) TARFILE_MPLAYER=$( echo $URL_MPLAYER | rev | cut -d/ -f1 | rev ) TARFILE_ESSENTIAL_CODECS=$( echo $URL_ESSENTIAL_CODECS | rev | cut -d/ -f1 | rev ) TARFILE_DEFAULT_SKIN=$( echo $URL_DEFAULT_SKIN | rev | cut -d/ -f1 | rev ) TARFILE_FONTS=$( echo $URL_FONTS | rev | cut -d/ -f1 | rev ) TARFILE_LIVEMEDIA=$( echo $URL_LIVEMEDIA | rev | cut -d/ -f1 | rev ) TARFILE_MPLAYER_CVS=$( echo $URL_MPLAYER_CVS | rev | cut -d/ -f1 | rev ) UPSTREAM_SCRIPT_URL="http://gnuaction.altervista.org/sections/About/Antonio/compilamplayer" # OTHER INTERNAL VARIABLES ############################################ ME=`basename $0` ROOT_UID=0 DIALOG_TMP_FILE="/tmp/dialog_compilamplayer" NEW_VERSION_TMP_FILE="/tmp/new_version_compilamplayer" RE_EXECUTING_AS_ROOT_TMP_FILE="/tmp/not_root_compilamplayer" ARCH_LIST_TMP_FILE="/tmp/list_compilamplayer" ON_EXIT="rm -f $DIALOG_TMP_FILE $NEW_VERSION_TMP_FILE $RE_EXECUTING_AS_ROOT_TMP_FILE $ARCH_LIST_TMP_FILE 2> /dev/null" ####################################################################### # COLORS ALIAS ######################################################## BLACK="\e[0;30m"; WHITE="\e[1;37m" GRAY="\e[1;30m"; LGRAY="\e[0;37m" RED="\e[0;31m"; LRED="\e[1;31m" GREEN="\e[0;32m"; LGREEN="\e[1;32m" BROWN="\e[0;33m"; YELLOW="\e[1;33m" BLUE="\e[0;34m"; LBLUE="\e[1;34m" PURPLE="\e[0;35m"; PINK="\e[1;35m" CYAN="\e[0;36m"; LCYAN="\e[1;36m" Z="\e[0m" ####################################################################### # UTILITY FUNCTIONS ################################################### pause () { if [ $SCRIPT = 0 ]; then echo -e "\n ${LGREEN}>>>$Z Premi ${WHITE}INVIO$Z per continuare o ${WHITE}CTRL+c$Z per interrompere ${LGREEN}<<<$Z" read fi } result () { if [[ $1 == 0 ]]; then echo -e " [ ${LGREEN}OK$Z ]\n" else echo -e " [ ${LRED}FALLITO$Z ]\n" fi } item () { echo -e " ${LGREEN}*$Z $1" } onoff () { if [ $1 = 1 ]; then echo -en "on" elif [ $1 = 0 ]; then echo -en "off" else echo -en "errore_onoff" fi } arch_type () { SUFFIX=`echo $1 | rev | cut -d. -f1 | rev` case "$SUFFIX" in "gz" | "tgz" ) echo -n "z" ;; "bz2" | "tbz" | "tbz2" ) echo -n "j" ;; *) echo -n "errore_nella_funzione_arch_type";; esac } nocolor () { BLACK=""; WHITE=""; GRAY=""; LGRAY=""; RED=""; LRED=""; GREEN=""; LGREEN=""; BROWN=""; YELLOW=""; BLUE=""; LBLUE=""; PURPLE=""; PINK=""; CYAN=""; LCYAN=""; Z=""; } download () { local URL=$1 local FILE=$2 wget -v -c $URL res=$? result $res if [[ $res != 0 ]]; then echo -e "\n *** ERRORE:"; echo -e " Fallito il download del file: ${WHITE}${URL}$Z"; echo -e " controllare se la connessione a Internet e' OK."; else [ -n "$FILE" ] && [ -f "$FILE" ] && chmod a+rw $FILE fi return $res } extract_arch () { # WARNING: it deletes previous omonimous dir local TAR=$1 local TMP_DIR="tmp_dir" # Note that DIR is global and can be saved. # - > the first sed print the first line, the second remove the / rm -rf $TMP_DIR; mkdir $TMP_DIR tar `arch_type $TAR`vxf $TAR -C $TMP_DIR > $ARCH_LIST_TMP_FILE &&\ DIR=`cat $ARCH_LIST_TMP_FILE | sed -n '1p' | sed 's/\///g'` &&\ if [ -d "$DIR" ]; then rm -rf "$DIR"; fi &&\ mv $TMP_DIR/$DIR . &&\ chmod -R a+wr "$DIR" res=$? rm -f $ARCH_LIST_TMP_FILE rm -rf $TMP_DIR result $res return $res } create_dir () { local DIR=$1; local NOBACKUP=$2; # if != NULL then don't make backup if [ -z "$DIR" ]; then return elif [ -d $DIR ]; then if [ -n "$NOBACKUP" ]; then rm -rf "$DIR" && echo -e " - Vecchia ${WHITE}$DIR$Z eliminata (backup non richiesto)." elif [ -d "$DIR.old" ]; then rm -rf "$DIR" && echo -e " - Vecchia ${WHITE}$DIR$Z eliminata: esisteva un precedente backup." else mv "$DIR" "$DIR.old" && echo -e " - Vecchia ${WHITE}$DIR$Z salvata in ${WHITE}$DIR.old$Z" fi fi mkdir $DIR } helpme () { echo -e "\n ${LGREEN}>>> ${WHITE}Programma $ME ${LGREEN}<<<$Z\n" echo -e " Questo script crea un pacchetto .deb di MPlayer.\n" echo -e " ${WHITE}USO:$Z\n $WHITE$ME$Z [-s|--script] [-d|--dummy] [-l|--live] [-h|--help]\n" echo -e " ${WHITE}Parametri (opzionali):$Z" echo -e " ${LGREEN}* ${WHITE}-s$Z oppure ${WHITE}--script$Z : ad ogni passo non verra' chiesta alcuna conferma." echo -e " ${LGREEN}* ${WHITE}-c$Z oppure ${WHITE}--cvs$Z : usa il daily snapshot del cvs di MPlayer." echo -e " ${LGREEN}* ${WHITE}-l$Z oppure ${WHITE}--live$Z : abilita il suppoprto LIVE.COM (usare solo con -c)." echo -e " ${LGREEN}* ${WHITE}-d$Z oppure ${WHITE}--dummy$Z : esegue solo il configure ed esce." echo -e " ${LGREEN}* ${WHITE}-n$Z oppure ${WHITE}--nocolor$Z : non usa il testo colorato." echo -e " ${LGREEN}* ${WHITE}-f$Z oppure ${WHITE}--nofresh$Z : non cerca di scaricare una nuova versione di questo script." echo -e " ${LGREEN}* ${WHITE}-h$Z oppure ${WHITE}--help$Z : mostra questo aiuto ed esce.\n" echo -e " ${WHITE}NOTA:$Z La libreria LIVE.COM e' compilabile solo con lo snapshot del cvs.\n" exit } ######################################################################## # PARAMETERS' PARSING ################################################## SCRIPT=0 DUMMY=0 LIVE=0 CVS=0 NO_NEW_VERSION=0 PARAM="$@" until [ -z "$1" ] # Until all parameters used up... do if [ x$1 = "x-s" ] || [ x$1 = "x--script" ]; then SCRIPT=1; elif [ x$1 = "x-d" ] || [ x$1 = "x--dummy" ]; then DUMMY=1; elif [ x$1 = "x-l" ] || [ x$1 = "x--live" ]; then LIVE=1; elif [ x$1 = "x-c" ] || [ x$1 = "x--cvs" ]; then CVS=1; elif [ x$1 = "x-f" ] || [ x$1 = "x--nofresh" ]; then NO_NEW_VERSION=1; elif [ x$1 = "x-n" ] || [ x$1 = "x--nocolor" ]; then nocolor elif [ x$1 = "x-h" ] || [ x$1 = "x--help" ]; then helpme else echo -e " Parametro $WHITE$1$Z ignorato." fi shift done ######################################################################## # THE VERY BEGINNING ################################################### trap "$ON_EXIT" 0 15 # if not jet done, download the latest version of the script and execute it if [ $NO_NEW_VERSION = 0 ] && [ ! -f $NEW_VERSION_TMP_FILE ]; then :> $NEW_VERSION_TMP_FILE clear; echo; item "Provo a scaricare la verione aggionata di ${WHITE}$ME$Z\n" SCRIPT_NAME=`echo $UPSTREAM_SCRIPT_URL | rev | cut -d/ -f1 | rev` wget $UPSTREAM_SCRIPT_URL -O $SCRIPT_NAME && [ ! -f not_found.html ] res=$? rm -f not_found.html result $res if [ $res = 0 ]; then item "Ho scaricato la nuova versione, ora la eseguo ...\n" chmod a+x $SCRIPT_NAME pause exec ./$SCRIPT_NAME $PARAM else echo -e " - Impossibile scaricare una nuova versione, continuo ugualmente.\n" fi pause fi # Consistency of the passed parameters if [ $LIVE = 1 ] && [ $CVS = 0 ]; then echo -e "\n ${LRED}***$Z ${WHITE}Errore$Z: l'opzione ${WHITE}-l$Z (--live) puo' essere usata sono assieme a ${WHITE}-c$Z (--cvs).\n" helpme fi # If I'm re-executing myself as root don't show the welcome again if [ ! -f $RE_EXECUTING_AS_ROOT_TMP_FILE ]; then clear echo -e "\n ${WHITE}BENVENUTI$Z in ${LGREEN}$ME$Z\n" else echo -e "\n" item "Bene, adesso ho i permessi. Proseguiamo ... \n" rm -f $RE_EXECUTING_AS_ROOT_TMP_FILE fi if [ "$UID" -ne "$ROOT_UID" ]; then echo -e " Purtroppo e' necessario eseguire questo script come ${LRED}root$Z.\n" echo -e " Questo perche' per instalare i pacchetti necessari con ${WHITE}apt-get$Z" echo -e " e per copiare ${WHITE}codec$Z, ${WHITE}font$Z e ${WHITE}skin$Z nelle directory di sistema" echo -e " sono necessari i privileggi dell'aministratore." echo -en "\n Inserisci perfavore la ${WHITE}password di root$Z.\n " :> $RE_EXECUTING_AS_ROOT_TMP_FILE RETRY="" for n in `seq 2 4`; do echo -e "$RETRY" # Become root and re-execute myself su -c "$0 $PARAM" && exit RETRY="\n ${LGREEN}>>>$Z Password errata, si prega di riprovare (tentativo ${LGREEN}$n$Z di ${LGREEN}3$Z): \n" done #e rm -f $RE_EXECUTING_AS_ROOT_TMP_FILE #e rm -f $NEW_VERSION_TMP_FILE echo -e "\n Spiacente, password errata. Riprova rieseguendo lo script.\n" exit fi # From here I'm root # Default values that cannot be choosen from the command line DEB=1; CODEC=1; SKIN=1; FONT=1; APT=1 # DIALOG ############################################################### if [ $SCRIPT = 0 ]; then DIALOG_OK=0; DIALOG_CANCEL=1; DIALOG_ESC=255 :> $DIALOG_TMP_FILE dialog --backtitle "Compila MPlayer" \ --title " Scegli le operazioni da compiere " \ --checklist "Quali operazioni vuoi che siano svolte? Considera che se\ scegli LIVE.COM devi anche scegliere CVS. Se sei insicuro premi semplicemente OK." 19 74 10 \ "Crea_il_pacchetto_.deb" "" `onoff $DEB` \ "Usa_il_CVS_invece_della_versione_stabile" "" `onoff $CVS` \ "Installa_pacchetti_debian_necessari" "" `onoff $APT` \ "Installa_libreria_LIVE.COM" "" `onoff $LIVE` \ "Installa_i_codec" "" `onoff $CODEC` \ "Installa_la_skin" "" `onoff $SKIN` \ "Installa_i_caratteri" "" `onoff $FONT` \ "Non_chiedere_conferma_per_le_operazioni" "" off \ "-------------------" "" off \ "Esegui_solo_il_configure" "" `onoff $DUMMY` 2> $DIALOG_TMP_FILE retval=$? # Has been pressed OK, Cancel or ESC ? case $retval in $DIALOG_OK) choice=`cat $DIALOG_TMP_FILE` # Load the dialog's output clear; echo;; $DIALOG_CANCEL) echo -e "\n Esecuzione annullata.\n" exit;; $DIALOG_ESC) echo -e "\n Esecuzione interrotta.\n" exit;; *) clear; echo " Codice di ritorno inatteso: $retval" echo " Sono stato ucciso in maniera brutale.\n" exit;; esac item "Sono state scelte le seguenti opzioni:" # Theese are needed to set correctly to 0 variables that were setted to 1 DEB_TMP=0; CVS_TMP=0; APT_TMP=0; LIVE_TMP=0; CODEC_TMP=0; SKIN_TMP=0; FONT_TMP=0; SCRIPT_TMP=0; DUMMY_TMP=0; for opt in `echo $choice | sed -e "s/\"//g" | sed -e "s/-------------------//" | sed -e "s/ /\n/g"` do echo " - `echo $opt | sed -e \"s/_/ /g\"`" # Remove the underscores if [ "$opt" = "Crea_il_pacchetto_.deb" ]; then DEB_TMP=1; fi if [ "$opt" = "Usa_il_CVS_invece_della_versione_stabile" ]; then CVS_TMP=1; fi if [ "$opt" = "Installa_pacchetti_debian_necessari" ]; then APT_TMP=1; fi if [ "$opt" = "Installa_libreria_LIVE.COM" ]; then LIVE_TMP=1; fi if [ "$opt" = "Installa_i_codec" ]; then CODEC_TMP=1; fi if [ "$opt" = "Installa_la_skin" ]; then SKIN_TMP=1; fi if [ "$opt" = "Installa_i_caratteri" ]; then FONT_TMP=1; fi if [ "$opt" = "Non_chiedere_conferma_per_le_operazioni" ]; then SCRIPT_TMP=1; fi if [ "$opt" = "Esegui_solo_il_configure" ]; then DUMMY_TMP=1; fi done; echo DEB=$DEB_TMP; CVS=$CVS_TMP; APT=$APT_TMP; LIVE=$LIVE_TMP; CODEC=$CODEC_TMP; SKIN=$SKIN_TMP; FONT=$FONT_TMP; SCRIPT=$SCRIPT_TMP; DUMMY=$DUMMY_TMP; fi # END DIALOG ########################################################### # Are you sure that there is really something to do? [ $DEB = 1 ] || [ $APT = 1 ] || [ $LIVE = 1 ] ||\ [ $CODEC = 1 ] || [ $SKIN = 1 ] || [ $FONT = 1 ] ||\ { echo -e "\n Nessuna operazione da svolgere. Scegliere almeno una tra:\n" item "`echo Crea_il_pacchetto_.deb | sed -e \"s/_/ /g\"`" item "`echo Installa_pacchetti_debian_necessari | sed -e \"s/_/ /g\"`" item "`echo Installa_libreria_LIVE.COM | sed -e \"s/_/ /g\"`" item "`echo Installa_i_codec | sed -e \"s/_/ /g\"`" item "`echo Installa_la_skin | sed -e \"s/_/ /g\"`" item "`echo Installa_i_caratteri | sed -e \"s/_/ /g\"`\n" rm -f $NEW_VERSION_TMP_FILE exit } if [ $LIVE = 1 ] && [ $DEB = 1 ] && [ $CVS = 0 ]; then echo -e "\n ${LRED}***$Z ${WHITE}Errore$Z: per usare le ${WHITE}LIVE.COM$Z e' necessario usare la versione ${WHITE}CVS$Z.\n" helpme fi if [ $DEB = 1 ] || [ $DUMMY = 1 ]; then echo -e " Questo script scarichera' vari archivi e creera' un pacchetto per" if [ $CVS = 0 ]; then echo -e " l'ultima ${YELLOW}versione stabile$Z di ${WHITE}MPlayer$Z ($DIR_SRC_MPLAYER).\n" else echo -e " l'ultima ${YELLOW}versione di sviluppo$Z aggiornata giornalmente di ${WHITE}MPlayer$Z.\n" URL_MPLAYER="$URL_MPLAYER_CVS" TARFILE_MPLAYER="$TARFILE_MPLAYER_CVS" fi fi echo -e " E' consigliabile eseguire questo script dentro un'apposita directory" echo -e " per non ritrovarsi con gli archivi, e le directory create da questo script" echo -e " in mezzo ai vostri file." pause if [ $APT = 1 ]; then item "Installo i pacchetti debian necessari alla compilazione di MPlayer:\n" apt-get install $BUILD_PACKAGES $LIBRARY_PACKAGES result $? pause fi # --- --- section download --- --- if [ $DEB = 1 ] || [ $DUMMY = 1 ]; then item "Scarico i ${YELLOW}sorgenti$Z di MPlayer (${WHITE}$TARFILE_MPLAYER$Z):" download $URL_MPLAYER $TARFILE_MPLAYER || exit fi if [ $CODEC = 1 ]; then item "Scarico i ${YELLOW}codec$Z per MPlayer (${WHITE}$TARFILE_ESSENTIAL_CODECS$Z): DMO,Indeo,QT,Real,3ivX" download $URL_ESSENTIAL_CODECS $TARFILE_ESSENTIAL_CODECS || exit fi if [ $SKIN = 1 ]; then item "Scarico la ${YELLOW}skin$Z principale di MPlayer (${WHITE}$TARFILE_DEFAULT_SKIN$Z):" download $URL_DEFAULT_SKIN $TARFILE_DEFAULT_SKIN || exit fi if [ $FONT = 1 ]; then item "Scarico i ${YELLOW}font$Z per MPlayer (${WHITE}$TARFILE_FONTS$Z):" download $URL_FONTS $TARFILE_FONTS || exit fi if [ $LIVE = 1 ]; then item "Scarico la libreria ${YELLOW}LIVE.COM$Z (${WHITE}$TARFILE_LIVEMEDIA$Z):" download $URL_LIVEMEDIA $TARFILE_LIVEMEDIA download_ok=$? if [ ! $download_ok = 0 ] && [ -f $TARFILE_LIVEMEDIA ]; then echo -e "\n - Anche se il download ha restituito un errore, esiste un archivio" echo -e " delle librerie LIVE.COM nella directory corrente.\n" echo -en " - Eseguo un controllo di intergrita' ... " tar `arch_type $TARFILE_LIVEMEDIA`tf $TARFILE_LIVEMEDIA &> /dev/null consistent=$? result $consistent if [ ! $consistent = 0 ]; then echo -e " - Il controllo d'integrita' ha restituito un errore, ${YELLOW}continuo senza le LIVE.COM$Z.\n" LIVE=0 fi pause elif [ ! $download_ok ] && [ ! -f $TARFILE_LIVEMEDIA ]; then # the file does not exist echo -e " - Non e' stato possibile scaricare la libreria ${WHITE}LIVE.COM$Z, continuo senza.\n" LIVE=0 pause fi fi if [ $DEB = 1 ] || [ $DUMMY = 1 ] || [ $SKIN = 1 ] || [ $FONT = 1 ] || [ $LIVE = 1 ] then echo -e "\n Ho scaricato quanto richiesto, internet non mi serve piu'." pause fi # --- --- end section download --- --- if [ $DEB = 1 ] || [ $DUMMY = 1 ]; then item "Decomprimo i sorgenti di MPlayer ($TARFILE_MPLAYER)" extract_arch $TARFILE_MPLAYER DIR_SRC_MPLAYER="$DIR" fi if [ $CODEC = 1 ]; then item "Creo la directory ${WHITE}$CODECS_DIR$Z" create_dir $CODECS_DIR result $? item "Decomprimo i codec dell'archivio ${WHITE}$TARFILE_ESSENTIAL_CODECS$Z" extract_arch $TARFILE_ESSENTIAL_CODECS DIR_ESSENTIAL_CODECS_TAR="$DIR" item "Copia di ${WHITE}$DIR_ESSENTIAL_CODECS_TAR$Z in ${WHITE}$CODECS_DIR$Z" cp -Rf $DIR_ESSENTIAL_CODECS_TAR/* $CODECS_DIR result $? fi if [ $LIVE = 1 ]; then if [ ! -d $DIR_LIVEMEDIA_TAR ]; then item "Decomprimo la libreria ${WHITE}LIVE.COM$Z" extract_arch $TARFILE_LIVEMEDIA DIR_LIVEMEDIA_TAR="$DIR" fi # Check if it is jet compiled, if there are object (.o) files in the last compiled dir # *** lack a robust metod to see if the library is correctly compiled, ideas? *** res_compilation=0 if ls $DIR_LIVEMEDIA_TAR/testProgs/*.o &> /dev/null then item "Sembra che le ${WHITE}LIVE.COM$Z siano gia' compilate, passo avanti.\n" else item "Compilo la libreria ${WHITE}LIVE.COM$Z" cd $DIR_LIVEMEDIA_TAR ./genMakefiles linux &&\ make res_compilation=$? result $res_compilation cd .. fi # The following cause an error if the library if half-compiled (ie the compilation was aborted the previous time) # # if was jet compiled, or compilation is gone without errors if [ $res_compilation = 0 ]; then item "Copio la libreria ${WHITE}LIVE.COM$Z in ${WHITE}$LIVEMEDIA_DIR$Z" create_dir "$LIVEMEDIA_DIR/$DIR_LIVEMEDIA_TAR" &&\ cp -r $DIR_LIVEMEDIA_TAR $LIVEMEDIA_DIR result $? fi fi # PACKAGE CREATION ****************************\ if [ $DEB = 1 ] || [ $DUMMY = 1 ]; then cd $DIR_SRC_MPLAYER item "Disabilito il rilevamento del tipo di cpu a runtime (migliori prestazioni)" sed -e "s/--enable-/--disable-/" debian/rules > debian/rules.tmp &&\ mv -f debian/rules.tmp debian/rules &&\ chmod a+x debian/rules result $? item "Sostituisco $WHITE/bin/sh$Z con $WHITE/bin/bash$Z in ${YELLOW}help/help_diff.sh$Z,\n perche' la sua sintassi e' bash." sed -e "1s/\/sh/\/bash/" help/help_diff.sh > help/help_diff.sh.tmp &&\ mv -f help/help_diff.sh.tmp help/help_diff.sh &&\ chmod a+x help/help_diff.sh result $? echo -e "\n Sono pronto per compilare, procedere?" pause item "Creazione del pacchetto" [ $LIVE = 1 ] && CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-live" # To compile or to configure? if [ $DUMMY = 1 ]; then ./configure --prefix=/usr --confdir=/etc/mplayer --disable-runtime-cpudetection --enable-gui $CONFIGURE_OPTIONS #awk '{ variabile+=1; perc=variabile/230*100; print perc }' |\ # dont' know why does not work #cut -d, -f1 |\ #dialog --backtitle "Compialazione MPlayer ..." --gauge "Compilazione in corso ..." 7 50 item "Ecco il comando lanciato:\n" echo -e "./configure --prefix=/usr --confdir=/etc/mplayer --disable-runtime-cpudetection --enable-gui $CONFIGURE_OPTIONS\n" exit else DEB_BUILD_OPTIONS="$CONFIGURE_OPTIONS" fakeroot debian/rules binary res=$? fi cd .. ; chmod -R a+w $DIR_SRC_MPLAYER echo -en " Risultato della compilazione: " result $res if [[ $res != 0 ]]; then exit 0; fi # So surely terminate, also if it returns # in the previous normal user call chmod a+w *.deb pause fi # *********************************************/ if [ $FONT = 1 ] || [ $SKIN = 1 ]; then if [ ! -d "$MPLAYER_DIR" ]; then item "Creo la directory di sistema per MPlayer: ${WHITE}${MPLAYER_DIR}$Z\n" mkdir "$MPLAYER_DIR"; result $? fi fi if [ $SKIN = 1 ]; then item "Creo la directory (${WHITE}$MPLAYER_DIR/$SKIN_SUBDIR$Z) per le skin." create_dir "$MPLAYER_DIR/$SKIN_SUBDIR" result $? item "Decomprimo la skin principale di MPlayer ($TARFILE_DEFAULT_SKIN):" extract_arch "$TARFILE_DEFAULT_SKIN" DIR_DEFAULT_SKIN_TAR="$DIR" item "Imposto la skin ${WHITE}${DIR_DEFAULT_SKIN_TAR}$Z come la default." cp -Rf "$DIR_DEFAULT_SKIN_TAR" "$MPLAYER_DIR/$SKIN_SUBDIR" &&\ ln -sf "$MPLAYER_DIR/$SKIN_SUBDIR/$DIR_DEFAULT_SKIN_TAR" "$MPLAYER_DIR/$SKIN_SUBDIR/default" result $? fi if [ $FONT = 1 ]; then item "Creo la directory per i font di MPlayer (${WHITE}$MPLAYER_DIR/$FONTS_SUBDIR$Z):" create_dir "$MPLAYER_DIR/$FONTS_SUBDIR" nobackup result $? item "Decomprimo i font ${WHITE}$TARFILE_FONTS$Z" extract_arch "$TARFILE_FONTS" DIR_FONTS_TAR="$DIR" item "Copio i font ${WHITE}$DIR_FONTS_TAR/$FONT_NAME/*$Z in ${WHITE}$MPLAYER_DIR/$FONTS_SUBDIR$Z" cp "$DIR_FONTS_TAR/$FONT_NAME/"* "$MPLAYER_DIR/$FONTS_SUBDIR" result $? fi echo -e "\n Le operazioni richieste sono state terminate.\n Arrivederci!\n " #e [ -f "$NEW_VERSION_TMP_FILE" ] && rm -f $NEW_VERSION_TMP_FILE exit 0 # So surely terminate, also if it returns in the previous normal user call
Buon divertimento!
Antonio



Commenti
Inviato da ED3nuzzo il Mer, 15/09/2004 - 10:37.
Ucciosione brutale :D
Ciao antonio, ho creato un file .sh gli ho dato i permessi di esecuzione(chmod +x) e l'ho runnato da root. Solo che una volta finito di scaricare qualcosa dal tuo sito, lo script mi restituisce questo errore
Che può essere?
"Perchè tanto Debian è meglio"
Running on Debian Gnu/Linux 3.1 Kernel 2.4.27
ed3nuzzo@gmail.com
Inviato da Antonio il Mer, 15/09/2004 - 11:07.
Re: Ucciosione brutale :D
Probabilmente ti mancano wget e/o dialog, prova ad installarli:
apt-get install wget dialog
Devo inserire un controllo iniziale prima di usarli. Grazie mille per la segnalazione e dimmi se riesci a creare il pacchetto.
PS: Dal mio sito scarica se stesso aggiornato, in modo che se cambiano gli url ed esempio dei codec, basta che li corrego io e il tuo script si auto-aggiorna. Puoi disabilitare questa funzione con l'opzione -f.
[GNU Action] - The OSS Revolution
Inviato da Antonio il Mer, 15/09/2004 - 11:13.
Re: Ucciosione brutale :D
Dimenticavo: lo script può avere qualsiasi nome (basta che sia eseguibile) e può essere eseguito con riferimento diretto:
$ ./compilamplayer
oppure può essere inserito nel path, ma non può essere eseguito così:
$ sh compilamplayer
[GNU Action] - The OSS Revolution
Inviato da ED3nuzzo il Mer, 15/09/2004 - 11:26.
Re: Ucciosione brutale :D
Grazie mille Antonio. Sembrava mancare Dialog(che sarebbe?)
Ho riavviato lo script e adesso è partito. Sta scaricando tutto l'occorrente con apt. Speriamo funzioni
"Perchè tanto Debian è meglio"
Running on Debian Gnu/Linux 3.1 Kernel 2.4.27
ed3nuzzo@gmail.com
Inviato da Antonio il Mer, 15/09/2004 - 11:35.
Re: Ucciosione brutale :D
Quel programmino che permette di fare apparire l'interfaccia blu, con i riquadri e l'opziioni da scegliere, mica l'ho fatto io quello
Strano che non l'avevi, di solito viene usato quando configuri i pacchetti che installi.
[GNU Action] - The OSS Revolution
Inviato da ED3nuzzo il Mer, 15/09/2004 - 11:59.
Re: Ucciosione brutale :D
Mmh...vero
Cmq, lo script s'è compilato mplayer e ha creato il pacchetto .deb. L'ho installato e ho avuto due problemucci
Il primo relativo ai font:
Questo credo di aver capito cm risolvere(ma nn ne sono sicuro).
Il secondo invece(forse sarà; un problema mio
E il filmato parte con scatti(sia video che audio)
Cosa può essere?
Grazie di tutto cmq
"Perchè tanto Debian è meglio"
Running on Debian Gnu/Linux 3.1 Kernel 2.4.27
ed3nuzzo@gmail.com
Inviato da Antonio il Mer, 15/09/2004 - 12:14.
Re: Ucciosione brutale :D
Per quanto riguarda il primo problema, non trova i font. Probabilmente non hai selezionato la casella installa caratteri quando hai eseguito lo script. Prova a rieseguirlo selezionando solo la voce installa caratteri e tutto dovrebbe mettersi a posto.
Per quando riguarda il secondo problema, per caso usi oss come default (invece di alsa)?
Potresti avere anche un demone che come artsd o esd che ti blocca l'accesso alla scheda audio.
Inoltre con "dpkg-reconfigure mplayer" puoi scegliere un'altro l'output di default di MPlayer (di solito xv dovrebbe essere il migliore ma per alcune schede videoi x11 funziona meglio)
[GNU Action] - The OSS Revolution
Inviato da ED3nuzzo il Mer, 15/09/2004 - 12:59.
Re: Ucciosione brutale :D
Ho provato a rerunnare lo script selezionando solo l'opzione di installazione dei font, ma nn fa nulla(bug?) Forse risolvo a manina
Per il secondo problema ti posso dire con esattezza che ho compilato alsa come driver principale abilitando anche l'emulazione oss(son partito da un 2.4.18fb per arrivare a un 2.4.26).
Questi sono i parametri che ho passato quando ho compilato alsa .)
C'è un modo per risolvere sto inconveniente?
"Perchè tanto Debian è meglio"
Running on Debian Gnu/Linux 3.1 Kernel 2.4.27
ed3nuzzo@gmail.com
Inviato da Antonio il Mer, 15/09/2004 - 15:07.
Re: Ucciosione brutale :D
Il problema che hai con i font mi sembra molto strano. Ho provato lo script su cinque computer con Sarge, Sid e misti e non mi ha mai dato problemi.
Potresti mandarmi l'output finale dello script quando installi solo i font?
Cmq, se vuoi fare a manina, i font vanno scompattati e copiati un /usr/share/mplayer/font.
Per quanto rigurada il problema che hai con alsa, il messaggio dice chiaramente che /dev/mixer non esiste. Hai installato le alsa-utils ed eseguito alsa-conf?
Per quest'ultimo problema però, dato che non è dipendente dallo script, penso sia meglio spostarci sul forum, così riceverai sicuramente più consigli
[GNU Action] - The OSS Revolution
Inviato da ED3nuzzo il Mer, 15/09/2004 - 17:07.
Re: Ucciosione brutale :D
Ecco cosa mi dice lo scrpt
Sembra essere ok....
)
L'errore continua a darmelo, ma il programma funziona correttamente(se non fosse per quell'errore relativo ad alsa
Ho provato ad aprire i video con mplayer(non con gmplayer) e li non mi da nessun errore :confuso:
"Perchè tanto Debian è meglio"
Running on Debian Gnu/Linux 3.1 Kernel 2.4.27
ed3nuzzo@gmail.com