All pastes #991628 Raw Edit

sudoers

public text v1 · immutable
#991628 ·published 2008-04-21 05:31 UTC
rendered paste body
#!/bin/sh


DIALOG=dialog
intro() {
local msg=$(echo "

# Dernière édition: 21 avril 2008
# VersionID: archSCRIPT v 0.4 (Ogry)
# Info supplémentaire: Système de base seulement

# archSCRIPT v0.4 - Un installateur automatique d'Arch Linux (version loins d'être terminé)
# Copyright (C) 2008   Antoine Gervais  (antogerva[a]gmail.com)
#
#
##
# Tout d'abord, ceci est un logiciel libre et de ce fait vous pouvez
# le configurer comme cela vous chante en accord avec les thermes de la
# General Public License (GNU), tel que stipuler par la troisième version
# de la Free Software Foundation ou encore a une version à venir. De plus
# vous devrez avoir avoir une copie de la GNU General Public License qui
# vient avec ce programme, si ce n'est pas le cas, vous pouvez l'obtenir
# à cette page <http://www.gnu.org/licenses/>.
##
#
########
# Note : Si ce programme est distribué sous license GPL... ce n'est pas
# pour rien ! Je vous recommande grandement de regarder attentivement le
# code source de ce script et d'y apporter vos propre
# config/personalisation ;-)
#
# Ce sript est à la base optimiser pour les canadiens français, mais vous
# pouvez faire une configuration propre à vous et le redistribuer sous
# un autre nom en indiquant qu'il est basé sur celui-ci.
#
########---------------------------------------------------------------########








########---------------------------------------------------------------########


# -- Index --

#  Configuration du vrai pacman.conf..................................ligne
#  Configurartion du fstab............................................ligne
#  Configuration du menu.lst (de grub)................................ligne
#  Configuration du rc.conf


########---------------------------------------------------------------########

#
#
#
#
#
#

############
#Bonjour à vous, cher utilisateur de ce script,
#
# Donc, si vous lisez présentement ce texte, je peux lire en vous à peu près trois
# de personnes, soit vous êtes le fameux guru du forums, qui ne rate jamais une
# une occasions de s'instruire... ou vous encore un de ces nooby qui à poser une
# question stupide l'autre.... ou encre un mélange des deux ;D
#
# Bref, quelques soit les raisons d'utilisation de ce scripte, sachez que chaque
# partie du fichier est largement documenter, pour vous donner au moins une idée
# de ce que fait tel commande.
#
# D'ailleur, si vous êtes nouveau depuis peu, dans le monde de Linux, il se peut
# que vous trouvez cette méthode d'installaion par script un peu primitive...
# mais détrompez-vous, non seulement vous obtiendrez un système aux
# moins 4 fois plus rapide qu'Ubuntu ainsi que grandement simiaire à celle de
# Gentoo, mais en plus, vous aurez un très bon avant goût de comment fonctionne
# un système Linux et dite vous aussi, que dans l'univers de l'open-source ça
# serait stupide de faire uniquement du clique bouton, alors que vous avez un
# merveilleux a étudier devant vos yeux ;-)
#
#
###########

")
  $DIALOG --msgbox "$msg" 63 63 && clear
}
intro


# TODO, si on veut que ce soit éxécutable
# chmod a+x $0

# TODO, si on veut que seul root, puisse utiliser ce script..
# 
#if [ `id -u` -ne 0 ]; then
#  echo "You must be root to use this script."
#  exit 1
#fi

# J'imagine que vos partitions et tout et tout son déjà aménager pour acceuillir
# votre nouveau système

# cfdisk

function SETTINGS()
{
 

    # c'est sur cette variable que tout votre système est installer... donc soyez vigilant ;)
    SOURCELOCATION="/mnt/arch"


#### -- Information sur l'utilisateur -- ####
    UserName=badpotato # évité les majuscule


    # Partition info
    ## Note : si vous mettez hda ou sda... ceci sera mit dans votre fstab.

# D'abord la partition swap

    SWAPPART=sda5

# Maintenant la partition racinde, ainsi que son type

    FilesSystem=sda10
TypeFilesSystem=reiserfs


# Maintenant la partition home...

    Home=$FilesSystem
TypeHOME=$TypeFilesSystem


########---Experts---#######
#    BOOT=$FilesSystem
#TypeBOOT=ext2
#
#    USR=$FilesSystem
#TypeUSR=
#
#    PROC=$FilesSystem
#TypePROC=
#
#    DEV=$FilesSystem
#TypeDEV= 
#
#    SYS=$FilesSystem
#TypeSYS=
#
#    BIN=$FilesSystem
#TypeBIN=
#
#    SBIN=$FilesSystem
#TypeSBIN=
#
#    TMP=$FilesSystem
#TypeTMP=
#
#    OPT=$FilesSystem
#TypeOPT=
#
#    VAR=$FilesSystem
#TypeVAR=
#
#    MEDIA=$FilesSystem
#TypeMEDIA=
#
#    MNT=
#TypeMNT=
#
###########################


# IMPORTANT

                 ###=--=######=--=###            ##
                 # !Option du Grub! #           ###
             #####  --------------  #         #####
##################                  #####   #######
             GRUB_INSTALL="/dev/sda"    # ###########################
                 GRUB_ROOT="hd0,9"      ################################
                GRUB_SETUP="hd0"        # ###########################
                                      ###   #######
##################                  ###       ##### 
                 #                  #          ####
                 ###=--=######=--=###            ##

 # Information Général


  ScriptName=$(basename $0)


  # LInformaton sur localisation
  ZONEINFO=America/Montreal
  LOCALE=fr_CA                                     
  HARDWARECLOCK=localtime                                               
  TIMEZONE=America/Montreal                                         
  KEYMAP=cf
  CONSOLEFONT=lat9w-16
  CONSOLEMAP=8859-15
  UTC=-4

  # Networking info
  HOSTNAME=rorqual # C'est le nom de votre machine... soyez original!
  DOMAINNAME=
  FQDN=
  IPPREFIX=24
  IPADRESS=192.168.1.169
  GATEWAY=192.168.1.1
  DNS1=192.168.1.1
  DNS2=192.168.1.1
  IPBROADCAST=192.168.1.255

###### --------------- Configuration de X ------------ ########
# note: si vous connaissez pas les informations qui vont à ses endroits, vous pouvez les laissez vides
  
KEYBOARD="ca(fr)"


# FIXME utiliser le programme hwd(ou autre, mais celui-ci le fait), pour configurer ça automatiquement plus tard...
HORIZSYNC="28.0-96.0" #kHz
VERTREFRESH="50.0-75.0" #Hz


DRIVER="ati"
RESOLUTION="1024x768"
PROFONDEUR="24"




  # À venir, votre propre configuration du kernel
  #
  KERNELCONFIGMIRROR=http://www.mywebsite/kernel/.config



############---Configuration de vos Packages---##############
#
#Il vous suffit simplement de décommenter les lignes qui vous
#intéresse, pour qu'elle soivent installer.

  GdmPackage="gdm"

  KdmPackage="kdm"

  WindowsManagerPackage="fluxbox fluxconf archlinux-xdg-menu"

  CompizPackage=""
 
  GnomePackage=""

  KdemodPackage=""

  Xfce4Package=""

#  PackageInternet="firefox"

  PackageMultimedia=""

  PackagePerso="xmoto"

}
SETTINGS





###############================================================================##################
###############================================================================##################

# Création d'un nouveau pour Scipt pour passer le relais, une fois en chroot
function NewArchScriptSuite()
{
cat > $SOURCELOCATION/root/archSCRIPT-0.1-suite.sh << "EOF" 
#!/bin/sh 
function ConfigurationSystem()
{
echo root:$PASSROOT1 | chpasswd

# les locales
locale-gen

# source
. /etc/profile

# user
/usr/sbin/useradd -m -s /bin/bash $UserName
/usr/sbin/usermod -G users,wheel,optical,floppy,storage,video $UserName 
echo $UserName:$PASSUSER1 | chpasswd




# Configuration du .bashrc
#cat > /root/.bashrc <<FIN
#export LESSCHARSET=latin9
#FIN

# Configuration du .bash_profile
#PAGER /bin/less -is
#/usr/bin/sudo /usr/bin/unicode_start
#FIN

# encodage utf8..
#pacman --noconfirm -S groff-utf8

# hum, hum.. configuration à suivre...


# Installation du nécessaire du serveur X
pacman --noconfirm -Sy xorg-server xf86-input-mouse xf86-input-keyboard
pacman --noconfirm -S xf86-video-vesa xorg-xinit xterm

#####
# intallation de font

pacman --noconfirm -S  xorg-fonts-misc xorg-fonts-100dpi xorg-fonts-75dpi xorg-fonts-type1 font-bitstream-speedo

# nécessaire pour api sdk ?
pacman --noconfirm -S freetype2 ttf-freefont sdl_ttf 

# font microsoft ou libre ?
pacman --noconfirm -S ttf-ms-fonts ttf-freefont
#####


pacman --noconfirm -S hwd 

# solution pour un sample

hwd -s
yes | hwd -xa

#### Fixme
#===> isntallation des driver et configuration du serveur X

pacman --noconfirm -S hal 


#### Fixme
pacman --noconfirm -S alsa-lib alsa-utils alsa-oss

cp -v /usr/sbin/alsaconf /root/tools/
sed -i '/acex 0/d' /root/tools/alsaconf
sh /root/tools/alsaconf

# ajout au groupe audio de l'user
/usr/sbin/usermod -G audio -a $UserName

# Test de son =)
aplay /usr/share/sounds/alsa/Noise.wav
aplay /usr/share/sounds/startup3.wav

# Outil de gestion de paquetage...
pacman --noconfirm -Sy yaourt wget abs 

#### fixme
#===> vérifier si les dépendances de yaourt on déjà le fakeroot, wget, etc...

# abs
pacman --noconfirm -S pkgconfig fakeroot



# Sudo...
pacman --noconfirm -S sudo

# TODO, moins botcher le sudoers files...
sudosisation()
{
 (echo "# sudoers file." &&
  echo "#" &&
  echo "# Host alias specification" &&
  echo "Host_Alias ICI = $HOSTNAME" &&
  echo "Host_Alias LOCALNET = 192.168.1.*" &&
  echo "" &&
  echo "# User alias specification" &&
  echo "User_Alias ROOT_FRIENDS = $UserName" &&
  echo "" &&
  echo "# Cmnd alias specification" &&
  echo "Cmnd_Alias SOUND = /usr/bin/xmms" &&
  echo "Cmnd_Alias SHUTDOWN = /sbin/shutdown, /sbin/halt, /sbin/reboot, /usr/lib/xfce4/xfsm-shutdown-helper" &&
  echo "Cmnd_Alias PPPCMD = /etc/ppp/scripts/pppconnect, /etc/ppp/scripts/pppdisconnect" &&
  echo "Cmnd_Alias PRINTINGCMDS = /usr/bin/lpq,  /usr/bin/lprm" &&
  echo "# Runas alias specification" &&
  echo "# User privilege specification" &&
  echo "# root peut tout !" &&
  echo "root ALL=(ALL) ALL" &&
  echo "# Les amis de root peuvent lancer les commandes" &&
  echo "# du groupe SHUTDOWN" &&
  echo "ROOT_FRIENDS ICI = NOPASSWD: SHUTDOWN" &&
  echo "# ils peuvent aussi administrer l'imprimante (mais sous" &&
  echo "# le compte de lpadmin, avec un mot de passe) :" &&
  echo "ROOT_FRIENDS ICI = PRINTINGCMDS" &&
  echo "# tout le monde peux lancer xmms avec les droit de root (pour le" &&
  echo "# mode 'temps réel') en local" &&
  echo "ALL ICI = NOPASSWD: SOUND" &&
  echo "# tout le monde sur le réseau local peut demander l'établisement" &&
  echo "# de la liaison internet" &&
  echo "ALL LOCALNET = NOPASSWD: PPPCMD " &&
  echo "" &&
echo "") > "/etc/sudoers"
}
sudosisation



#### TODO
#===> modifier le rc.conf en consquence...

/usr/bin/pacman --noconfirm -S $WindowsManagerPackage $CompizPackage $KdemodPackage $Xfce4Package $PackageInternet $PackageMultimedia $PackagePerso $GdmPackage

pacman --noconfirm -S grub
cp -v /usr/lib/grub/i386-pc/stage{1,2} /boot/grub

sh /root/tools/grubinstall.sh

}

ConfigurationSystem


echo "Félécitation !!!"

echo "Mot de passe pour le super utilisateur"
passwd
echo "Mot de passe pour l'utilisateur "$UserName""
passwd $UserName

# clochette :)

echo -e "\a"
echo -e "\a"
echo -e "\a"
echo -e "\a"
echo -e "\a" 

# Fin du chroot
EOF
}


##################################-----------------------#############################################
##################################-----------------------#############################################

#echo "Entrez le nom d'utilisateur:"
#read USER

echo "Pour commencer, nous allons défénir un mot de passe pour le root et $UserName (l'user)."
echo "Commençont par le root"

PASSROOT1="Le ciel est bleu"
PASSROOT2="La mer est calme"

PASSUSER1="Ferme ta yeule pis rame"
PASSUSER2="ohhhhhhh yeah"


while [ "$PASSROOT1" != "$PASSROOT2" ]; do

   echo "Entrez le mot de passe pour root:"
   read -s PASSROOT1
   echo "Confirmez le mot de passe pour root:"
   read -s PASSROOT2

   if [ "$PASSROOT1" != "$PASSROOT2" ]; then
      echo "Erreur de saisie du mot de passe.  Recommencez..."
   fi

done

echo "Bravo, configuront celui de l'user ( $UserName ) "

while [ "$PASSUSER1" != "$PASSUSER2" ]; do

   echo "Entrez le mot de passe pour $UserName (l'user):"
   read -s PASSUSER1
   echo "Confirmez le mot de passe pour $UserName (l'user):"
   read -s PASSUSER2

   if [ "$PASSUSER1" != "$PASSUSER2" ]; then
      echo "Erreur de saisie du mot de passe.  Recommencez..."
   fi

done



# ici j'appèlle le nom de la variale le execPATH
# car c'est là que l'on se trouve au tout, quand on démarre le script
# en présumant que vous êtes au même endroit quand le script à son
# exécution... ça sera un truc qu'il faudra que j'arrange pour qu'on
# puisse le démarrer de n'importe où.

#execPATH=$( pwd )

# Maintenant notre système temporaire(pacman) sera mit sur /tmp
# le temps qu'on installe nos là base de arch ...

mkdir -pv "$SOURCELOCATION/tmp" "$SOURCELOCATION/etc"
cd "$SOURCELOCATION/tmp"
echo "bien, pour commencer on va installer quelques fichier temporaire dans:" ; pwd

wget  ftp://ftp.archlinux.org/core/os/i686/pacman-3.*
tar zxvf pacman*.pkg.tar.gz
sed -i 's| /etc/pacman.d|'"$SOURCELOCATION"'/tmp/etc/pacman.d|' "$SOURCELOCATION"/tmp/etc/pacman.conf


##
## Inutile pour le moment de disposer de la liste des packages de base
##
#wget ftp://ftp.archlinux.org/core/os/i686/packages.txt
#grep '^base/' packages.txt | sed -r 's|^base/(.*)-[^-]*-[^-]*-[^-]*\.pkg.tar.*|\1|' | xargs echo -n "" > basepackages.txt
#programme_de_base=$(cat basepackages.txt)
##






pacman()
{
 (echo "# /etc/pacman.conf"                                                        &&
  echo "#"                                                                         &&
  echo "# See the pacman manpage for option directives"                            &&
  echo "#"                                                                         &&
  echo "# GENERAL OPTIONS"                                                         &&
  echo ""                                                                          &&
  echo "[options]"                                                                 &&
  echo "# The following paths are commented out with their default values listed." &&
  echo "# If you wish to use different paths, uncomment and update the paths."     &&
  echo ""                                                                          &&
  echo "#RootDir     = /"                                                          &&
  echo "DBPath      = $SOURCELOCATION/var/lib/pacman/"                             &&
  echo "CacheDir    = $SOURCELOCATION/var/cache/pacman/pkg/"                       &&
  echo "LogFile     = $SOURCELOCATION/var/log/pacman.log"                          &&
  echo "HoldPkg     = pacman glibc"                                                &&
  echo "#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u"                    &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "#"                                                                         &&
  echo "# REPOSITORIES"                                                            &&
  echo "# - can be defined here or included from another file"                     &&
  echo "# - pacman will search repositories in the order defined here"             &&
  echo "# - local/custom mirrors can be added here or in separate files"           &&
  echo "# - repositories listed first will take precedence when packages"          &&
  echo "#   have identical names, regardless of version"                           &&
  echo ""                                                                          &&
  echo "# Repository entries are of the format:"                                   &&
  echo "#       [repo-name]"                                                       &&
  echo "#       Server = ServerName"                                               &&
  echo "#       Include = IncludePath"                                             &&
  echo ""                                                                          &&
  echo "# The header [repo-name] is crucial - it must be present and"              &&
  echo "# uncommented to enable the repo."                                         &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "########################"                                                  &&
  echo ""                                                                          &&
  echo "[current]"                                                                 &&
  echo "# Add your preferred servers here, they will be used first"                &&
  echo "#Include = /etc/pacman.d/current"                                          &&
  echo "Server = ftp://ftp.archlinux.org/current/os/i686"                          &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "[core]"                                                                    &&
  echo "# Add your preferred servers here, they will be used first"                &&
  echo "Server = ftp://ftp.archlinux.org/core/os/i686"                             &&
  echo ""                                                                          &&
  echo "[extra]"                                                                   &&
  echo "# Add your preferred servers here, they will be used first"                &&
  echo "#Include = /etc/pacman.d/extra"                                            &&
  echo "Server = ftp://ftp.archlinux.org/extra/os/i686"                            &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "[community]"                                                               &&
  echo "# Add your preferred servers here, they will be used first"                &&
  echo "#Include = /etc/pacman.d/community"                                        &&
  echo "Server = ftp://ftp.archlinux.org/community/os/i686"                        &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "[kdemod]"                                                                  &&
  echo "Server = http://kdemod.ath.cx/repo/current/i686"                           &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "[archlinuxfr]"                                                             &&
  echo "Server = http://repo.archlinux.fr/i686"                                    &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "#[unstable]"                                                               &&
  echo "# Add your preferred servers here, they will be used first"                &&
  echo "#Include = /etc/pacman.d/unstable"                                         &&
  echo "# An example of a custom package repository.  See the pacman manpage for"  &&
  echo "# tips on creating your own repositories."                                 &&
  echo "#[custom]"                                                                 &&
  echo "#Server = file:///home/custompkgs"                                         &&
  echo ""                                                                          &&
  echo "# End /etc/pacman.conf"                                                    &&
  echo ""                                                                          &&
  echo "") > "$SOURCELOCATION/tmp/etc/pacman.conf"
}
pacman




rconfig()
{
 (echo "# /etc/rc.conf - Main Configuration for Arch Linux"                        &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "# -----------------------------------------------------------------------" &&
  echo "# LOCALIZATION"                                                            &&
  echo "# -----------------------------------------------------------------------" &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "# LOCALE: available languages can be listed with the "locale -a" command"  &&
  echo "# HARDWARECLOCK: set to "UTC" or "localtime""                              &&
  echo "# TIMEZONE: timezones are found in /usr/share/zoneinfo"                    &&
  echo "# KEYMAP: keymaps are found in /usr/share/kbd/keymaps"                     &&
  echo "# CONSOLEFONT: found in /usr/share/kbd/consolefonts"                       &&
  echo "# CONSOLEMAP: found in /usr/share/kbd/consoletrans"                        &&
  echo "# USECOLOR: use ANSI color sequences in startup messages"                  &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "LOCALE="$LOCALE.utf8""                                                     &&
  echo "HARDWARECLOCK="$HARDWARECLOCK""                                            &&
  echo "TIMEZONE="$TIMEZONE""                                                      &&
  echo "KEYMAP="$KEYMAP""                                                          &&
  echo "CONSOLEFONT="lat9w-16""                                                    &&
  echo "CONSOLEMAP="8859-15""                                                      &&
  echo "USECOLOR="yes""                                                            &&
  echo ""                                                                          &&
  echo "# -----------------------------------------------------------------------" &&
  echo "# HARDWARE"                                                                &&
  echo "# -----------------------------------------------------------------------" &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "# Module Blacklist - modules in this list will never be loaded by udev"    &&
  echo ""                                                                          &&
  echo "MOD_AUTOLOAD="yes""                                                        &&
  echo "# Module Blacklist - modules in this list will never be loaded by udev"    &&
  echo "# Example: MOD_BLACKLIST=(fglrx)"                                          &&
  echo "MOD_BLACKLIST=()"                                                          &&
  echo "# Modules to load at boot-up (in this order)"                              &&
  echo "# - prefix a module with a ! to blacklist it"                              &&
  echo "# Example: MODULES=(fuse reiserfs ipw2200  battery fan svgalib radeon)"    &&
  echo "MODULES=()"                                                                &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "# Scan for LVM volume groups at startup, required if you use LVM"          &&
  echo "USELVM="no""                                                               &&
  echo ""                                                                          &&
  echo "# -----------------------------------------------------------------------" &&
  echo "# NETWORKING"                                                              &&
  echo "# -----------------------------------------------------------------------" &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "HOSTNAME="rorqual""                                                        &&
  echo "# Use "ifconfig -a" or "ls /sys/class/net/" to see all available"          &&
  echo "# interfaces."                                                             &&
  echo ""                                                                          &&
  echo "# Interfaces to start at boot-up (in this order)"                          &&
  echo "# Declare each interface then list in INTERFACES"                          &&
  echo ""                                                                          &&
  echo "#   - prefix an entry in INTERFACES with a ! to disable it"                &&
  echo "#   - no hyphens in your interface names - Bash doesn't like it"           &&
  echo ""                                                                          &&
  echo "# Note: to use DHCP, set your interface to be "dhcp" (eth0="dhcp")"        &&
  echo "# Don't use this for wireless interfaces, see network profiles below"      &&
  echo ""                                                                          &&
  echo "eth0="dhcp""                                                               &&
  echo "INTERFACES=(eth0 eth1 !wlan0)"                                             &&
  echo "lo="lo 127.0.0.1""                                                         &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "#eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255""    &&
  echo "#wlan0="dhcp""                                                             &&
  echo "#wlan_wlan0="wlan0 mode auto key s:xxxxxxxxxxxxxxxxxxx essid myessid""     &&
  echo "#eth1="dhcp""                                                              &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "# Routes to start at boot-up (in this order)"                              &&
  echo "# Declare each route then list in ROUTES"                                  &&
  echo "# - prefix an entry in ROUTES with a ! to disable it"                      &&
  echo "#"                                                                         &&
  echo "# gateway="default gw 192.168.0.1""                                        &&
  echo "# ROUTES=(!gateway)"                                                       &&
  echo ""                                                                          &&
  echo "# Enable these network profiles at boot-up.  These are only useful"        &&
  echo "# if you happen to need multiple network configurations(ie, laptop users)" &&
  echo "# - set to menu to present a menu during boot-up(dialog package required)" &&
  echo "# - prefix an entry with a ! to disable it"                                &&
  echo ""                                                                          &&
  echo "# Network profiles are found in /etc/network-profiles"                     &&
  echo ""                                                                          &&
  echo "# NET_PROFILES=(config_wpa maison)"                                        &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "# -----------------------------------------------------------------------" &&
  echo "# DAEMONS"                                                                 &&
  echo "# -----------------------------------------------------------------------" &&
  echo ""                                                                          &&
  echo "# Daemons to start at boot-up (in this order)"                             &&
  echo "#   - prefix a daemon with a ! to disable it"                              &&
  echo "#   - prefix a daemon with a @ to start it up in the background"           &&
  echo ""                                                                          &&
  echo "DAEMONS=(@syslog-ng @network dbus gpm @crond @hal @alsa fam esd stbd)"     &&
  echo ""                                                                          &&
  echo ""                                                                          &&
  echo "# End of file"                                                             &&
  echo ""                                                                          &&
  echo "") > $SOURCELOCATION/etc/rc.conf

}


mkdir -pv "$SOURCELOCATION/var/lib/pacman/"
mkdir -pv "$SOURCELOCATION/root/tools"
mkdir -pv "$SOURCELOCATION/boot/grub"
mkdir -pv "$SOURCELOCATION/etc/X11/"

# Installation de la base de arch avec notre pacman temporaire...

$SOURCELOCATION/tmp/usr/bin/pacman.static --dbpath "$SOURCELOCATION/var/lib/pacman/" --root "$SOURCELOCATION" --config "$SOURCELOCATION/tmp/etc/pacman.conf" --noconfirm -Sy base  ### $programme_de_base <== (intutille pour le moment)



# Fixme
cat /etc/resolv.conf > "$SOURCELOCATION"/etc/resolv.conf

cat /etc/X11/xorg.conf > "$SOURCELOCATION"/etc/X11/xorg.conf
# Note: peut être utiliser les udev rules(30) pour configurer xorg.conf
####===> trouver une façon plus intelligente d'intégrer ces fichier de configuration...



function fstabconfig()
{
 (echo "# Begin /etc/fstab" &&
  echo "                                                                                        " &&
  echo "# <file system>   <mount-point>  <type>            <options>             <dump>  <pass> " &&
  echo "#                                                                                       " &&
  echo "/dev/$SWAPPART    swap           swap              defaults              0       0      " &&
  echo "/dev/$FilesSystem /              $TypeFilesSystem  defaults,noatime      0       1      " &&
  echo "#/dev/$Home       /home          $TypeHOME         defaults              0       0      " &&
  echo "#                                                                                       " &&
  echo "#/dev/$BOOT       /boot          $TypeBOOT         defaults              0       0      " &&
  echo "#                                                                                       " &&
  echo "#none             /proc          proc              defaults              0       0      " &&
  echo "#none             /sys           sysfs             defaults              0       0      " &&
  echo "#                                                                                       " &&
  echo "#                                                                                       " &&
  echo "# Grâce à /dev/pts on facillite pas mal plus la vie à Xterm & Cie...                    " &&
  echo "#                                                                                       " &&
  echo "none              /dev/pts       devpts            gid=5,mode=666        0       0      " &&
  echo "/dev/cdrom        /mnt/cdrom     iso9660           ro,user,noauto,unhide 0       0      " &&
  echo "/dev/dvd          /mnt/dvd       udf               ro,user,noauto,unhide 0       0      " &&
  echo "#                                                                                       " &&
  echo "#                                                                                       " &&
  echo "# End /etc/fstab") > $SOURCELOCATION/etc/fstab
}

function grubconfig()
{
 (echo "# Begin /boot/grub/menu.lst"                                                &&
  echo ""                                                                           &&
  echo "# numlockx ## (à vérifier si c'est bien cela.... pas sur)"                  &&
  echo ""                                                                           &&
  echo "# By default boot the first menu entry."                                    &&
  echo "default 0"                                                                  &&
  echo ""                                                                           &&
  echo "# Allow 30 seconds before booting the default."                             &&
  echo "timeout 10"                                                                 &&
  echo ""                                                                           &&
  echo "# Use prettier colors."                                                     &&
  echo "color light-blue/black light-cyan/blue"                                     &&
  echo ""                                                                           &&
  echo "# (1) Entrée pour Arch Linux"                                               &&
  echo "title Arch Linux"                                                           &&
  echo "root ($GRUB_ROOT)"                                                          &&
  echo "kernel  /boot/vmlinuz26 root=/dev/$FilesSystem vga=790 ro"                  &&
  echo "initrd /boot/kernel26.img"                                                  &&
  echo ""                                                                           &&
  echo ""                                                                           &&
  echo ""                                                                           &&
  echo ""                                                                           &&
  echo ""                                                                           &&
  echo ""                                                                           &&
  echo "") > $SOURCELOCATION/boot/grub/menu.lst
}




# Avec les commandes qui suivent, notre rc.conf, fstab, xorg.conf et notre menu.lst vont se créer.
rconfig

grubconfig

fstabconfig


## Les commande suivantes fait en sorte que le check de partition, soit utiliser à des fréquence de 100 montage.
#
#tune2fs -i 0 /dev/$FilesSystem
#tune2fs -c 100 /dev/$FilesSystem



# nouveau /etc/pacman.conf ==> configurer le comme vous le vouler :)

cat > $SOURCELOCATION/etc/pacman.conf << "EOF" 
# /etc/pacman.conf
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# See the pacman manpage for option directives

#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir     = /
#DBPath      = /var/lib/pacman/
#CacheDir    = /var/cache/pacman/pkg/
#LogFile     = /var/log/pacman.log
HoldPkg     = pacman glibc
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u

#
# REPOSITORIES
#   - can be defined here or included from another file
#   - pacman will search repositories in the order defined here
#   - local/custom mirrors can be added here or in separate files
#   - repositories listed first will take precedence when packages
#     have identical names, regardless of version number
#
# Repository entries are of the format:
#       [repo-name]
#       Server = ServerName
#       Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#

[current]
# Add your preferred servers here, they will be used first
#Include = /etc/pacman.d/current
Server = ftp://ftp.archlinux.org/current/os/i686

[core]
Server = ftp://ftp.archlinux.org/core/os/i686


[extra]
# Add your preferred servers here, they will be used first
#Include = /etc/pacman.d/extra
Server = ftp://ftp.archlinux.org/extra/os/i686

[community]
# Add your preferred servers here, they will be used first
#Include = /etc/pacman.d/community
Server = ftp://ftp.archlinux.org/community/os/i686

[kdemod]
Server = http://kdemod.ath.cx/repo/current/i686

[archlinuxfr]
Server = http://repo.archlinux.fr/i686

[svn]
Server = http://cvs.archlinux.org


#[compiz-fusion]
#Server = http://arch.nesl247.org/compiz-fusion/i686

#[unstable]
# Add your preferred servers here, they will be used first
#Include = /etc/pacman.d/unstable

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#Server = file:///home/custompkgs

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Fin du /etc/pacman.conf
EOF

# on va modifier notre locale.gen

sed -e "s/#$LOCALE/$LOCALE/" $SOURCELOCATION/etc/locale.gen > $SOURCELOCATION/etc/locale.gen2
mv $SOURCELOCATION/etc/locale.gen $SOURCELOCATION/etc/locale.gen.old
mv $SOURCELOCATION/etc/locale.gen2 $SOURCELOCATION/etc/locale.gen







############################################################################





# la voie semble être libre... chrootons!

function chrooting()
{

 mount -t proc none $SOURCELOCATION/proc
 mount -o bind /dev $SOURCELOCATION/dev

chroot "$SOURCELOCATION" /usr/bin/env -i              \
       UserName="$UserName"                           \
                                                      \
       WindowsManagerPackage="$WindowsManagerPackage" \
       CompizPackage="$CompizPackage"                 \
       KdemodPackage="$KdemodPackage"                 \
       Xfce4Package="$Xfce4Package"                   \
       PackageInternet="$PackageInternet"             \
       PackageMultimedia="$PackageMultimedia"         \
       PackagePerso="$PackagePerso"                   \
                                                      \
       PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin    \
       HOME=/root TERM="$TERM" PS1='\u:\w\$ '         \
                                                      \
       PASSUSER1="$PASSUSER1" PASSROOT1="$PASSROOT1"  \
                                                      \
/bin/bash --login +h /root/archSCRIPT-0.1-suite.sh ConfigurationSystem
}
NewArchScriptSuite


GRUBinstall()
{
 (echo "#!/bin/bash" &&
  echo "GRUB_ROOT="$GRUB_ROOT"" &&     
  echo "GRUB_SETUP="$GRUB_SETUP"" &&       
  echo "GRUB_INSTALL="$GRUB_INSTALL"" &&
  echo "" &&
  echo "grub-install $GRUB_INSTALL" &&

  echo "grub --batch <<FIN " &&
  echo "root ($GRUB_ROOT)" &&
  echo "setup ($GRUB_SETUP)" &&
  echo "quit" &&
  echo "FIN" &&
  echo "" &&
  echo "" &&
  echo "") > $SOURCELOCATION/root/tools/grubinstall.sh
}

GRUBinstall

chrooting