Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
projets:traduction_live_cd:script_francisation.sh [Le 06/10/2010, 23:24] snipprojets: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 3: Ligne 3:
   * Connexion à Internet   * Connexion à Internet
   * [[:sudo|Droits superutilisateur]]   * [[:sudo|Droits superutilisateur]]
-  * [[:tutoriel:comment_installer_un_paquet|Installer les paquets]] **[[apt://squashfs-tools,genisoimage|squashfs-tools genisoimage]]** +  * [[:tutoriel:comment_installer_un_paquet|Installer les paquets]] **[[apt://squashfs-tools,genisoimage|squashfs-tools genisoimage bzr]]** 
-  * Un autre script : [[projets:traduction_live_cd/inside_chroot.sh|inside_chroot.sh]]+  * ~4Gio d'espace disque libre
  
-===== Utilisation ===== +===== Récupérer les scripts ===== 
-En tant que superutilisateur :+ 
 +Les scripts sont dans Launchpad ( [[https://code.launchpad.net/~ubuntu-fr/+junk/french-cd|ICI]] pour 12.04 , ou [[http://bazaar.launchpad.net/~ubuntu-fr/+junk/iso-fr/|LA]] pour 10.04)
 <code bash> <code bash>
-./script_francisation.sh -r 10.10 -u http://cdimage.ubuntu.com/cdimage/daily-live/current/ -d /root/projets/traduction_live_cd+bzr branch lp:~ubuntu-fr/+junk/iso-fr
 </code> </code>
  
-===== Script =====+===== Utilisation ===== 
 +**Les manipulations sont à faire en tant que superutilisateur.**
  
 +Pour la version 11.04 :
 <code bash> <code bash>
-#!/bin/bash +./script_francisation.sh -r 11.04 -u http://cdimage.ubuntu.com/cdimage/daily-live/current/ -d /root/projets/traduction_live_cd 
-  +</code>
-# Translation script for Ubuntu CDs +
-# Copyright (C) 2010  Vincent-Xavier JUMEL +
-  +
-# 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.  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, see <http://www.gnu.org/licenses/>+
-  +
-# Be sure to set up the variables according to your needs and preferences+
  
-# Usage: usage +Pour la version 10.04.2 (LTS: 
-# Print the usage. +<code bash> 
-usage () { +./script_francisation.sh -r 10.04 -u http://cdimage.ubuntu.com/cdimage/lucid/daily-live/current/ -d /root/projets/traduction_live_cd 
-    cat <<EOF+</code>
  
-Usage: `basename $0` [OPTION] +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.
-Localize the CD+
  
-  -d, --directory=WD      working directory (default to /root/projets/traduction_live_cd) +===== Participation =====
-  -a, --arch=ARCH         Architecture (default to i386) +
-  -r, --release           Ubuntu release number and name (mandatory) +
-  -D, --debug   Turn on debuging, by not purging file +
-  -u, --url   Change url (if omissed, the script will try to do some auto-detection) +
-  -h, --help              print this message and exit +
-  -v, --version           print the version information and exit+
  
-Report bugs to <bug-grub@gnu.org>+Pour proposer une amélioration, il faut un compte sur launchpad.net
-EOF +Après avoir modifié les scripts : (changez //votresurnom// par votre pseudonyme launchpad) 
-}+<code bash> 
 +bzr commit -m "un message explicatif" 
 +bzr push lp:~votresurnom/iso-fr 
 +</code>
  
-#V_NUM=10.04 # Stand for version number +Ensuite, sur https://code.launchpad.net/~votresurnom/iso-fr cliquez sur "Propose for merging".
-V_NAME=lucid # stand for version name +
-ARCH=i386 # Architecture +
-WD=/root/projets/traduction_live_cd # our working directory, should not interfere with anything you have +
-debug=0 # Setting the debug value+
  
-# Note that we use `"$@"' to let each command-line parameter expand to a  
-# 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:,release:,help,debug,url: -n 'script_francistation.sh' -- "$@"` 
- 
-if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi 
- 
-# Note the quotes around `$TEMP': they are essential! 
-eval set -- "$TEMP" 
- 
-while true ; do 
- case "$1" in 
- -d|--directory) WD=$2 ; shift 2;; 
- -a|--arch) ARCH=$2 ; shift 2 ;; 
- -r|--release) V_NUM=$2 ; shift 2 ;;  
- -D|--debug) debug="1" ; shift 1 ;; 
- -u|--url) DL_URL=$2; shift 2 ;; 
- --) shift ; break ;; 
- *) usage ; exit 0 ;; 
- esac 
-done 
- 
-#Test if version number is given 
-if [ "x" == "x$V_NUM" ]; then 
- echo "-r [option] is required" >&2 
- exit 1 
-fi 
- 
-if [ $ARCH != i386 ]; then 
- if [ $ARCH != amd64 ]; then  
- echo "Arch not recognized or supported" >&2 
- 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}/${i}/* 
-    fi 
-done 
- 
-# http://paste.ubuntu.com/419825/ 
- 
-# Change this next line to the directory where your previously downloaded iso image sits. 
-DIR=${WD} 
- 
-FLAVOR="desktop" 
- 
-if [ $V_NUM == "10.04.1" ]; then 
- V_NAME="lucid" 
-elif [ $V_NUM == "10.10" ]; then 
- V_NAME="maverick" 
-else  
- echo "Wrong version number" >& 
- exit 1 
-fi 
- 
-VERSION=$V_NAME 
- 
-ISOPATH=$(echo $DL_URL | sed s,http://,,) 
- 
-if [[ -z "$ISOPATH" ]]; then 
-    if [[ "$FLAVOR" = "desktop" ]]; then 
-        ISOPATH="cdimage.ubuntu.com/cdimage/daily-live/current" 
-    elif [[ "$FLAVOR" = "alternate" ]]; then 
-        ISOPATH="cdimage.ubuntu.com/cdimage/daily/current" 
-    elif [[ "$FLAVOR" = "dvd" ]]; then 
-        ISOPATH="cdimage.ubuntu.com/cdimage/dvd/current" 
-    elif [[ "$FLAVOR" = "netbook" ]]; then 
-        ISOPATH="cdimage.ubuntu.com/cdimage/ubuntu-netbook/daily-live/current" 
-    elif [[ "$FLAVOR" = "server" ]]; then 
-        ISOPATH="cdimage.ubuntu.com/cdimage/ubuntu-server/daily/current" 
-    else 
-        echo "Unrecognized distribution, set ISOPATH manually" 
-        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 "s/  / */" > $ISO.md5.local  
-fi 
- 
-wget -q http://$ISOPATH/MD5SUMS 
-grep $ISO MD5SUMS > $ISO.md5.server 
-rm MD5SUMS 
-diff -q $ISO.md5.local $ISO.md5.server 
- 
-if [ ! $? -eq "0" ]; then 
-    echo "Performing rsync in $DIR" 
-    rsync -avzhhP rsync://$ISOPATH/$ISO . 
- if [ ! $? -eq "0" ]; then 
- echo "Nothing have been downloaded :-(" >&2 
- exit 1 
- fi 
-else 
-    echo "no need to refresh" 
-fi 
-md5sum $ISO | sed -e "s/  / */" > $ISO.md5.local 
-diff -q $ISO.md5.local $ISO.md5.server 
- 
-if [ ! $? -eq "0" ]; then 
-     echo "rsync failed" 
-     exit 1 
-else 
-     echo "success" 
-fi 
- 
-  
-# Going into working directory 
-cd ${WD} 
-sudo mount -o loop ${WD}/${V_NAME}-desktop-${ARCH}.iso ${WD}/mnt 
-rsync --exclude=/casper/filesystem.squashfs -av ${WD}/mnt/ ${WD}/extract-cd 
-  
-sudo unsquashfs -d ${WD}/edit/. -f ${WD}/mnt/casper/filesystem.squashfs 
-sudo umount mnt 
-  
-# Just replace archives by French ones 
-  
-sudo sed -i 's/archive/fr.archive/' ${WD}/edit/etc/apt/sources.list  
-  
-# We just uncomment universe and multiverse for special package. They 
-# will be commented out by the end of the installation dans /var/lib/apt 
-# will be purged to gain space. 
-  
-sudo sed -i -r -e 's/# (deb .* .*iverse)/\1/' ${WD}/edit/etc/apt/sources.list 
-  
-# Preparing and entering the chroot environment 
-sudo cp /etc/resolv.conf ${WD}/edit/etc/ 
-sudo cp /etc/hosts ${WD}/edit/etc/ 
-sudo mount --bind /dev/ ${WD}/edit/dev 
-sudo mount -t proc none ${WD}/edit/proc 
-sudo mount -t sysfs none ${WD}/edit/sys 
-sudo mount -t devpts none ${WD}/edit/dev/pts 
- 
-sudo cp $ORIG_DIR/inside_chroot.sh ${WD}/edit/root/fr.sh 
- 
-sudo chroot ${WD}/edit /bin/bash /root/fr.sh 
- 
-sudo umount ${WD}/edit/proc 
-sudo umount ${WD}/edit/sys 
-sudo umount ${WD}/edit/dev/pts 
-sudo umount ${WD}/edit/dev 
-  
-# Getting out the chroot environment 
-sudo mv -f ${WD}/edit/initrd.lz ${WD}/extract-cd/casper/ 
- 
-# Updating the autorun.inf 
-  
-sudo sed -i 's/Install Ubuntu/Installer Ubuntu/' ${WD}/extract-cd/autorun.inf 
-  
-# Dealing with gfxboot 
-  
-sudo chmod -R u+w ${WD}/extract-cd/ 
-echo fr > ${WD}/extract-cd/isolinux/lang 
-echo fr > ${WD}/extract-cd/isolinux/langlist 
-sudo cp ${WD}/extract-cd/isolinux/fr.* ${WD}/tmp/ 
-sudo rm ${WD}/extract-cd/isolinux/*.hlp ${WD}/extract-cd/isolinux/*.tr 
-sudo mv ${WD}/tmp/fr.* ${WD}/extract-cd/isolinux/ 
-sudo chmod u-w ${WD}/extract-cd/isolinux ${WD}/extract-cd/isolinux/lang ${WD}/extract-cd/isolinux/langlist 
- 
-sudo sed -i " 
-s/\^Try Ubuntu without installing/^Essayer Ubuntu sans l\'installer/; 
-s/\^Install Ubuntu/^Installer Ubuntu/; 
-s/\^Check disc for defects/^Vérifier le disque/; 
-s/Test ^memory/Vérifier la ^mémoire/; 
-s/\^Boot from first hard disk/^Démarrer sur le premier disque/ 
-" ${WD}/extract-cd/isolinux/txt.cfg 
-  
-# Creating CD manifest 
-  
-sudo chmod +w ${WD}/extract-cd/casper/filesystem.manifest 
-sudo chroot ${WD}/edit dpkg-query -W --showformat='${Package} ${Version}\n' > ${WD}/extract-cd/casper/filesystem.manifest 
-sudo cp ${WD}/extract-cd/casper/filesystem.manifest ${WD}/extract-cd/casper/filesystem.manifest-desktop 
- 
-echo -e "Calcule la taille du dossier chroot pour le fichier filesystem.size..." 
- printf $(sudo du -sx --block-size=1 ${WD}/edit | cut -f1) > ${WD}/extract-cd/casper/filesystem.size 
- if [[ ! -e "${WD}"/extract-cd/casper/filesystem.size || -z `cat ${WD}/extract-cd/casper/filesystem.size` ]]; then 
- echo "can't generate the filesystem.size file, exit..." >&2 
-exit 0 
-fi 
- 
-sudo sed -i '/casper/d;/cryptsetup/d;/dmraid/d;/ecryptfs-utils/d;/gparted/d;/jfsutils/d;/keyutils/d;/kpartx/d;/libdebconfclient0/d;/libdebian-installer4/d;/libdmraid1.0.0.rc15/d;/libecryptfs0/d;/libntfs10/d;/libreadline5/d;/localechooser-data/d;/lupin-casper/d;/ntfsprogs/d;/python-pyicu/d;/rdate/d;/reiserfsprogs/d;/ubiquity/d;/ubiquity-casper/d;/ubiquity-frontend-gtk/d;/ubiquity-slideshow-ubuntu/d;/ubiquity-ubuntu-artwork/d;/user-setup/d;/xfsprogs/d' ${WD}/extract-cd/casper/filesystem.manifest-desktop 
-  
-# Creating the squashfs 
-if [ -e ${WD}/extract-cd/casper/filesystem.squashfs ]; then 
-    sudo rm ${WD}/extract-cd/casper/filesystem.squashfs 
-fi 
-sudo mksquashfs ${WD}/edit ${WD}/extract-cd/casper/filesystem.squashfs 
- 
-sudo chmod 777 ${WD}/tmp 
-if [ -e ${WD}/tmp/md5sum.txt ]; then 
-    sudo rm ${WD}/tmp/md5sum.txt 
-fi 
-sudo rm ${WD}/extract-cd/md5sum.txt 
-cd ${WD}/extract-cd && sudo find . -type f -not -name md5sum.txt -not -path '*/isolinux/*' -print0 | xargs -0 -- md5sum > ${WD}/tmp/md5sum.txt 
-sudo cp ${WD}/tmp/md5sum.txt ${WD}/extract-cd/md5sum.txt 
-  
-cd ${WD}/extract-cd 
-sudo mkisofs -r -V "Ubuntu ${V_NUM} Fr" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-${V_NUM}-desktop-i386-fr.iso . 
- 
-if [ $debug -eq "1" ]; then 
- cd ${WD} 
- sudo rm -rf ${WD}/mnt ${WD}/extract-cd ${WD}/edit ${WD}/tmp *.img 
-fi 
-</code>