Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| projets:traduction_live_cd:script_francisation.sh [Le 06/10/2010, 20:12] – créée snip | projets:traduction_live_cd:script_francisation.sh [Le 11/09/2022, 13:17] (Version actuelle) – Suppression des espaces en fin de ligne (détecté et corrigé via le bot wiki-corrector (https://forum.ubuntu-fr.org/viewtopic.php?id=2067892) moths-art | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | <code bash> | + | ====== Script de francisation du live CD ====== |
| - | #!/bin/bash | + | ===== Pré-requis ===== |
| - | + | * Connexion à Internet | |
| - | # Translation script for Ubuntu CDs | + | |
| - | # Copyright (C) 2010 Vincent-Xavier JUMEL | + | |
| - | + | * ~4Gio d' | |
| - | # 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 3 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. | + | |
| - | # GNU General Public License for more details. | + | |
| - | + | ||
| - | # You should have received a copy of the GNU General Public License | + | |
| - | # along with this program. | + | |
| - | + | ||
| - | # Be sure to set up the variables according to your needs and preferences | + | |
| - | # Usage: usage | + | ===== Récupérer les scripts ===== |
| - | # Print the usage. | + | |
| - | usage () { | + | |
| - | cat <<EOF | + | |
| - | Usage: `basename $0` [OPTION] | + | Les scripts sont dans Launchpad ( [[https:// |
| - | Localize the CD | + | <code bash> |
| + | bzr branch lp: | ||
| + | </ | ||
| - | -d, --directory=WD working directory (default to / | + | ===== Utilisation ===== |
| - | -a, --arch=ARCH | + | **Les manipulations sont à faire en tant que superutilisateur.** |
| - | -r, --release | + | |
| - | -D, --debug | + | |
| - | -u, --url | + | |
| - | -h, --help | + | |
| - | -v, --version | + | |
| - | Report bugs to <bug-grub@gnu.org>. | + | Pour la version 11.04 : |
| - | EOF | + | <code bash> |
| - | } | + | ./ |
| + | </ | ||
| - | #V_NUM=10.04 # Stand for version number | + | Pour la version |
| - | V_NAME=lucid # stand for version name | + | <code bash> |
| - | ARCH=i386 # Architecture | + | ./script_francisation.sh -r 10.04 -u http://cdimage.ubuntu.com/cdimage/ |
| - | WD=/home/virtual/ubuntu/translation # our working directory, should not interfere with anything you have | + | </ |
| - | debug=0 # Setting the debug value | + | |
| - | # Note that we use `" | + | Le temps nécessaire pour générer une iso est d'environ 30 minutes. Ce temps peut beaucoup varier selon le processeur, le disque dur et le débit de la connexion à Internet. |
| - | # separate word. The quotes around `$@' are essential! | + | |
| - | # We need TEMP as the `eval set --' would nuke the return value of getopt. | + | |
| - | TEMP=`getopt -o d:a:r:u:hD --long directory:,arch:, | + | |
| - | if [ $? != 0 ] ; then echo " | + | ===== Participation ===== |
| - | # Note the quotes around `$TEMP' | + | Pour proposer une amélioration, |
| - | eval set -- "$TEMP" | + | Après avoir modifié les scripts |
| + | <code bash> | ||
| + | bzr commit | ||
| + | bzr push lp: | ||
| + | </ | ||
| - | while true ; do | + | Ensuite, sur https:// |
| - | case " | + | |
| - | -d|--directory) WD=$2 ; shift 2;; | + | |
| - | -a|--arch) ARCH=$2 ; shift 2 ;; | + | |
| - | -r|--release) V_NUM=$2 ; shift 2 ;; | + | |
| - | -D|--debug) debug="1" | + | |
| - | -u|--url) DL_URL=$2; shift 2 ;; | + | |
| - | --) shift ; break ;; | + | |
| - | *) usage ; exit 0 ;; | + | |
| - | esac | + | |
| - | done | + | |
| - | #Test if version number is given | ||
| - | if [ " | ||
| - | echo "-r [option] is required" | ||
| - | exit 1 | ||
| - | fi | ||
| - | |||
| - | if [ $ARCH != i386 ]; then | ||
| - | if [ $ARCH != amd64 ]; then | ||
| - | echo "Arch not recognized or supported" | ||
| - | exit 1 | ||
| - | fi | ||
| - | fi | ||
| - | |||
| - | # This will create final working directory, even if the full path don't exists. | ||
| - | for i in mnt extract-cd edit tmp ; do | ||
| - | if [ ! -d ${WD}/${i} ]; then | ||
| - | mkdir -p ${WD}/${i} ; | ||
| - | else | ||
| - | sudo rm -rf ${WD}/ | ||
| - | fi | ||
| - | done | ||
| - | |||
| - | # http:// | ||
| - | |||
| - | # Change this next line to the directory where your previously downloaded iso image sits. | ||
| - | DIR=${WD} | ||
| - | |||
| - | FLAVOR=" | ||
| - | |||
| - | if [ $V_NUM == " | ||
| - | V_NAME=" | ||
| - | elif [ $V_NUM == " | ||
| - | V_NAME=" | ||
| - | else | ||
| - | echo "Wrong version number" | ||
| - | exit 1 | ||
| - | fi | ||
| - | |||
| - | VERSION=$V_NAME | ||
| - | |||
| - | ISOPATH=$(echo $DL_URL | sed s, | ||
| - | |||
| - | if [[ -z " | ||
| - | if [[ " | ||
| - | ISOPATH=" | ||
| - | elif [[ " | ||
| - | ISOPATH=" | ||
| - | elif [[ " | ||
| - | ISOPATH=" | ||
| - | elif [[ " | ||
| - | ISOPATH=" | ||
| - | elif [[ " | ||
| - | ISOPATH=" | ||
| - | else | ||
| - | echo " | ||
| - | exit 1 | ||
| - | fi | ||
| - | fi | ||
| - | ISO=$VERSION-$FLAVOR-$ARCH.iso | ||
| - | |||
| - | # Save the original location | ||
| - | ORIG_DIR=$PWD | ||
| - | |||
| - | [ ! -d $DIR ] && mkdir $DIR | ||
| - | cd $DIR | ||
| - | |||
| - | # create identical formatted md5sum file from local copy | ||
| - | if [[ -f $ISO ]]; then | ||
| - | md5sum $ISO | sed -e " | ||
| - | fi | ||
| - | |||
| - | wget -q http:// | ||
| - | grep $ISO MD5SUMS > $ISO.md5.server | ||
| - | rm MD5SUMS | ||
| - | diff -q $ISO.md5.local $ISO.md5.server | ||
| - | |||
| - | if [ ! $? -eq " | ||
| - | echo " | ||
| - | rsync -avzhhP rsync:// | ||
| - | if [ ! $? -eq " | ||
| - | echo " | ||
| - | exit 1 | ||
| - | fi | ||
| - | else | ||
| - | echo "no need to refresh" | ||
| - | fi | ||
| - | md5sum $ISO | sed -e " | ||
| - | diff -q $ISO.md5.local $ISO.md5.server | ||
| - | |||
| - | if [ ! $? -eq " | ||
| - | echo "rsync failed" | ||
| - | exit 1 | ||
| - | else | ||
| - | echo " | ||
| - | fi | ||
| - | |||
| - | |||
| - | # Going into working directory | ||
| - | cd ${WD} | ||
| - | sudo mount -o loop ${WD}/ | ||
| - | rsync --exclude=/ | ||
| - | |||
| - | sudo unsquashfs -d ${WD}/ | ||
| - | sudo umount mnt | ||
| - | |||
| - | # Just replace archives by French ones | ||
| - | |||
| - | sudo sed -i ' | ||
| - | |||
| - | # We just uncomment universe and multiverse for special package. They | ||
| - | # will be commented out by the end of the installation dans / | ||
| - | # will be purged to gain space. | ||
| - | |||
| - | sudo sed -i -r -e 's/# (deb .* .*iverse)/ | ||
| - | |||
| - | # Preparing and entering the chroot environment | ||
| - | sudo cp / | ||
| - | sudo cp /etc/hosts ${WD}/ | ||
| - | sudo mount --bind /dev/ ${WD}/ | ||
| - | sudo mount -t proc none ${WD}/ | ||
| - | sudo mount -t sysfs none ${WD}/ | ||
| - | sudo mount -t devpts none ${WD}/ | ||
| - | |||
| - | sudo cp $ORIG_DIR/ | ||
| - | |||
| - | sudo chroot ${WD}/edit /bin/bash /root/fr.sh | ||
| - | |||
| - | sudo umount ${WD}/ | ||
| - | sudo umount ${WD}/ | ||
| - | sudo umount ${WD}/ | ||
| - | sudo umount ${WD}/ | ||
| - | |||
| - | # Getting out the chroot environment | ||
| - | sudo mv -f ${WD}/ | ||
| - | |||
| - | # Updating the autorun.inf | ||
| - | |||
| - | sudo sed -i ' | ||
| - | |||
| - | # Dealing with gfxboot | ||
| - | |||
| - | sudo chmod -R u+w ${WD}/ | ||
| - | echo fr > ${WD}/ | ||
| - | echo fr > ${WD}/ | ||
| - | sudo cp ${WD}/ | ||
| - | sudo rm ${WD}/ | ||
| - | sudo mv ${WD}/ | ||
| - | sudo chmod u-w ${WD}/ | ||
| - | |||
| - | sudo sed -i " | ||
| - | s/\^Try Ubuntu without installing/ | ||
| - | s/\^Install Ubuntu/ | ||
| - | s/\^Check disc for defects/ | ||
| - | s/Test ^memory/ | ||
| - | s/\^Boot from first hard disk/ | ||
| - | " ${WD}/ | ||
| - | |||
| - | # Creating CD manifest | ||
| - | |||
| - | sudo chmod +w ${WD}/ | ||
| - | sudo chroot ${WD}/edit dpkg-query -W --showformat=' | ||
| - | sudo cp ${WD}/ | ||
| - | |||
| - | echo -e " | ||
| - | printf $(sudo du -sx --block-size=1 ${WD}/edit | cut -f1) > ${WD}/ | ||
| - | if [[ ! -e " | ||
| - | echo " | ||
| - | exit 0 | ||
| - | fi | ||
| - | |||
| - | sudo sed -i '/ | ||
| - | |||
| - | # Creating the squashfs | ||
| - | if [ -e ${WD}/ | ||
| - | sudo rm ${WD}/ | ||
| - | fi | ||
| - | sudo mksquashfs ${WD}/edit ${WD}/ | ||
| - | |||
| - | sudo chmod 777 ${WD}/tmp | ||
| - | if [ -e ${WD}/ | ||
| - | sudo rm ${WD}/ | ||
| - | fi | ||
| - | sudo rm ${WD}/ | ||
| - | cd ${WD}/ | ||
| - | sudo cp ${WD}/ | ||
| - | |||
| - | cd ${WD}/ | ||
| - | sudo mkisofs -r -V " | ||
| - | |||
| - | if [ $debug -eq " | ||
| - | cd ${WD} | ||
| - | sudo rm -rf ${WD}/mnt ${WD}/ | ||
| - | fi | ||
| - | </ | ||
