diff --git a/cp2mirror b/cp2mirror new file mode 100755 index 0000000..7331656 --- /dev/null +++ b/cp2mirror @@ -0,0 +1,41 @@ +#!/usr/bin/bash + +VERSION=$3 +APP_PATH=$1 +MIRRORPATH=$2 +ARCH="x86_64 i586 armv7hl aarch64" + +if [ -e "/usr/local/etc/cp2mirror.conf" ]; then + echo "utilisation de /usr/local/etc/cp2mirror.conf" + . /usr/local/etc/cp2mirror.conf +fi + +if [ -z $VERSION ] || [ -z $APP_PATH ] || [ -z $MIRRORPATH ]; then + echo "arguments invalides" + exit 1 +fi + +rsync -aP $APP_PATH/SRPMS/*.mga"$VERSION".* $MIRRORPATH/lalis/$VERSION/SRPMS/core/updates/ + +if [ -e "$APP_PATH/RPMS/noarch" ]; then + NOARCH=1 +fi + +for i in $ARCH; do + if [ $NOARCH ]; then + echo "noarch" + ARCH_O="noarch" + else + echo "arch" + ARCH_O=$i + fi + if [ -e "$APP_PATH/RPMS/$ARCH_O/" ]; then + if ! [ -e "$MIRRORPATH/lalis/$VERSION/$i/media/core/updates/" ]; then + /usr/bin/mkdir -p "$MIRRORPATH/lalis/$VERSION/$i/media/core/updates/" + fi + echo "rsync -aP $APP_PATH/RPMS/$ARCH_O/*.mga"$VERSION".* $MIRRORPATH/lalis/$VERSION/$i/media/core/updates/" + rsync -aP $APP_PATH/RPMS/$ARCH_O/*.mga"$VERSION".* $MIRRORPATH/lalis/$VERSION/$i/media/core/updates/ + gendistrib --nobadrpm --blind --skipmissingdir $MIRRORPATH/lalis/$VERSION/$i + fi +done + diff --git a/mkmirrortree b/mkmirrortree old mode 100644 new mode 100755 index 3fb16d8..ea877fb --- a/mkmirrortree +++ b/mkmirrortree @@ -1,26 +1,30 @@ #!/bin/bash -ARCH="SRPMS x86_64 i586 armv7hl aarch64" -DEPOT="release update" -echo "Créer une arborescence de miroir MAgeia dans le dossier `pwd`?" -read YN -if [ "$YN" = "y" ] || [ "$YN" = "Y" ] ;then - for i in $*; do - for j in $ARCH;do - if [ "$j" = "SRPMS" ]; then - MEDIA=""; - else - MEDIA="/media" - fi - for k in $DEPOT;do - echo "./mageia/distrib/$i/$j$MEDIA/core/$k" - mkdir -p "./mageia/distrib/$i/$j$MEDIA/core/$k" - if ! [ -z $MEDIA ]; then - mkdir -p "./mageia/distrib/$i/$j$MEDIA/media_info" - printf "[media_info] -version=$i +MIRROR="/mnt/lalis/mirror" +ARCHLIST="SRPMS x86_64 i586 armv7hl aarch64" +DEPOT="release updates" + +cd "$MIRROR" +echo `pwd` + +for DIR in `ls -A $MIRROR/mageia/distrib` +do + for ARCH in $ARCHLIST;do + if [ "$ARCH" = "SRPMS" ]; then + MEDIA=""; + else + MEDIA="/media" + fi + for k in $DEPOT; do + echo "./mageia/lalis/$DIR/$ARCH$MEDIA/core/$k" + mkdir -p "./mageia/lalis/$DIR/$ARCH$MEDIA/core/$k" + if ! [ -z "$MEDIA" ]; then + echo "generation des medias" + mkdir -p "./mageia/lalis/$DIR/$ARCH$MEDIA/media_info" + printf "[media_info] +version=$DIR mediacfg_version=2 branch=Official -arch=$j +arch=$ARCH xml-info=1 [core/release] @@ -69,9 +73,9 @@ media_types=official:free:updates:source name=Core Updates Sources noauto=1 rpms=core/updates -">"./mageia/distrib/$i/$j$MEDIA/media_info/media.cfg" - fi - done +">"./mageia/lalis/$DIR/$ARCH$MEDIA/media_info/media.cfg" + fi + gendistrib --nobadrpm --blind --skipmissingdir "./mageia/lalis/$DIR/$ARCH$MEDIA/core/$k" done done -fi +done