Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 26/04/2009, à 16:02

frafa

Franciser le LiveCD Ubuntu Jaunty

http://forum.ubuntu-fr.org/viewtopic.php?id=207366
#http://doc.ubuntu-fr.org/traduction_live_cd_tuto_ubuntu_jaunty

Franciser le LiveCD Ubuntu Jaunty

ATTENTION! Methode en cours de test, na pas utiliser tant que ce message est là!!!
ATTENTION! Methode en cours de test, na pas utiliser tant que ce message est là!!!
ATTENTION! Methode en cours de test, na pas utiliser tant que ce message est là!!!

sudo -s #passer en mode administrateur

#Preparation
#Modifier ici chemin du isocd

cheminiso="/home/frafa/Bureau/distro/Ubuntu-jaunty/ubuntu-9.04-desktop-i386.iso"
function preparation()
{
mkdir -p /mnt/mountiso #point de montage de isocd
mkdir -p /mnt/cpiso #copie du isocd
mkdir -p /mnt/chroot #ici on decompresse le chroot
mount -o loop "$cheminiso" /mnt/mountiso #Monter le isocd
rsync -a --delete --exclude="*~"  /mnt/mountiso/.  /mnt/cpiso/. #Copier le isocd
umount /mnt/mountiso #plus besoin on demone isocd
rmdir /mnt/mountiso #Supprimer plus besoin
unsquashfs -d /mnt/chroot/. -f /mnt/cpiso/casper/filesystem.squashfs #Decompresser le squashfs
}
preparation

#chrooter

function chrooter()
{
cp -f /etc/resolv.conf /mnt/chroot/etc/resolv.conf
cp -f /etc/hosts /mnt/chroot/etc/hosts
echo -e "proc /proc proc defaults 0 0" | tee /mnt/chroot/etc/fstab
mount -t proc -o bind /proc '/mnt/chroot/proc'
mount -t sys -o bind /sys '/mnt/chroot/sys'
mount -t dev -o bind /dev '/mnt/chroot/dev'
mount -t pts -o bind /dev/pts '/mnt/chroot/dev/pts'
chroot /mnt/chroot /etc/init.d/dbus restart

#Copie de sauvegarde de /mnt/chroot/etc/apt/sources.list
[ ! -e /mnt/chroot/etc/apt/sources.list.sauvegarde ] && cp /mnt/chroot/etc/apt/sources.list /mnt/chroot/etc/apt/sources.list.sauvegarde

#sources.list
echo -e "deb http://archive.ubuntu.com/ubuntu jaunty main restricted
deb-src http://archive.ubuntu.com/ubuntu jaunty main restricted

deb http://security.ubuntu.com/ubuntu jaunty-security main restricted
deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu jaunty-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu jaunty-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu jaunty universe
# deb-src http://archive.ubuntu.com/ubuntu jaunty universe
deb http://archive.ubuntu.com/ubuntu jaunty-updates universe
# deb-src http://archive.ubuntu.com/ubuntu jaunty-updates universe
deb http://security.ubuntu.com/ubuntu jaunty-security universe
# deb-src http://security.ubuntu.com/ubuntu jaunty-security universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
# deb http://archive.ubuntu.com/ubuntu jaunty multiverse
# deb-src http://archive.ubuntu.com/ubuntu jaunty multiverse
# deb http://archive.ubuntu.com/ubuntu jaunty-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu jaunty-updates multiverse
# deb http://security.ubuntu.com/ubuntu jaunty-security multiverse
# deb-src http://security.ubuntu.com/ubuntu jaunty-security multiverse" | tee /mnt/chroot/etc/apt/sources.list
chroot /mnt/chroot apt-get update -y
}
chrooter

#Modifs du chroot

function modifschroot()
{
#
sed -i "s%XKBLAYOUT=\".*\"%XKBLAYOUT=\"fr\"%g" /mnt/chroot/etc/default/console-setup
sed -i "s%XKBVARIANT=\".*\"%XKBVARIANT=\"oss\"%g" /mnt/chroot/etc/default/console-setup
#
sed -i "s/^kbd=.*/kbd=fr/" /mnt/chroot/usr/share/initramfs-tools/scripts/casper-bottom/19keyboard
sed -i "s/^cslayout=.*/cslayout=fr/" /mnt/chroot/usr/share/initramfs-tools/scripts/casper-bottom/19keyboard
sed -i "s/^csvariant=.*/csvariant=oss/" /mnt/chroot/usr/share/initramfs-tools/scripts/casper-bottom/19keyboard
sed -i "s/^csmodel=.*/csmodel=pc105/" /mnt/chroot/usr/share/initramfs-tools/scripts/casper-bottom/19keyboard
#
sed -i "s/^locale=.*/locale=fr_FR.UTF-8/" /mnt/chroot/usr/share/initramfs-tools/scripts/casper-bottom/20xconfig
#
sed -i "s/Live session user/Session CD/g" /mnt/chroot/etc/casper.conf
sed -i "s/Live session user/Session CD/g" /mnt/chroot/usr/share/initramfs-tools/scripts/casper

#
chroot /mnt/chroot<<"EOF"
export LANG="fr_FR.UTF-8"
export HOME=/root
export LC_ALL=C
update-initramfs -u -k 2.6.28-11-generic
EOF

#Suppression des paquets inutiles
chroot /mnt/chroot<<"EOF"
export LANG="fr_FR.UTF-8"
export HOME=/root
export LC_ALL=C
apt-get remove -y --purge $(dpkg -l | awk '{print $2}' | egrep "language-pack|aspell-|gimp-help-|language-support-|myspell-|language-pack-gnome-|gimp-help-|thunderbird-locale-" | xargs)
EOF

#Installation des paquets français
chroot /mnt/chroot<<"EOF"
export LANG="fr_FR.UTF-8"
export HOME=/root
export LC_ALL=C
apt-get install -y language-pack-fr language-pack-fr-base hunspell-fr gimp-help-fr language-support-fr language-support-translations-fr language-support-writing-fr thunderbird-locale-fr language-pack-gnome-fr language-pack-gnome-fr-base manpages-fr manpages-fr-dev openoffice.org-hyphenation openoffice.org-help-fr openoffice.org-l10n-fr wfrench gimp-help-common gimp-help-en hunspell
EOF

#Suppression des docs GNOME et des pages de manuels inutiles
chroot /mnt/chroot<<"EOF"
export LANG="fr_FR.UTF-8"
export HOME=/root
export LC_ALL=C
find /usr/share/gnome/help/ -depth -mindepth 2 -maxdepth 2 -type d ! \( -name "fr*" -o -name "C" -o -name "en*" -o -name "us" \) | xargs rm -rf
find /usr/share/man/ -depth -maxdepth 1 -mindepth 1 -type d ! \( -name "fr*" -o -name "man?" \) | xargs rm -rf
EOF
}
modifschroot

#reste a scripter ATTENTION na pas utiliser c'est local pour moi!!!
#franciser

function franciser()
{
#Marque-page Firefox
cd /tmp 
wget ftp://ftp.mozilla.org/pub/firefox/releases/3.0.8/linux-i686/fr/firefox-3.0.8.tar.bz2
tar jxvf firefox-3.0.8.tar.bz2
#copier bookmarks fr dans chroot
cp -f /tmp/firefox/defaults/profile/bookmarks.html /mnt/chroot/etc/firefox-3.0/profile/bookmarks.html
rm -rf /tmp/firefox*
cd -

#reste a scripter
#Copier example-content francisé
rm -R /mnt/chroot/usr/share/example-content/*
cp -a /home/frafa/Bureau/ubfr/Exemples_VF/. /mnt/chroot/usr/share/example-content
#Copier searchplugins francisé
rm -R /mnt/chroot/usr/lib/firefox-addons/searchplugins/*
cp -a /home/frafa/Bureau/ubfr/firefox/searchplugins/* /mnt/chroot/usr/lib/firefox-addons/searchplugins
#cp "/home/frafa/Bureau/ubfr/firefox/Page d\'accueil d\'Ubuntu.html"

#Modifs@titienne
cd /mnt/chroot/usr/share/ubufox/chrome/
rm ubufox.jar
wget ftp://traduc:traduc@ubukey.fr:21/projet%20LiveCD-fr/ubuntu9.04-fr/firefox/ubufox.jar
cd -
#pour metre la signature de firefox en fr_fr sinon il resque d'etre en en_US
echo 'user_pref("general.useragent.locale", "fr-FR");' >>/mnt/chroot/etc/firefox-3.0/profile/prefs.js
#changer le lien de "note de version" dans le menu aide qui en passant renvoi toujours vers ubuntu 8.10 !!
echo 'user_pref("app.releaseNotesURL", "http://doc.ubuntu-fr.org/jaunty");' >>/mnt/chroot/etc/firefox-3.0/profile/prefs.js
}
franciser

#franciser gfxbott

function gfxbott()
{
mkdir -p /mnt/gfxboot
wget http://de.archive.ubuntu.com/ubuntu/pool/main/g/gfxboot-theme-ubuntu/gfxboot-theme-ubuntu_0.7.6.tar.gz -O /mnt/gfxboot/gfxboot-theme-ubuntu_0.7.6.tar.gz
apt-get install dpkg-dev -y
cd /mnt/gfxboot
tar -xvzf /mnt/gfxboot/gfxboot-theme-ubuntu_0.7.6.tar.gz
cd /mnt/gfxboot/gfxboot-theme-ubuntu
sed -i "s%DEFAULT_LANG =.*%DEFAULT_LANG = fr%g" /mnt/gfxboot/gfxboot-theme-ubuntu/Makefile
make
cp -Rf /mnt/gfxboot/gfxboot-theme-ubuntu/install/. /mnt/cpiso/isolinux
cd /mnt
rm -Rf /mnt/gfxboot*
}
gfxbott


#reconstruction

function reconstruction()
{
#Menage
chroot /mnt/chroot<<"EOF"
export LANG="fr_FR.UTF-8"
export HOME=/root
export LC_ALL=C
dpkg-reconfigure locales
apt-get clean
apt-get autoremove -y
apt-get autoclean
update-pciids
update-usbids
#purge paquets
dpkg -l |grep ^rc |awk '{print $2}' |xargs dpkg -P &>/dev/null
apt-get check #vérifier le cache et de détecter d'éventuels problèmes de dépendance
TEST1=$(grep '^[^:]*:[^:]*:[1-9][0-9][0-9][0-9]:' /etc/passwd)
TEST2=$(grep '^[^:]*:[^:]*:[12][0-9][0-9][0-9][0-9]:' /etc/passwd)
if [[ $TEST1 || $TEST2 ]]; then
echo -e "\033[1;47;31m Erreur: /etc/passwd contiens un utilisateur non conforme. \033[0m" ;
exit 0
fi
EOF

#Remettre conf à origine
chroot /mnt/chroot<<"EOF"
export LANG="fr_FR.UTF-8"
export HOME=/root
export LC_ALL=C
#au cas ou tout repasser a root
chown -Rf root:root /etc/skel
rm -Rf /var/tmp/*
rm -Rf /tmp/*
rm -Rf /var/crash/*
rm -Rf /var/lock/*
rm -Rf /var/run/*
rm /etc/resolv.conf
rm /etc/hosts
echo -e "# UNCONFIGURED FSTAB FOR BASE SYSTEM" | tee /etc/fstab
mv -f /etc/apt/sources.list.sauvegarde /etc/apt/sources.list
/etc/init.d/cupsys stop
/etc/init.d/dbus stop
EOF
#kill process
kill -9 `lsof -at /mnt/chroot | xargs` &>/dev/null
#Stop chroot
umount -f /mnt/chroot/proc/sys/fs/binfmt_misc binfmt_misc
umount -f /mnt/chroot/proc
umount -f /mnt/chroot/sys
umount -f /mnt/chroot/dev/pts
umount -f /mnt/chroot/dev

#Hors chroot
#deplacer  initrd dans iso a reconstruire
rm /mnt/cpiso/casper/initrd.gz
mv -f /mnt/chroot/boot/initrd.img-2.6.28-11-generic /mnt/cpiso/casper/initrd.gz

#Supprimer ancien squashfs
rm /mnt/cpiso/casper/filesystem.squashfs
#Supprimer
rm /mnt/cpiso/ubuntu

#on regenere filesystem.manifest et filesystem.manifest-desktop
chroot /mnt/chroot dpkg-query -W --showformat='${Package} ${Version}\n' >/mnt/cpiso/casper/filesystem.manifest
cp -f /mnt/cpiso/casper/filesystem.manifest /mnt/cpiso/casper/filesystem.manifest-desktop
sed -i '/ubiquity/d' /mnt/cpiso/casper/filesystem.manifest-desktop

#faire prechauffer le/les processeur, on reconstruit, pause café
#reconstruire squashfs
mksquashfs /mnt/chroot/ /mnt/cpiso/casper/filesystem.squashfs

#reconstruire le fichier md5sum.txt
cd /mnt/cpiso
find . -type f -print0 | xargs -0 md5sum | tee md5sum.txt

#reconstruire image .iso CD
mkisofs -r -V "Jaunty Fr" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o "$HOME/ubuntu-9.04-desktop-i386-fr.iso" /mnt/cpiso

chown $SUDO_USER:$SUDO_USER "$HOME/ubuntu-9.04-desktop-i386-fr.iso"
chmod 644 "$HOME/ubuntu-9.04-desktop-i386-fr.iso"

#Supprimer chroot
rm -R /mnt/chroot
#Supprimer cpiso
rm -R /mnt/cpiso
}
reconstruction
#F.I.N

Dernière modification par frafa (Le 27/04/2009, à 03:14)

Hors ligne