2019-01-16 20:41:33 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#mirror_mageia_hd
|
2022-11-04 15:24:36 +01:00
|
|
|
|
|
|
|
version_list="8" # liste les versions de Mageia à synchroniser.
|
2019-01-16 20:41:33 +01:00
|
|
|
dossier=""
|
|
|
|
boot=""
|
2022-11-04 15:24:36 +01:00
|
|
|
param="--ignore-existing --exclude SRPMS/ --exclude armv5tl/ --exclude armv7hl/ --exclude aarch64/ --exclude *_testing/ --exclude */debug/"
|
2019-01-16 20:41:33 +01:00
|
|
|
|
|
|
|
for DIRECTORY in /run/media/$USER/*
|
|
|
|
do
|
|
|
|
if [ -d "$DIRECTORY" ]; then
|
|
|
|
if [ -e "$DIRECTORY/mageia/distrib" ]; then
|
|
|
|
echo "$DIRECTORY/mageia/distrib trouvé"
|
2022-11-04 15:24:36 +01:00
|
|
|
dossier="$DIRECTORY/mageia/distrib"
|
|
|
|
elif [ -e "$DIRECTORY/extlinux/extlinux.conf" ]; then
|
|
|
|
echo "$DIRECTORY/extlinux/extlinux.conf trouvé"
|
|
|
|
boot="$DIRECTORY/"
|
2019-01-16 20:41:33 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2022-11-04 15:24:36 +01:00
|
|
|
if [ -z "$dossier" ] || [ -z "$boot" ]; then
|
|
|
|
for DIRECTORY in /mnt/*
|
2019-01-16 20:41:33 +01:00
|
|
|
do
|
|
|
|
if [ -d "$DIRECTORY" ]; then
|
|
|
|
if [ -e "$DIRECTORY/mageia/distrib" ]; then
|
|
|
|
echo "$DIRECTORY/mageia/distrib trouvé"
|
|
|
|
dossier=$DIRECTORY/mageia/distrib
|
2022-11-04 15:24:36 +01:00
|
|
|
elif [ -e "$DIRECTORY/extlinux/extlinux.conf" ]; then
|
|
|
|
echo "$DIRECTORY/extlinux/extlinux.conf trouvé"
|
|
|
|
boot="$DIRECTORY/"
|
2019-01-16 20:41:33 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2022-11-04 15:24:36 +01:00
|
|
|
echo "dossier => $dossier"
|
|
|
|
echo "boot => $boot"
|
2019-01-16 20:41:33 +01:00
|
|
|
|
|
|
|
if [ -d "/mirror/mageia/distrib/$version" ];then
|
|
|
|
serveur='/mirror'
|
|
|
|
else
|
2022-11-04 15:24:36 +01:00
|
|
|
serveur="rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia"
|
2019-01-16 20:41:33 +01:00
|
|
|
fi
|
|
|
|
|
2022-11-04 15:24:36 +01:00
|
|
|
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/"
|
2019-01-16 20:41:33 +01:00
|
|
|
|
2022-11-04 15:24:36 +01:00
|
|
|
# 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"
|
2019-01-16 20:41:33 +01:00
|
|
|
fi
|