1
0
This commit is contained in:
Daniel Tartavel 2023-09-07 13:10:31 +02:00
parent a43203edf9
commit 03bba0c256

43
mirror_mageia_hd Executable file → Normal file
View File

@ -1,17 +1,17 @@
#!/bin/sh #!/bin/sh
#mirror_mageia_hd #mirror_mageia_hd
version_list="8" # liste les versions de Mageia à synchroniser. version_list="8 9" # liste les versions de Mageia à synchroniser.
dossier="" dossier=""
boot="" boot=""
param="--ignore-existing --exclude SRPMS/ --exclude armv5tl/ --exclude armv7hl/ --exclude aarch64/ --exclude *_testing/ --exclude */debug/" param=" --exclude SRPMS/ --exclude i586/ --exclude armv5tl/ --exclude armv7hl/ --exclude aarch64/ --exclude *_testing/ --exclude */debug/"
for DIRECTORY in /run/media/$USER/* for DIRECTORY in /run/media/$USER/*
do do
if [ -d "$DIRECTORY" ]; then if [ -d "$DIRECTORY" ]; then
if [ -e "$DIRECTORY/mageia/distrib" ]; then if [ -e "$DIRECTORY/mageia" ]; then
echo "$DIRECTORY/mageia/distrib trouvé" echo "$DIRECTORY/mageia trouvé"
dossier="$DIRECTORY/mageia/distrib" dossier="$DIRECTORY/mageia"
elif [ -e "$DIRECTORY/extlinux/extlinux.conf" ]; then elif [ -e "$DIRECTORY/extlinux/extlinux.conf" ]; then
echo "$DIRECTORY/extlinux/extlinux.conf trouvé" echo "$DIRECTORY/extlinux/extlinux.conf trouvé"
boot="$DIRECTORY/" boot="$DIRECTORY/"
@ -22,9 +22,9 @@ if [ -z "$dossier" ] || [ -z "$boot" ]; then
for DIRECTORY in /mnt/* for DIRECTORY in /mnt/*
do do
if [ -d "$DIRECTORY" ]; then if [ -d "$DIRECTORY" ]; then
if [ -e "$DIRECTORY/mageia/distrib" ]; then if [ -e "$DIRECTORY/mageia" ]; then
echo "$DIRECTORY/mageia/distrib trouvé" echo "$DIRECTORY/mageia trouvé"
dossier=$DIRECTORY/mageia/distrib dossier="$DIRECTORY/mageia"
elif [ -e "$DIRECTORY/extlinux/extlinux.conf" ]; then elif [ -e "$DIRECTORY/extlinux/extlinux.conf" ]; then
echo "$DIRECTORY/extlinux/extlinux.conf trouvé" echo "$DIRECTORY/extlinux/extlinux.conf trouvé"
boot="$DIRECTORY/" boot="$DIRECTORY/"
@ -38,30 +38,35 @@ echo "boot => $boot"
if [ -d "/mirror/mageia/distrib/$version" ];then if [ -d "/mirror/mageia/distrib/$version" ];then
serveur='/mirror' serveur='/mirror'
else else
# serveur="rsync://fr2.rpmfind.net/linux/mageia"
serveur="rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia" serveur="rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia"
fi fi
if [ -n "$dossier" ] && [ -n "$boot" ];then if [ -n "$dossier" ] && [ -n "$boot" ];then
for version in $version_list; do for version in $version_list; do
echo "rsync -avP $param $serveur/distrib/$version/ $dossier/$version/" echo "rsync -P -aHS --delete-after --delay-updates $param $serveur/distrib/$version/ $dossier/distrib/$version/"
rsync -P -aHS --delete-after --delay-updates $param "$serveur/distrib/$version/" "$dossier/$version/" rsync -P -aHS --delete-after --delay-updates $param "$serveur/distrib/$version/" "$dossier/distrib/$version/"
# copie des images isos
echo "rsync -P -aHS --delete-after --delay-updates $serveur/iso/$version $dossier/iso/"
rsync -P -aHS --delete-after --delay-updates "$serveur/iso/$version" "$dossier/iso/"
# Copie des fichiers de boot CSM # Copie des fichiers de boot CSM
cd "$dossier/$version" cd "$dossier/distrib/$version"
rsync -aP i586/isolinux/i386/vmlinuz "$boot"/isolinux/i386/vmlinuz_$version #rsync -aP i586/isolinux/i386/vmlinuz "$boot"/isolinux/i386/vmlinuz_$version
rsync -aP x86_64/isolinux/x86_64/vmlinuz "$boot/isolinux/x86_64/vmlinuz_$version" rsync -aP x86_64/isolinux/x86_64/vmlinuz "$boot/isolinux/x86_64/vmlinuz_$version"
rsync -aP i586/isolinux/i386/all.rdz "$boot"/isolinux/i386/all_$version".rdz" #rsync -aP i586/isolinux/i386/all.rdz "$boot"/isolinux/i386/all_$version".rdz"
rsync -aP x86_64/isolinux/x86_64/all.rdz "$boot/isolinux/x86_64/all_"$version".rdz" rsync -aP x86_64/isolinux/x86_64/all.rdz "$boot/isolinux/x86_64/all_"$version".rdz"
# Copie des fichers de boot EFI # Copie des fichers de boot EFI
tmp_dir=$(mktemp -d -t mirror_mageia_hd-XXXXXXXXXX) tmp_dir=$(mktemp -d -t mirror_mageia_hd-XXXXXXXXXX)
pushd $tmp_dir pushd $tmp_dir
rpm2cpio "$dossier/$version"/x86_64/media/core/release/drakiso-bootloader-files-1.17-1.mga8.x86_64.rpm | cpio --extract --make-directories rpm2cpio "$dossier/distrib/$version"/x86_64/media/core/release/drakiso-bootloader-files-*.rpm | cpio --extract --make-directories
rsync -aP ./usr/share/drakiso/bootloader/images/bootx64.efi "$boot"/EFI/BOOT/ rsync -aP ./usr/share/drakiso/bootloader/images/bootx64.efi "$boot"/EFI/BOOT/
rm -Rf $tmp_dir/*
rpm2cpio "$dossier/$version"/i586/media/core/release/drakiso-bootloader-files-1.17-1.mga8.i586.rpm | cpio --extract --make-directories #rpm2cpio "$dossier/distrib/$version"/i586/media/core/release/drakiso-bootloader-files-1.17-1.mga8.i586.rpm | cpio --extract --make-directories
rsync -aP ./usr/share/drakiso/bootloader/images/bootia32.efi "$boot"/EFI/BOOT/ #rsync -aP ./usr/share/drakiso/bootloader/images/bootia32.efi "$boot"/EFI/BOOT/
popd popd
rm -Rf $tmp_dir rm -Rf $tmp_dir/*
rmdir $tmp_dir
done done
else else
echo "il manque un dossier (boot ou miroir) voir plus haut" echo "il manque un dossier (boot ou miroir) voir plus haut"