From 36c501b75483e472c8e9e32b95aabdc02f409ccd Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Fri, 4 Nov 2022 15:24:36 +0100 Subject: [PATCH] ajout de la synchronisation des bootloader EFI Signed-off-by: Daniel Tartavel --- mirror_mageia_hd | 91 +++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 56 deletions(-) mode change 100755 => 100644 mirror_mageia_hd diff --git a/mirror_mageia_hd b/mirror_mageia_hd old mode 100755 new mode 100644 index 0d7ea2b..58fa147 --- a/mirror_mageia_hd +++ b/mirror_mageia_hd @@ -1,86 +1,65 @@ #!/bin/sh #mirror_mageia_hd -version="6" + +version_list="8" # liste les versions de Mageia à synchroniser. dossier="" boot="" -param=" --delete-excluded --exclude SRPMS/ --exclude *_testing/ --exclude */debug/ --exclude aarch64/ --exclude armv5tl/ --exclude armv7hl/ " -param_iso="" +param="--ignore-existing --exclude SRPMS/ --exclude armv5tl/ --exclude armv7hl/ --exclude aarch64/ --exclude *_testing/ --exclude */debug/" for DIRECTORY in /run/media/$USER/* do - echo "$DIRECTORY" if [ -d "$DIRECTORY" ]; then if [ -e "$DIRECTORY/mageia/distrib" ]; then echo "$DIRECTORY/mageia/distrib trouvé" - dossier=$DIRECTORY/mageia/distrib - elif [ -e "$DIRECTORY/extlinux" ]; then - echo "$DIRECTORY/extlinux trouvé" - boot="$DIRECTORY" + dossier="$DIRECTORY/mageia/distrib" + elif [ -e "$DIRECTORY/extlinux/extlinux.conf" ]; then + echo "$DIRECTORY/extlinux/extlinux.conf trouvé" + boot="$DIRECTORY/" fi fi done -if [ -z $dossier ] || [ -z $boot ]; then - for DIRECTORY in /mnt/tmp* +if [ -z "$dossier" ] || [ -z "$boot" ]; then + for DIRECTORY in /mnt/* do if [ -d "$DIRECTORY" ]; then if [ -e "$DIRECTORY/mageia/distrib" ]; then echo "$DIRECTORY/mageia/distrib trouvé" dossier=$DIRECTORY/mageia/distrib - elif [ -e "$DIRECTORY/grub/menu.lst" ]; then - echo "$DIRECTORY/grub/menu.lst trouvé" - boot="$DIRECTORY" + elif [ -e "$DIRECTORY/extlinux/extlinux.conf" ]; then + echo "$DIRECTORY/extlinux/extlinux.conf trouvé" + boot="$DIRECTORY/" fi fi done fi - -if [ -z $dossier ] || [ -z $boot ]; then - echo "Erreur dossiers non trouvés" - echo "BOOT=$boot" - echo "Dossier=$dossier" - exit 1 -fi +echo "dossier => $dossier" +echo "boot => $boot" if [ -d "/mirror/mageia/distrib/$version" ];then serveur='/mirror' else - serveur="rsync://fr2.rpmfind.net/linux" + serveur="rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia" fi -if [ -n $dossier ] && [ -n $boot ];then +if [ -n "$dossier" ] && [ -n "$boot" ];then + for version in $version_list; do + echo "rsync -avP $param $serveur/distrib/$version/ $dossier/$version/" + rsync -P -aHS --delete-after --delay-updates $param "$serveur/distrib/$version/" "$dossier/$version/" - # synchronisation du miroir - echo "rsync -avP $param $serveur/mageia/distrib/$version/ $dossier/$version/" - rsync -aP $param $serveur/mageia/distrib/$version $dossier/ - - # synchronisation des iso - rsync -aP --exclude "*GNOME*" --exclude "*rescue*" $serveur/mageia/iso/"$version".1 `dirname $dossier`/iso/ - if [ -d $serveur/mageia.iso/"$vesion".1 ]; then - param_iso=" --delete-excluded --exclude '*Live*' " - fi - rsync -aP $param_iso --exclude "*GNOME*" --exclude "*rescue*" $serveur/mageia/iso/$version `dirname $dossier`/iso/ - - # copie du kernel et de initrd dans partition de boot - cd $dossier/$version - echo "rsync -aP i586/isolinux/i386/vmlinuz $boot/vmlinuz_"$version"_i586" - rsync -aP i586/isolinux/i386/vmlinuz "$boot"/vmlinuz_"$version"_i586 - echo "rsync -aP x86_64/isolinux/x86_64/vmlinuz $boot/vmlinuz_"$version"_x86_64" - rsync -aP x86_64/isolinux/x86_64/vmlinuz "$boot"/vmlinuz_"$version"_x86_64 - rsync -aP i586/isolinux/i386/all.rdz "$boot"/all_"$version"_i586.rdz - rsync -aP x86_64/isolinux/x86_64/all.rdz "$boot"/all_"$version"_x86_64.rdz - - - - if [ -d "/mirror/mageia/distrib/cauldron" ];then - serveur='/mirror' - else - serveur="rsync://fr2.rpmfind.net/linux" - fi - rsync -aP $param $serveur/mageia/distrib/cauldron/i586 $dossier/cauldron/ - - cd $dossier/cauldron - rsync -aP i586/isolinux/i386/vmlinuz $boot/vmlinuz_cauldron_i586 -# rsync -aP x86_64/isolinux/x86_64/vmlinuz $boot/vmlinuz_cauldron_x86_64 - rsync -aP i586/isolinux/i386/all.rdz $boot/all_cauldron_i586.rdz -# rsync -aP x86_64/isolinux/x86_64/all.rdz $boot/all_cauldron_x86_64.rdz +# Copie des fichiers de boot CSM + cd "$dossier/$version" + rsync -aP i586/isolinux/i386/vmlinuz "$boot/vmlinuz_$version_i586" + rsync -aP x86_64/isolinux/x86_64/vmlinuz "$boot/isolinux/x86_64/vmlinuz_$version" + rsync -aP i586/isolinux/i386/all.rdz "$boot/all_$version_i586.rdz" + rsync -aP x86_64/isolinux/x86_64/all.rdz "$boot/isolinux/x86_64/all_$version.rdz" +# Copie des fichers de boot EFI + tmp_dir=$(mktemp -d -t mirror_mageia_hd-XXXXXXXXXX) + pushd $tmp_dir + rpm2cpio x86_64/media/core/release/drakiso-bootloader-files-1.17-1.mga8.x86_64.rpm | cpio --extract --make-directories + rsync -aP $tmpdir/usr/share/drakiso/bootloader/images/bootx64.efi + rpm2cpio i586/media/core/release/drakiso-bootloader-files-1.17-1.mga8.i586.rpm | cpio --extract --make-directories + rsync -aP $tmpdir/usr/share/drakiso/bootloader/images/bootia32.efi + done +else + echo "il manque un dossier (boot ou miroir) voir plus haut" fi