#!/usr/bin/perl # Synchronisation du repertoire images en fonction du fichier ether # Par Cyril LAMY open FICHIER,"< /tftpboot/revoboot/etc/ether" or die "E/S : $!\n"; while ($ligne = ){ @valeur = split(' ', $ligne); $adressemac=uc $valeur[0]; $adressemac=~ s/\://g; $nommachine=$valeur[$#tableau]; chomp($nommachine); if (length($adressemac)==12) { if (!(-d "/tftpboot/revoboot/images/$adressemac")) { print "Réparation du répertoire $adressemac\n"; mkdir ("/tftpboot/revoboot/images/$adressemac",0755) or die "Impossible de créer le repertoire /tftpboot/revoboot/images/$adressemac.\n"; $commande="/usr/bin/rsync -ar /tftpboot/revoboot/imgskel/ /tftpboot/revoboot/images/$adressemac/"; system ($commande); } if (!(-f "/tftpboot/revoboot/images/$adressemac/hostname")) { print "Réparation du fichier $adressemac/hostname\n"; open(SORTIE, "> /tftpboot/revoboot/images/$adressemac/hostname") || die "Impossible de créer le fichier /tftpboot/revoboot/images/$adressemac/hostname\n"; print SORTIE $nommachine; close SORTIE; system "/usr/bin/touch /tftpboot/revoboot/images/$adressemac/log.restore"; system "/usr/bin/touch /tftpboot/revoboot/images/$adressemac/postinst.log"; system "/usr/bin/touch /tftpboot/revoboot/images/$adressemac/progress.txt"; system "/bin/chown nobody:root /tftpboot/revoboot/images/$adressemac/log.restore"; system "/bin/chown nobody:root /tftpboot/revoboot/images/$adressemac/postinst.log"; system "/bin/chown nobody:root /tftpboot/revoboot/images/$adressemac/progress.txt"; } } } close FICHIER;