linux:astuces

Amarok et MySql

Récupérer le fichier de source : amarok-2.0.2-2mdv2009.1.src.rpm

Créer le répertoire mkdir -p ~/rpm/{BUILD,RPMS/{i586,noarch,x86_64},SOURCES,SRPMS,SPECS,tmp}

Pour configurer ce fichier voir wiki.mandriva.com

Lancer la commande : rpm -i SRPMS/amarok-2.0.2-2mdv2009.1.src.rpm

Modifier le fichier /usr/src/rpm/SPECS/amarok.spec

   Changer "%define build_mysql 0" to "%define build_mysql 1" 
     

Installer les paquetages qui manquent:

    urpmi rpm-build gcc binutils make libtaglib-devel kdemultimedia-devel libxine-devel libvisual-devel libtunepimp-devel k3b-devel libifp-devel SDL-devel libgpod-devel libnjb-devel sqlite3-devel libmtp-devel exscalibar-devel ruby-devel gpm-devel

Lancer la compilation:

   rpmbuild -ba  amarok.spec

Installer:

  cd /usr/src/rpm/RPMS/i586/
  urpmi libamarok-scripts-devel-1.4.7-11mdv2008.0.i586.rpm libamarok-devel-1.4.7-11mdv2008.0.i586.rpm libamarok0-scripts-1.4.7-11mdv2008.0.i586.rpm libamarok0-1.4.7-11mdv2008.0.i586.rpm amarok-scripts-1.4.7-11mdv2008.0.i586.rpm amarok-engine-xine-1.4.7-11mdv2008.0.i586.rpm amarok-debug-1.4.7-11mdv2008.0.i586.rpm amarok-1.4.7-11mdv2008.0.i586.rpm

Sources compilés pour amarok avec Mysql actif

problèmes avec Mandriva 2009.1

il y a un message d'erreur:

QString::arg: Argument missing: Amarok - Aucun morceau en cours de lecture, 0:00 

Solution : Installer phonon-xine pour les mp3 dans Amarok

Configuration d'un Double Écran Sous linux

Éditer le fichier /etc/X11/xorg.conf

# File generated by XFdrake (rev )
 
# **********************************************************************
# Refer to the xorg.conf man page for details about the format of
# this file.
# **********************************************************************
 
Section "ServerFlags"
    Option "DontZap" "False" # disable <Ctrl><Alt><BS> (server abort)
    AllowMouseOpenFail # allows the server to start up even if the mouse does not work
    #DontZoom # disable <Ctrl><Alt><KP_+>/<KP_-> (resolution switching)
EndSection
 
Section "Module"
    Disable "dri"
    Load "dbe" # Double-Buffering Extension
    Load "v4l" # Video for Linux
    Load "extmod"
    Load "glx" # 3D layer
EndSection
 
Section "Monitor"
    Identifier "monitor1"
    VendorName "Plug'n Play"
    ModelName "L1920B "
    HorizSync 30-83
    VertRefresh 56-75
 
    # TV fullscreen mode or DVD fullscreen output.
    # 768x576 @ 79 Hz, 50 kHz hsync
    ModeLine "768x576"     50.00  768  832  846 1000   576  590  595  630
 
    # 768x576 @ 100 Hz, 61.6 kHz hsync
    ModeLine "768x576"     63.07  768  800  960 1024   576  578  590  616
EndSection
 
Section "Monitor"
 
    # modeline generated by gtf(1) [handled by XFdrake]
    Identifier     "monitor2"
    VendorName     "Samsung"
    ModelName	   "Samsung SyncMaster 226"
    HorizSync       30.0 - 81.0
    VertRefresh     56.0 - 75.0
    ModeLine	   "1680x1050_120" 313.0 1680 1816 2000 2320 1050 1051 1054 1125 -hsync +vsync
    ModeLine	   "1280x1024" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
    ModeLine	   "768x576" 50.0 768 832 846 1000 576 590 595 630
    ModeLine	   "768x576" 63.0 768 800 960 1024 576 578 590 616
    ModeLine	   "1680x1050_100" 256.0 1680 1808 1992 2304 1050 1051 1054 1112 -hsync +vsync
    ModeLine	   "1680x1050_85" 214.0 1680 1800 1984 2288 1050 1051 1054 1103 -hsync +vsync
    ModeLine	   "1680x1050_75" 188.0 1680 1800 1984 2288 1050 1051 1054 1096 -hsync +vsync
    ModeLine	   "1680x1050_60" 147.0 1680 1784 1968 2256 1050 1051 1054 1087 -hsync +vsync
    ModeLine	   "1680x1050_50" 120.0 1680 1776 1952 2224 1050 1051 1054 1081 -hsync +vsync
    ModeLine	   "1600x1000_120" 284.0 1600 1728 1904 2208 1000 1001 1004 1072 -hsync +vsync
    ModeLine	   "1600x1000_100" 232.0 1600 1720 1896 2192 1000 1001 1004 1059 -hsync +vsync
    ModeLine	   "1600x1000_85" 194.0 1600 1712 1888 2176 1000 1001 1004 1050 -hsync +vsync
    ModeLine	   "1600x1000_75" 169.0 1600 1704 1880 2160 1000 1001 1004 1044 -hsync +vsync
    ModeLine	   "1600x1000_60" 133.0 1600 1704 1872 2144 1000 1001 1004 1035 -hsync +vsync
    ModeLine	   "1600x1000_50" 108.0 1600 1688 1856 2112 1000 1001 1004 1029 -hsync +vsync
    ModeLine	   "1440x900_120" 229.0 1440 1552 1712 1984 900 901 904 965 -hsync +vsync
    ModeLine	   "1440x900_100" 187.0 1440 1544 1704 1968 900 901 904 953 -hsync +vsync
    ModeLine	   "1440x900_85" 156.0 1440 1536 1696 1952 900 901 904 945 -hsync +vsync
    ModeLine	   "1440x900_75" 136.0 1440 1536 1688 1936 900 901 904 940 -hsync +vsync
    ModeLine	   "1440x900_60" 106.0 1440 1520 1672 1904 900 901 904 932 -hsync +vsync
    ModeLine	   "1440x900_50" 87.0 1440 1512 1664 1888 900 901 904 926 -hsync +vsync
    ModeLine	   "1280x800_120" 181.0 1280 1376 1520 1760 800 801 804 858 -hsync +vsync
    ModeLine	   "1280x800_100" 147.0 1280 1376 1512 1744 800 801 804 848 -hsync +vsync
    ModeLine	   "1280x800_85" 123.0 1280 1368 1504 1728 800 801 804 840 -hsync +vsync
    ModeLine	   "1280x800_75" 107.0 1280 1360 1496 1712 800 801 804 835 -hsync +vsync
    ModeLine	   "1280x800_60" 83.0 1280 1344 1480 1680 800 801 804 828 -hsync +vsync
    ModeLine	   "1280x800_50" 68.0 1280 1336 1472 1664 800 801 804 824 -hsync +vsync
EndSection
 
 
Section "Device"
    Identifier "device1"
    VendorName "nVidia Corporation"
    BoardName "NVIDIA GeForce 6100 and later"
    Driver "nvidia"
    Option "DPMS"
    Option "AddARGBGLXVisuals"
EndSection
 
Section "Screen"
    Identifier "screen1"
    Device "device1"
    Monitor "monitor1"
    DefaultColorDepth 24
Option         "TwinView"                                   ##modification pour double ecran
    Option         "SecondMonitorVertRefresh" "56-75"           ##modification pour double ecran
    Option         "ConnectedMonitor" "dfp,dfp"                 ##modification pour double ecran
    Option         "TwinViewOrientation" "Clone"                ##modification pour double ecran
    Option         "SecondMonitorHorizSync" "30-83"             ##modification pour double ecran
    Option         "metamodes" "CRT: 1280x1024 +0+0, DFP: nvidia-auto-select +1280+0; CRT: 1152x864 +0+0, DFP: NULL;
 
 
    Subsection "Display"
        Depth 8
        Modes "1280x1024" "1152x864" "1024x768" "832x624" "800x600" "640x480" "480x360" "320x240"
    EndSubsection
 
    Subsection "Display"
        Depth 15
        Modes "1280x1024" "1152x864" "1024x768" "832x624" "800x600" "640x480" "480x360" "320x240"
    EndSubsection
 
    Subsection "Display"
        Depth 16
        Modes "1280x1024" "1152x864" "1024x768" "832x624" "800x600" "640x480" "480x360" "320x240"
    EndSubsection
 
    Subsection "Display"
        Depth 24
        Modes "1280x1024" "1152x864" "1024x768" "832x624" "800x600" "640x480" "480x360" "320x240"
    EndSubsection
EndSection
 
Section "Screen"
    Identifier     "screen2"
    Device         "device1"
    Monitor        "monitor2"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
        Modes      "1680x1050" "1024x768" "800x600" "640x480"
    EndSubSection
EndSection
 
Section "ServerLayout"
    Identifier "layout1"
    Screen "screen1"
   Screen "Screen1" Rightof "Screen2"
EndSection

Astuces sur linux bash

A la main

Il est possible de monter une image ISO comme on monte un CDROM en faisant simplement sous root :

$mount -o loop,ro -t iso9660 /chemin/Image.iso /repertoire/destination/
Avec un fichier rpm: EzISO

EzISO

 eziso - mount iso images as virtual CDROMs in your home directory
$ rpm2cpio paquet.rpm | cpio --extract

Par contre s'il s'agit d'un paquet RPM binaire,il ne sera pas possible de consulter les opérations effectuées lors de l'installation ou la désinstallation Il sera nécessaire d'extraire le fichier SPEC du RPM source et y et regarder les sections pre,post-install et pre,post-uninstall

$ ldd suivi nom_complet_du_programme
$ chattr +i   #permet en particulier de rendre un fichier invulnérable 
             #contre l'effacement ou la modification sous root.
 
$ chattr +s   #permet d'effacer totalement un fichier du disque 
             #pour éviter qu'on le récupère pour des raisons de sécurité par exemple
$ export Display=origin:0
$ rlogin vers...
$ xhost + 
$ xcdroast &
$ set nobepp
$ set autolist
$ df -h /tmp
$ df -x --block-size=1024K | sort -nr | head -10

Pour toutes les partitions

$ df -kh

Pour faire un rm sur un fichier qui contient un caractère “bizarre”, on peut utiliser la commande find

$ ls -i -fichier#Bizare #pour trouver son numéro d'inode ici 233
$ find . -inum 233 -ok rm {} \;
   ctrl-alt-sysrq maintenus enfoncés et successivement R S E U I B
   "sysrq" == "Impr écran"
$ dmesg | grep '^hd[a-z]'
$ chown -R user:group [fichiers]

Pour rechercher les fichiers Unix qui ont des CONTROL M en fin de ligne (format Dos):

  • On passe en paramètre de la fonction la liste des répertoires à mettre à jour.
  • En sortie on obtient une liste de noms de fichiers qui contiennent au moins un ^M.

Fichier verifControlM.sh

#!/usr/bin/sh
 
for repertoire in $1   # liste des répertoires à mettre à jour
do
   for suffixe in `cat extensions`   # liste des suffixes à mettre à jour
   do
      find ${repertoire} -type f -name "*${suffixe}" -exec nawk 'BEGIN{flag=0} /\r$/ { if (flag == 0 && old_name != FILENAME) { print FILENAME ; flag=1 } ; old_name=FILENAME } ' {} \;
   done
done

Fichier extensions

properties
sh
pl

On peux appliquer ensuite la fonction dos2unix aux fichiers trouvés.

Sources à télécharger :verifcontrolm.sh.zip

Format tar

Décompresser tar -xvfz fichier.tar.gz
Compression tar -cvzf nom_archive.tar.gz dossier_a_compresser/

Format tar.bz2

Décompresser tar -jxvfz fichier.tar.bz2
bzip2 -cd fichier.tar.bz2 puis tar -xvfz fichier.tar
Compression tar -cvzf nom_archive.tar.gz dossier_a_compresser/

Format zip

Décompresser unzip fichier.zip
Compression zip -r fichier.zip dossier_a_compresser/
$ ps auxwf | grep cp

Créer le fichier executable mydiff.sh sans oublier le chmod u+x mydiff.sh

#/bin/sh
 
#Récupération des chemins des dossiers:
[ -z "$1" ] && read -p "Dossier 1 : " DIR1 || DIR1="$1"
[ ! -d "$DIR1" ] && echo "'$DIR1' n'est pas un dossier !" && exit 1
[ -z "$2" ] && read -p "Dossier 2 : " DIR2 || DIR2="$2"
[ ! -d "$DIR2" ] && echo "'$DIR2' n'est pas un dossier !" && exit 1
 
#Création de fichier temporaires
file1="/tmp/mydiff1"
file2="/tmp/mydiff2"
 
#rajouter au cas ou un "/" final aux noms de dossier
[ -z "$(echo "$DIR1"|grep "/$")" ] && DIR1="$DIR1/"
[ -z "$(echo "$DIR2"|grep "/$")" ] && DIR2="$DIR2/"
 
#remplacer "/" par "\/" (pour le sed)
DIR1m=$(echo "$DIR1"|sed "s#/#\\\/#g")
DIR2m=$(echo "$DIR2"|sed "s#/#\\\/#g")
 
#lister les 2 dossiers
find "$DIR1" | sed "s/^$DIR1m//" | sort >$file1
find "$DIR2" | sed "s/^$DIR2m//" | sort >$file2
 
#comparer
echo -e "\n\033[1;34mCe que \"$DIR1\" contient en plus :\033[0m"
diff $file1 $file2 |grep '^<'|cut -d' ' -f1 --complement
echo -e "\n\033[1;34mCe que \"$DIR2\" contient en plus :\033[0m"
diff $file2 $file1 |grep '^<'|cut -d' ' -f1 --complement
 
#nettoyage
rm $file1 $file2

Convertir les espaces dans le nom des fichiers en caractère souligné "_"

$ for i in *\*; do mv "$i" `echo $i | tr " " "_"`; done
pour faire l'inverse
$ for i in *_*; do mv "$i" "`echo $i | tr "_" " "`"; done
Pour tester cette commande sans que les modifications soient faites

affichera les nouveaux noms des fichiers:

$ for i in *\*; do printf "$i\n" | tr " " "_"; done
Pour "cibler" les fichiers on peut modifier la commande

par exemple pour n'agir que sur les mp3: $ for i in *\*.mp3; do mv “$i” `echo $i | tr “ ” “_”`; done

Mettre les noms de fichiers en minuscule

$ for i in *; do mv “$i” `echo $i | tr [:upper:] [:lower:]`; done

Changer les extensions des tous les fichiers d'un dossier

$ for i in *.EXT1; do mv $i `basename $i EXT1`EXT2; done

EXT1 est l'extension à modifier ; EXT2 est la nouvelle extension

Convertir tous les fichiers audio d'un répertoires

  • wma to mp3
  • mp3 to ogg
  • m4a to mp3
  • m4a to wav
#!/bin/bash
 
current_directory=$( pwd )
 
#remove spaces
for i in *.[Mm]4[Aa]; do mv "$i" `echo $i | tr ' ' '_'`; done
 
#remove uppercase
for i in *.[Mm]4[Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
 
#ripping with mplayer
#echo Processing file: $i 
#for i in *.mp3 ; do mplayer -vo null -vc dummy -ao pcm:file=$i.wav $i; done
 
#ripping with faad
echo Processing file: $i 
for i in *.m4a ; do faad $i; done
 
#Convert to OGG
#oggenc *.wav;
 
#Convert to MP3
for i in *.wav ; do lame $i; done
 
# Remove extrenuous extensions.
for i in *.mp3 ; do  x=`echo "$i"|sed -e 's/.wav.mp3/.mp3/'` ;  mv "$i" "$x" ; done
 
#removing old file
rm *.wav;
rm *.m4a;
#rm *.wma;
urpmi faad2 ffmpeg ffmpeg2theora lame-mp3x libdvdcss2 libdvdnav4 libmatroska0 libmpeg2dec0 libmpeg4ip0 libquicktime-faac libquicktime-faad libquicktime-lame libquicktime-x264 libsmpeg0.4 mencoder mp32ogg mpeg2dec real-codecs toolame transcode win32-codecs x264 xanim-codecs mplayerplugin libquicktime-dv audacious-jack mjpegtools SDL_sound streamripper streamtuner dirac-utils dtsdec a52dec kaffeine vlc xine-faad flac speex APE faac ogmtools mkvtoolnix gstreamer0.10-mms phonon-a win32-codecslibdvbpsi  win32-codecs real-codecs x264 gstreamer0.10-decoders gstreamer0.10-decoders-audio phonon-xine phonon-gstreamer libphonon4 liba52dec0 libdvdread4 libdvdcss2 libdv4
  • linux/astuces.txt
  • Dernière modification: 2018/10/13 14:59
  • (modification externe)