Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
|
utilisateurs:m2nis:kickstart [Le 29/06/2010, 08:54] m2nis |
— (Version actuelle) | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== Kickstart ====== | ||
| - | Kickstart est un utilitaire permettant d'automatiser l'installation d'Ubuntu (et de ses variantes Kubuntu, Xubuntu, ...). Il facilite ainsi le déploiement d'un grand nombre de machines en offrant une installation rapide et une configuration personnalisable. | ||
| - | Kickstart est à l'origine le système d'automatisation d'installation de la société RedHat. Le système d'automatisation des distributions Debian et de ses dérivés est Preseed. Réputé plus complexe que Kickstart, ce dernier ne bénéficie pas non plus d'un utilitaire graphique d'aide à la création des fichiers de description. La version de Kickstart présente dans Ubuntu et ses dérivés démultiplie les possibilités en permettant l'utilisation de commandes Preseed. | ||
| - | |||
| - | <note important> | ||
| - | Le portage de Kickstart sur les distributions de Canonical est incomplet. Des instructions telles que la mise à jour de distribution (prise en charge par apt), l'exclusion de paquets ou la configuration de X sont ainsi ignorées. | ||
| - | </note> | ||
| - | |||
| - | Kickstart permet également l'exécution de scripts avant installation, et surtout, après installation. Cette fonctionnalités ouvre encore les possibilités de personnalisation du système installé. Les scripts de fin d'installation peuvent être "chrootés" ou non, c'est-à-dire exécutés dans le système nouvellement installé (chroot) ou dans le système temporaire mis en place pour l'installation (nochroot). | ||
| - | |||
| - | ===== Installation ===== | ||
| - | Kickstart est un utilitaire inclus dans le système et ne nécessite pas d'installation. La création du fichier Kickstart (ks) qui pilotera l'installation du système d'exploitation sera la tâche principale de l'utilisateur. | ||
| - | |||
| - | ===== Principaux scénarios ===== | ||
| - | ==== Déploiement par le réseau ==== | ||
| - | L'installation d'Ubuntu (ou de ses variantes) par le réseau, avec ou sans connexion internet, offre de nombreux intérêts, dont celui d'obtenir une distribution parfaitement à jour dès la fin de l'installation, ce qui sera plus difficilement le cas avec un CD-ROM. | ||
| - | |||
| - | === Eléments nécessaires === | ||
| - | Pour parvenir à réaliser une installation par le réseau, il est nécessaire d'avoir un serveur DNS, DHCP, TFTP et HTTP. Ceux-ci n'ont pas besoin d'être regroupés sur un seul serveur. | ||
| - | |||
| - | === Déroulement de l'installation === | ||
| - | Voici le déroulement d'une installation par le réseau : | ||
| - | - la nouvelle machine boot sur le réseau (en mode PXE) et demande au serveur DHCP une adresse IP et les informations de boot. Les informations de boot sont "next-server" qui donnera à la machine l'information du serveur hébergeant l'image de boot, "root-path" donnant le chemin vers cette image de boot et "filename" pour le nom de l'image | ||
| - | - la nouvelle machine récupère sur le serveur tftp son image de boot | ||
| - | - la nouvelle machine prend sur le serveur http le fichier Kickstart | ||
| - | - la nouvelle machine effectue son installation en récupérant les paquets sur un serveur [[tutoriel:creer_un_miroir_de_depot_local|miroir local]] ou distant (l'accès internet est alors indispensable dans ce dernier cas) | ||
| - | |||
| - | ==== Personnalisation d'un CD-ROM ==== | ||
| - | FIXME | ||
| - | |||
| - | ===== Utilisation ===== | ||
| - | |||
| - | ==== Utilitaire de génération de fichier ks ==== | ||
| - | Il existe un petit utilitaire graphique permettant de définir rapidement les paramètres de base d'un fichier Kickstart. Pour cela, vous pouvez installer le paquet [[apt://system-config-kickstart|system-config-kickstart]]. Cependant, si cet utilitaire vous permettra de vous familiariser avec le système, il trouvera sans doute rapidement ses limites. | ||
| - | |||
| - | ==== Exemple simple de fichier ks ==== | ||
| - | Voici ce que donne un fichier ks généré avec peu d'options depuis l'utilitaire system-config-kickstart : | ||
| - | |||
| - | <code> | ||
| - | #Generated by Kickstart Configurator | ||
| - | #platform=x86 | ||
| - | |||
| - | #System language | ||
| - | lang fr_FR | ||
| - | #Language modules to install | ||
| - | langsupport fr_FR | ||
| - | #System keyboard | ||
| - | keyboard fr | ||
| - | #System mouse | ||
| - | mouse | ||
| - | #System timezone | ||
| - | timezone Europe/Paris | ||
| - | #Root password | ||
| - | rootpw --disabled | ||
| - | #Initial user | ||
| - | user test --fullname "" --iscrypted --password $1$us6C7Q/3$asXQAUrZA89Ky.xGINj9K0 | ||
| - | #Use text mode install | ||
| - | text | ||
| - | #Install OS instead of upgrade | ||
| - | install | ||
| - | #Use CDROM installation media | ||
| - | cdrom | ||
| - | #System bootloader configuration | ||
| - | bootloader --location=mbr | ||
| - | #Clear the Master Boot Record | ||
| - | zerombr yes | ||
| - | #Partition clearing information | ||
| - | clearpart --all --initlabel | ||
| - | #System authorization infomation | ||
| - | auth --useshadow --enablemd5 | ||
| - | #Firewall configuration | ||
| - | firewall --disabled | ||
| - | #Do not configure the X Window System | ||
| - | skipx | ||
| - | </code> | ||
| - | |||
| - | ==== Exemple avancé de fichier ks ==== | ||
| - | Voici un exemple de fichier Kickstart un peu plus avancé, faisant notamment appel à des scripts complémentaires : | ||
| - | |||
| - | <code> | ||
| - | # Script Kickstart pour installation automatisée | ||
| - | # de (U|Xu|Ku)buntu 10.04 LTS par le réseau | ||
| - | # | ||
| - | # Options d'appel : | ||
| - | # machine=nom_de_machine (obligatoire) | ||
| - | # abandon de l'installation si non fourni | ||
| - | # utilisateur=nom_d_utilisateur (facultatif) | ||
| - | # = "Utilisateur_par_defaut" si non fourni | ||
| - | # login=login_utilisateur (facultatif) | ||
| - | # = $machine si non fourni | ||
| - | # mdp=mot_de_passe_utilisateur (facultatif) | ||
| - | # = "temporaire" si non fourni | ||
| - | # mdp_vino=mot_de_passe_prise_de_controle (facultatif) | ||
| - | # = $mdp si non fourni | ||
| - | # distrib=[ubuntu|xubuntu] (facultatif, ubuntu par défaut) | ||
| - | # aformat=non (facultatif, oui par défaut) | ||
| - | # reboot=oui (facultatif, non par défaut) | ||
| - | # redémarrage en fin d'installation si fourni | ||
| - | |||
| - | # Langue à utiliser pour l'installation et le système | ||
| - | lang fr_FR | ||
| - | |||
| - | # Modules de langue à installer | ||
| - | langsupport fr_FR | ||
| - | |||
| - | # Clavier | ||
| - | keyboard fr | ||
| - | |||
| - | # Souris | ||
| - | mouse | ||
| - | |||
| - | # Fuseau horaire | ||
| - | timezone --utc Europe/Paris | ||
| - | |||
| - | # Mot de passe Root (pas de mot de passe pour root par défaut sous Ubuntu) | ||
| - | rootpw --disabled | ||
| - | |||
| - | # Utilisateur de départ - config en section %pre | ||
| - | %include /tmp/user_conf | ||
| - | |||
| - | # Redémarrage après installation si demandé - config en section pre% | ||
| - | %include /tmp/reboot_conf | ||
| - | |||
| - | # Installation en mode texte | ||
| - | text | ||
| - | |||
| - | # Installation de l'OS plutôt que mise à jour | ||
| - | install | ||
| - | |||
| - | # Adresse du dépot local pour installation par le réseau | ||
| - | url --url http://mon_serveur_local/ubuntu/ | ||
| - | |||
| - | # Configuration du chargeur de démarrage | ||
| - | bootloader --location=mbr | ||
| - | |||
| - | # Destruction des tables de partitions invalides | ||
| - | zerombr yes | ||
| - | |||
| - | # Supression puis définition des partitions si demandé | ||
| - | %include /tmp/part_conf | ||
| - | |||
| - | # Définition des options d'authentification pour le système | ||
| - | auth --useshadow --enablemd5 | ||
| - | |||
| - | # Configuration du réseau | ||
| - | %include /tmp/network_conf | ||
| - | |||
| - | # Configuration du pare-feu | ||
| - | firewall --disabled | ||
| - | |||
| - | # Ne pas configurer X pour le système | ||
| - | skipx | ||
| - | |||
| - | # Installation des paquets supplémentaires | ||
| - | %packages --resolvedeps | ||
| - | %include /tmp/paquets_conf | ||
| - | |||
| - | %pre | ||
| - | |||
| - | # Lecture et mise en variables des paramètres d'installation | ||
| - | set -- `cat /proc/cmdline` | ||
| - | for I in $*; do case "$I" in *=*) eval $I;; esac; done | ||
| - | |||
| - | if [ -z "$machine" ]; then | ||
| - | echo "Variable 'machine' non renseignée !" | ||
| - | echo "Abandon de l'installation !" | ||
| - | echo "Redémarrage dans 5 secondes !" | ||
| - | sleep 5 | ||
| - | reboot | ||
| - | fi | ||
| - | |||
| - | if [ -z "$utilisateur" ]; then | ||
| - | utilisateur="Utilisateur_par_defaut" | ||
| - | fi | ||
| - | |||
| - | if [ -z "$login" ]; then | ||
| - | login=$machine | ||
| - | fi | ||
| - | |||
| - | if [ -z "$mdp" ]; then | ||
| - | mdp="temporaire" | ||
| - | fi | ||
| - | |||
| - | if [ -z "$mdp_vino" ]; then | ||
| - | mdp_vino=$mdp | ||
| - | fi | ||
| - | |||
| - | if [ "$distrib" != "xubuntu" ]; then | ||
| - | distrib="ubuntu" | ||
| - | fi | ||
| - | |||
| - | if [ "$aformat" != "non" ]; then | ||
| - | aformat="oui" | ||
| - | fi | ||
| - | |||
| - | if [ "$reboot" != "oui" ]; then | ||
| - | reboot="non" | ||
| - | fi | ||
| - | |||
| - | echo "-------------------------------------------------" | ||
| - | echo " Résumé d\'installation" | ||
| - | echo "-------------------------------------------------" | ||
| - | echo " " | ||
| - | echo " " | ||
| - | echo "-------------------------------------------------" | ||
| - | echo " Nom de la machine = $machine" | ||
| - | echo " Nom de l\'utilisateur = $utilisateur" | ||
| - | echo " Login = $login" | ||
| - | echo " Mot de passe = $mdp" | ||
| - | echo " Mot de passe Vino = $mdp_vino" | ||
| - | echo " Distribution = $distrib" | ||
| - | echo " Formatage automatique = $aformat" | ||
| - | echo " Reboot après install. = $reboot" | ||
| - | echo "-------------------------------------------------" | ||
| - | echo " " | ||
| - | echo " " | ||
| - | echo "-------------------------------------------------" | ||
| - | echo " L\'installation écrasera irrémédiablement" | ||
| - | echo " toutes les données du disque !" | ||
| - | echo " " | ||
| - | echo " Redémarrer la machine avant 30 secondes" | ||
| - | echo " pour annuler l'installation !" | ||
| - | echo "--------------------------------------------------" | ||
| - | echo " " | ||
| - | echo " " | ||
| - | echo " " | ||
| - | sleep 30 | ||
| - | |||
| - | # Configuration de l'utilisateur | ||
| - | echo "user $login --fullname $utilisateur --password $mdp" > /tmp/user_conf | ||
| - | |||
| - | # Gestion du reboot si demandé | ||
| - | if [ "$reboot" == "oui" ]; then | ||
| - | echo "reboot" > /tmp/reboot_conf | ||
| - | fi | ||
| - | |||
| - | # Gestion des partitions si demandé | ||
| - | if [ "$aformat" == "oui" ]; then | ||
| - | cat > /tmp/part_conf << eof | ||
| - | # Suppression des partitions du système | ||
| - | clearpart --all --initlabel | ||
| - | # Définition des partitions | ||
| - | part swap --size 1024 --fstype swap --asprimary | ||
| - | part / --size 1024 --fstype ext3 --asprimary --grow | ||
| - | eof | ||
| - | fi | ||
| - | |||
| - | # Configuration réseau (paramètre '--hostname=" ne fonctionne pas) | ||
| - | echo "network --bootproto dhcp --device=eth0" > /tmp/network_conf | ||
| - | |||
| - | # Configuration des paquets à installer | ||
| - | if [ "$distrib" == "xubuntu" ]; then | ||
| - | cat > /tmp/paquets_conf << eof | ||
| - | @ xubuntu-desktop | ||
| - | bsd-mailx | ||
| - | cups-pdf | ||
| - | icedtea6-plugin | ||
| - | ntp | ||
| - | numlockx | ||
| - | ocsinventory-agent | ||
| - | openoffice.org | ||
| - | smbfs | ||
| - | ssh | ||
| - | ssmtp | ||
| - | #ttf-mscorefonts-installer | ||
| - | vino | ||
| - | eof | ||
| - | else | ||
| - | cat > /tmp/paquets_conf << eof | ||
| - | @ ubuntu-desktop | ||
| - | bsd-mailx | ||
| - | cups-pdf | ||
| - | icedtea6-plugin | ||
| - | ntp | ||
| - | ocsinventory-agent | ||
| - | smbfs | ||
| - | ssh | ||
| - | ssmtp | ||
| - | thunderbird-locale-fr | ||
| - | #ttf-mscorefonts-installer | ||
| - | eof | ||
| - | fi | ||
| - | |||
| - | %post --nochroot | ||
| - | |||
| - | # Reprise de la définition des variables non renseignées car non conservées | ||
| - | if [ -z "$utilisateur" ]; then | ||
| - | utilisateur="Utilisateur_par_defaut" | ||
| - | fi | ||
| - | |||
| - | if [ -z "$login" ]; then | ||
| - | login=$machine | ||
| - | fi | ||
| - | |||
| - | if [ -z "$mdp" ]; then | ||
| - | mdp="temp" | ||
| - | fi | ||
| - | |||
| - | if [ -z "$mdp_vino" ]; then | ||
| - | mdp_vino=$mdp | ||
| - | fi | ||
| - | |||
| - | if [ "$distrib" != "xubuntu" ]; then | ||
| - | distrib="ubuntu" | ||
| - | fi | ||
| - | |||
| - | if [ "$reboot" != "oui" ]; then | ||
| - | reboot="non" | ||
| - | fi | ||
| - | |||
| - | # Changement de serveur du temps (selon nom de la machine) | ||
| - | case "$machine" in | ||
| - | t1* | t2*) | ||
| - | sed -i 's/server ntp.ubuntu.com/server mon_serveur_temps_local/g' /target/etc/ntp.conf | ||
| - | ;; | ||
| - | esac | ||
| - | |||
| - | # Changement du port ssh | ||
| - | sed -i 's/Port 22/Port 1234/g' /target/etc/ssh/sshd_config | ||
| - | |||
| - | # Mise en place de l'auto-login | ||
| - | if [ "$distrib" == "xubuntu" ]; then | ||
| - | cat > /target/etc/gdm/custom.conf << eof | ||
| - | [daemon] | ||
| - | TimedLoginEnable=false | ||
| - | AutomaticLoginEnable=true | ||
| - | TimedLogin=$login | ||
| - | AutomaticLogin=$login | ||
| - | TimedLoginDelay=30 | ||
| - | DefaultSession=xubuntu | ||
| - | eof | ||
| - | else | ||
| - | cat > /target/etc/gdm/custom.conf << eof | ||
| - | TimedLoginEnable=false | ||
| - | AutomaticLoginEnable=true | ||
| - | TimedLogin=$login | ||
| - | AutomaticLogin=$login | ||
| - | TimedLoginDelay=30 | ||
| - | DefaultSession=gnome | ||
| - | eof | ||
| - | |||
| - | fi | ||
| - | |||
| - | # Configuration de ssmtp | ||
| - | cat > /target/etc/ssmtp/ssmtp.conf << eof | ||
| - | root=admin@mon_domaine.com | ||
| - | mailhub=mon_serveur_de_mail | ||
| - | rewriteDomain=mon_domaine.com | ||
| - | hostname=$machine | ||
| - | FromLineOverride=YES | ||
| - | eof | ||
| - | cat > /target/etc/ssmtp/revalias << eof | ||
| - | root:$machine@mon_domaine.com:mon_serveur_de_mail | ||
| - | admin:$machine@mon_domaine.com:mon_serveur_de_mail | ||
| - | $machine:$machine@mon_domaine.com:mon_serveur_de_mail | ||
| - | eof | ||
| - | |||
| - | # Suppression des paquets non souhaités | ||
| - | if [ "$distrib" == "xubuntu" ]; then | ||
| - | chroot /target apt-get -y remove abiword-common | ||
| - | chroot /target apt-get -y remove gnome-games-common | ||
| - | chroot /target apt-get -y remove gnumeric-common | ||
| - | chroot /target apt-get -y remove pidgin-data | ||
| - | chroot /target apt-get -y remove transmission-common | ||
| - | chroot /target apt-get -y remove xchat-common | ||
| - | else | ||
| - | chroot /target apt-get -y remove empathy-common | ||
| - | chroot /target apt-get -y remove gbrainy | ||
| - | chroot /target apt-get -y remove gnome-games-common | ||
| - | chroot /target apt-get -y remove gwibber-service | ||
| - | chroot /target apt-get -y remove pidgin | ||
| - | chroot /target apt-get -y remove pitivi | ||
| - | chroot /target apt-get -y remove transmission-common | ||
| - | fi | ||
| - | |||
| - | # Modification des dépots | ||
| - | # suppression des dépots de sources | ||
| - | sed -i 's/deb-src/#deb-src/g' /target/etc/apt/sources.list | ||
| - | case "$machine" in | ||
| - | t1* | t2*) | ||
| - | # passage des dépots sécurité sur mon_serveur_local | ||
| - | sed -i 's/security.ubuntu.com/mon_serveur_local/g' /target/etc/apt/sources.list | ||
| - | ;; | ||
| - | *) | ||
| - | # passage des dépots sur ubuntu | ||
| - | sed -i 's/mon_serveur_local/fr.archive.ubuntu.com/g' /target/etc/apt/sources.list | ||
| - | ;; | ||
| - | esac | ||
| - | # ajout d'un dépot supplémentaire | ||
| - | case "$machine" in | ||
| - | t1* | t2* | t3*) | ||
| - | echo 'deb http://mon_serveur_local/mon_programme/ ./' >> /target/etc/apt/sources.list | ||
| - | esac | ||
| - | |||
| - | #---------------------------------------------- | ||
| - | # Préparation des scripts de fin d'installation | ||
| - | # Ces scripts seront exécutés au premier | ||
| - | # redémarrage de la machine | ||
| - | # fin_install_root appelle fin_install_user | ||
| - | #---------------------------------------------- | ||
| - | # Création du fichier 'user' | ||
| - | if [ "$distrib" == "xubuntu" ]; then | ||
| - | cat > /target/usr/bin/fin_install_user << eof | ||
| - | #!/bin/bash | ||
| - | # Configuration de Vino | ||
| - | # La définition du mot de passe doit s'effectuer | ||
| - | # avant l'autorisation de prise de controle | ||
| - | gconftool-2 -s -t string /desktop/gnome/remote_access/vnc_password $(echo -n $mdp_vino | base64) | ||
| - | gconftool-2 -s -t list --list-type string /desktop/gnome/remote_access/authentication_methods '[vnc]' | ||
| - | gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false | ||
| - | gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true | ||
| - | # | ||
| - | # Création du fichier de lancement de Vino | ||
| - | mkdir /home/$login/.config | ||
| - | mkdir /home/$login/.config/autostart | ||
| - | cat > /home/$login/.config/autostart/Vino.desktop << eof | ||
| - | [Desktop Entry] | ||
| - | Encoding=UTF-8 | ||
| - | Version=0.9.4 | ||
| - | Type=Application | ||
| - | Name=Vino | ||
| - | Comment=Vnc Server | ||
| - | Exec=/usr/lib/vino/vino-server | ||
| - | StartupNotify=false | ||
| - | Terminal=false | ||
| - | Hidden=false | ||
| - | eof | ||
| - | |||
| - | echo "eof" >> /target/usr/bin/fin_install_user | ||
| - | | ||
| - | cat >> /target/usr/bin/fin_install_user << eof | ||
| - | |||
| - | # Création du fichier pour supprimer la notification de mise à jour système | ||
| - | cat > /home/$login/.config/autostart/update-notifier.desktop << eof | ||
| - | [Desktop Entry] | ||
| - | Hidden=true | ||
| - | eof | ||
| - | |||
| - | echo "eof" >> /target/usr/bin/fin_install_user | ||
| - | else | ||
| - | cat > /target/usr/bin/fin_install_user << eof | ||
| - | #!/bin/bash | ||
| - | # Configuration de l'interface | ||
| - | # Désactivation des effets visuels | ||
| - | gconftool-2 -s -t string /desktop/gnome/session/required_components/windowmanager 'metacity' | ||
| - | # Modification des polices d'affichage | ||
| - | gconftool-2 -s -t string /desktop/gnome/interface/font_name 'Sans 8' | ||
| - | gconftool-2 -s -t string /desktop/gnome/interface/document_font_name 'Sans 8' | ||
| - | gconftool-2 -s -t string /desktop/gnome/interface/monospace_font_name 'Monospace 8' | ||
| - | gconftool-2 -s -t string /apps/nautilus/preferences/desktop_font 'Sans 8' | ||
| - | gconftool-2 -s -t string /apps/metacity/general/titlebar_font 'Sans Bold 8' | ||
| - | # Modification du thème | ||
| - | gconftool-2 -s -t string /apps/metacity/general/theme 'Radiance' | ||
| - | gconftool-2 -s -t string /desktop/gnome/interface/gtk_theme 'Radiance' | ||
| - | gconftool-2 -s -t string /desktop/gnome/interface/icon_theme 'ubuntu-mono-light' | ||
| - | gconftool-2 -s -t string /apps/metacity/general/button_layout 'menu:minimize,maximize,close' | ||
| - | # Configuration de la mise en veille | ||
| - | #gconftool-2 -s -t int /apps/gnome-screensaver/idle_delay 5 | ||
| - | gconftool-2 -s -t bool /apps/gnome-screensaver/lock_enabled false | ||
| - | # Configuration du nombre d'espaces de travail | ||
| - | gconftool-2 -s -t int /apps/metacity/general/num_workspaces 1 | ||
| - | # Configuration de Vino | ||
| - | # La définition du mot de passe doit s'effectuer | ||
| - | # avant l'autorisation de prise de controle | ||
| - | gconftool-2 -s -t string /desktop/gnome/remote_access/vnc_password $(echo -n $mdp_vino | base64) | ||
| - | gconftool-2 -s -t list --list-type string /desktop/gnome/remote_access/authentication_methods '[vnc]' | ||
| - | gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false | ||
| - | gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true | ||
| - | eof | ||
| - | fi | ||
| - | |||
| - | # Création du fichier 'root' | ||
| - | cat > /target/usr/bin/fin_install_root << eof | ||
| - | #!/bin/bash | ||
| - | # Appel du script 'user' | ||
| - | su - $login -c /usr/bin/fin_install_user | ||
| - | # Effacement du script 'user' | ||
| - | rm /usr/bin/fin_install_user | ||
| - | # Effacement du script de fin d'installation dans cron | ||
| - | crontab -l > /usr/bin/tempcron | ||
| - | sed -i '/^@reboot /d' /usr/bin/tempcron | ||
| - | # ajout de la sauvegarde | ||
| - | case "$machine" in | ||
| - | t1* | t2*) | ||
| - | # Génération d'une heure aléatoire entre (environ) 9h et 15h59 | ||
| - | heure=\\\\$(echo "scale=0;(\\\\$RANDOM/4700)+9" | bc) | ||
| - | minute=\\\\$(echo "scale=0;(\\\\$RANDOM/550)" | bc) | ||
| - | echo "\\\\$minute \\\\$heure * * * /usr/bin/mon_script_sauvegarde start" >> /usr/bin/tempcron | ||
| - | esac | ||
| - | crontab /usr/bin/tempcron | ||
| - | # Effacement du script de modification de cron | ||
| - | rm /usr/bin/tempcron | ||
| - | /sbin/reboot | ||
| - | eof | ||
| - | #-------------------------------------- | ||
| - | # Fin des scripts de fin d'installation | ||
| - | #-------------------------------------- | ||
| - | |||
| - | # Insertion des points de montage des partages | ||
| - | case "$machine" in | ||
| - | t1*) | ||
| - | serveur="mon_serveur_1" | ||
| - | ;; | ||
| - | t2*) | ||
| - | serveur="mon_serveur_2" | ||
| - | ;; | ||
| - | esac | ||
| - | |||
| - | case "$machine" in | ||
| - | t1* | t2*) | ||
| - | mkdir /target/mnt/$serveur | ||
| - | mkdir /target/mnt/$serveur/divers | ||
| - | mkdir /target/mnt/$serveur/sauvegarde | ||
| - | echo "//$serveur/divers /mnt/$serveur/divers cifs auto,ro,password=,iocharset=utf8,codepage=cp850 0 0" >> /target/etc/fstab | ||
| - | echo "//$serveur/sauvegarde /mnt/$serveur/sauvegarde cifs noauto,rw,credentials=/etc/smb_sauvegarde,iocharset=utf8,codepage=cp850 0 0" >> /target/etc/fstab | ||
| - | |||
| - | # Création du fichier de login pour sauvegarde | ||
| - | cat > /target/etc/smb_sauvegarde << eof | ||
| - | username=user_pour_sauvegarde | ||
| - | password=mot_de_passe | ||
| - | eof | ||
| - | # Changement des droits du fichier | ||
| - | chmod 600 /target/etc/smb_sauvegarde | ||
| - | chown root:root /target/etc/smb_sauvegarde | ||
| - | |||
| - | # Ajout du script de sauvegarde | ||
| - | cat > /target/usr/bin/mon_script_sauvegarde << eof | ||
| - | #!/bin/bash | ||
| - | # ***** script de sauvegarde non détaillé ici ***** | ||
| - | eof | ||
| - | |||
| - | # Ajout du fichier des exclusions (sauvegarde) | ||
| - | cat > /target/etc/mon_script_sauve_excl << eof | ||
| - | - cache*/ | ||
| - | - Cache*/ | ||
| - | - .cache*/ | ||
| - | - .Cache*/ | ||
| - | - /Examples | ||
| - | - /.gvfs | ||
| - | - lock | ||
| - | - /.thumbnails/ | ||
| - | - trash/ | ||
| - | - Trash/ | ||
| - | - /.kde/ | ||
| - | - *.msf | ||
| - | - *.*~ | ||
| - | eof | ||
| - | |||
| - | # changement des droits du script de sauvegarde | ||
| - | chmod 700 /target/usr/bin/mon_script_sauvegarde | ||
| - | chown root:root /target/usr/bin/mon_script_sauvegarde | ||
| - | esac | ||
| - | |||
| - | # Changement des droits des scripts finaux | ||
| - | chmod 777 /target/usr/bin/fin_install_* | ||
| - | |||
| - | # Insertion du script final 'root' dans cron | ||
| - | chroot /target crontab -l > /target/usr/bin/tempcron | ||
| - | chroot /target echo "@reboot /usr/bin/fin_install_root" >> /target/usr/bin/tempcron | ||
| - | chroot /target crontab /usr/bin/tempcron | ||
| - | |||
| - | # Renommage de la machine | ||
| - | sed -i "s/kickseed/$machine/g" /target/etc/hostname | ||
| - | sed -i "s/kickseed/$machine/g" /target/etc/hosts | ||
| - | |||
| - | # Configuration de Ocsinventory | ||
| - | echo 'server=mon_serveur_local' > /target/etc/ocsinventory/ocsinventory-agent.cfg | ||
| - | |||
| - | # Envoi d'un mail de fin d'installation | ||
| - | chroot /target echo "Fin d'installation de la machine $machine de $utilisateur ($login)" | chroot /target mail -s "Fin d'installation de $machine" admin@mon_domaine.com | ||
| - | </code> | ||
| - | |||
| - | ===== Sources ===== | ||
| - | [[http://www.ubuntu.com/system/files/u1/AutomatedDeploymentsWP-20090126.pdf|Documentation pdf de Kickstart pour Ubuntu (en) - Canonical]] | ||
| - | |||
| - | ---- | ||
| - | |||
| - | //Contributeurs : [[utilisateurs:m2nis]] | ||