Ceci est une ancienne révision du document !


Script de francisation du live CD

#!/bin/bash
# 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/>.
 
# TODO: SCU 10.04 → SCU 10.10
# TODO: URL Firefox 10.04 → URL Firefox 10.10
 
# Updating repositories
apt-get update
 
# Removing unused packages
LANG=C
apt-get -y purge `dpkg -l | awk '{print $2}' | egrep "^language-pack-|^language-pack-gnome-|^language-support-|^aspell|^myspell-|^hunspell-|^wamerican$|^wbritish$|^openoffice.org-help-|^openoffice.org-hyphenation-|^openoffice.org-thesaurus-|^gimp-help-|^evolution-documentation-" | xargs`
 
# We don't want any preconfigure
sed -ir 's,^[^//](.*),// \1,' /etc/apt/apt.conf.d/70debconf
 
# Installing packages
apt-get -y install language-pack-fr language-pack-fr-base language-support-fr language-support-writing-fr language-pack-gnome-fr language-pack-gnome-fr-base openoffice.org-hyphenation-fr openoffice.org-help-fr openoffice.org-l10n-fr wfrench manpages-fr gnome-user-guide-fr openoffice.org-thesaurus-fr
LANG=fr_FR.UTF-8
 
# Purging *.mo files
# May be inmproved
 
# Purging locale
apt-get -y install localepurge
wget -O /etc/locale.nopurge http://projets.ubuntu-fr.org/iso_fr/locale.nopurge
localepurge
apt-get -y purge localepurge
 
apt-get -y upgrade
 
# Changing the name onto the CD
sed -i "s/Live session user/Session CD/g" /etc/casper.conf
sed -i "s/Live session user/Session CD/g" /usr/share/initramfs-tools/scripts/casper
 
##  Link edition on the desktop in casper
sed -i 's/Desktop/Bureau/g;s/Examples/Exemples/g' /usr/share/initramfs-tools/scripts/casper-bottom/10adduser
 
# TTY localisation 
dpkg-reconfigure -phigh console-setup
 
sed -i 's/Please remove the disc, close the tray (if any)/Retirez le disque, refermez le tiroir (si nécessaire)/' /etc/init.d/casper
sed -i 's/and press ENTER to continue/et appuyez sur Entrée pour continuer/' /etc/init.d/casper
sed -i 's/Please remove the disc and close the tray (if any) then press ENTER: /Retirez le disque, refermez le tiroir (si nécessaire) \net appuyez sur Entrée pour continuer/' /etc/init.d/casper
 
# Todo : casped-md5sum translation
 
# Live CD doesn't accept UID greater than 500
 
if [ -n `grep '^[^:]*:[^:]*:[1-9][0-9][0-9][0-9]:' /etc/passwd` ] ; then 
    usermod -u 500 $login ; 
fi
if [ -n `grep '^[^:]*:[^:]*:[12][0-9][0-9][0-9][0-9]:' /etc/passwd` ] ; then 
    usermod -u 500 $login ; 
fi
 
VAR="`basename /boot/initrd.img-*-generic`" ; KV=${VAR/initrd.img-/} ; echo ${KV}
 
mkdir -p /tmp/init
mkinitramfs -o /tmp/init/initrd.gz ${KV}
 
## extrait
cd /tmp/init
gzip -dc initrd.gz | cpio -id
rm *.gz
 
## Compressing back the initrd in lzma format
find . | cpio --quiet --dereference -o -H newc | lzma -7 > /initrd.lz
cd /
rm -R /tmp/init
 
# Removing the old initrd and getting the new one in place
rm /boot/initrd.img-${KV}
 
#
# Firefox
#
 
# Search plugins
rm -f /usr/share/xul-ext/ubufox/searchplugins/ask.xml # Delete very-english ask.com if exists
rm -rf /usr/lib/firefox-addons/searchplugins/fr
wget http://projets.ubuntu-fr.org/iso_fr/searchplugins.tgz
tar xzf searchplugins.tgz -C /usr/lib/firefox-addons/searchplugins/
rm searchplugins.tgz
 
# Changing default link in Firefox
sed -i 's%http://start.ubuntu.com/10.04/%http://start.ubuntu-fr.org/10.04/%' /usr/share/xul-ext/ubufox/components/aboutHome.js
 
## And language in case
# TODO vérifier que fr-FR passe bien partout, parfois, ce n'est que fr.
sed -i 's/en-US/fr-FR/' /usr/share/xul-ext/ubufox/components/aboutHome.js
sed -i 's/en-US/fr-FR/' /etc/firefox/pref/firefox.js
echo 'user_pref("app.releaseNotesURL", "http://doc.ubuntu-fr.org/lucid");' >> /etc/firefox/pref/firefox.js
echo 'pref("startup.homepage_override_url","file:///usr/share/ubuntu-artwork/home/locales/index-fr.html");' >> /etc/firefox/pref/firefox.js
 
# Bookmarks in Firefox
wget http://projets.ubuntu-fr.org/iso_fr/bookmarks.html -O /etc/firefox/profile/bookmarks.html
 
## This is specific to French localization, since we translated examples.
rm -rf /usr/share/example-content/*
wget http://projets.ubuntu-fr.org/iso_fr/exemples.tar.gz
tar -xzvf exemples.tar.gz -C /usr/share/example-content/
rm exemples.tar.gz
 
wget https://launchpad.net/ubuntu/lucid/+source/example-content/41/+files/example-content_41.tar.gz
tar -xf example-content_41.tar.gz example-content-41/Ubuntu_Free_Culture_Showcase/ 
tar -xf example-content_41.tar.gz example-content-41/logos/
rm -rf Ubuntu\ Culture\ Libre\ exemples/*
mv example-content-41/Ubuntu_Free_Culture_Showcase/*  Ubuntu\ Culture\ Libre\ exemples/
mv example-content-41/logos/* logos
rm example-content_41.tar.gz 
rm -rf example-content-41
wget -P /usr/share/example-content/Ubuntu\ Culture\ Libre\ exemples/ http://projets.ubuntu-fr.org/iso_fr/UbuntuIsHumanity.srt http://projets.ubuntu-fr.org/iso_fr/UbuntuIsHumanity.txt
chown -R 999:999 /usr/share/example-content/*
 
 
# French radios in ryhtmnbox
wget -O /usr/lib/rhythmbox/plugins/iradio/iradio-initial.pls http://projets.ubuntu-fr.org/iso_fr/iradio-initial.pls
 
# This is specific too, since simplecommeubuntu is a french book
# First trying to install it from the repository 
apt-get -y install simplecommeubuntu
# if it fails, getting it from the author.
if [ ! $? -eq "0" ]; then 
        wget http://people.canonical.com/~didrocks/simplecommeubuntu_10.04_all.deb
        dpkg -i simplecommeubuntu*deb
        rm simplecommeubuntu*deb
fi
# in any case, we want a direct link on the desktop
mkdir /etc/skel/Bureau/
cat > /etc/skel/Bureau/scu-10.04.desktop <<EOF
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Simple Comme Ubuntu 10.04
Comment=Livre libre décrivant l'utilisation d'Ubuntu
Icon=scu-3d
Type=Link
MimeType=application/x-pdf
URL=file:///usr/share/doc/simplecommeubuntu/scu-10.04LTS.pdf.gz
EOF
wget -O /usr/share/pixmaps/scu-3d.png http://people.canonical.com/~didrocks/ubuntu10_04.png
 
# cleanning
apt-get -y install deborphan
apt-get -y purge  fastjar
apt-get -y purge deborphan
 
# Getting out the chroot environment
apt-get -y autoremove --purge
sed -i -r -e 's/(deb .* .*iverse)/# \1/' /etc/apt/sources.list
apt-get -y update
apt-get -y clean
rm -rf /tmp/*
rm -rf /var/tmp/*
cp /dev/null /etc/resolv.conf
cp /dev/null /etc/hosts
 
rm /root/fr.sh
  • projets/traduction_live_cd/inside_chroot.sh.1286480843.txt.gz
  • Dernière modification: Le 07/10/2010, 21:47
  • par snip