• [^] # Re: Presque complétement crasher

    Posté par . En réponse au journal Presque complétement crasher. Évalué à 2.

    Chez moi certains fichiers étaient modifiés.

    Ce que j'ai fait, l'install clean dans /root/clean :

    #!/bin/sh
    echo "Find...";
    DIR="/usr/doc"
    find /root/clean$DIR > tmp.clean
    FILES=`cut -d "/" --fields="4-" tmp.clean`;
    NB=`wc -l < tmp.clean`;
    echo "$NB files to check";
    rm tmp.clean

    echo "Check if all files are here...";
    echo "#!/bin/sh" > tocp
    echo "#Absent" >> tocp
    chmod +x tocp
    for FILE in $FILES; do
    if [ ! -d "/root/clean/$FILE" ]; then
    if [ -f "/$FILE" ]; then
    /root/clean/usr/bin/md5sum -b "/root/clean/$FILE" >> clean.md5;
    else
    echo "absent : $FILE";
    echo "cp /root/clean/$FILE /$FILE" >> tocp;
    fi
    fi
    done

    echo "Check MD5...";
    cut -d "/" --fields="-1,4-" clean.md5 > tocheck.md5
    rm clean.md5
    /root/clean/usr/bin/md5sum --check tocheck.md5 > result.md5 2>&1
    grep "CHEC\$" result.md5 > tmp
    FILES=`cut -d":" --fields="-1" tmp`;
    rm tmp
    echo "#MD5" >> tocp;
    for FILE in $FILES; do
    echo "MD5 : $FILE";
    echo "cp /root/clean/$FILE /$FILE" >> tocp;
    done


    (surment très tordu, mais je ne suis pas un spécialiste des scripts, et ca plante sur les répertoires avec des espaces je sais...)
    à la fin il y a un script "tocp" de prêt pour recopier les fichiers foireux ou manquants.