From dfaa6e940a377a06cb91309ccb7b51432a5cd55d Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Sun, 30 Jun 2019 17:06:08 +0200 Subject: [PATCH] grosse modifs --- cp2mirror | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/cp2mirror b/cp2mirror index 7331656..062b397 100755 --- a/cp2mirror +++ b/cp2mirror @@ -1,8 +1,7 @@ #!/usr/bin/bash -VERSION=$3 APP_PATH=$1 -MIRRORPATH=$2 +MIRRORPATH="/mnt/lalis/mirror" ARCH="x86_64 i586 armv7hl aarch64" if [ -e "/usr/local/etc/cp2mirror.conf" ]; then @@ -10,32 +9,37 @@ if [ -e "/usr/local/etc/cp2mirror.conf" ]; then . /usr/local/etc/cp2mirror.conf fi -if [ -z $VERSION ] || [ -z $APP_PATH ] || [ -z $MIRRORPATH ]; then - echo "arguments invalides" +if [ -z $APP_PATH ] || ! [ -d $APP_PATH ]; then + echo "argument invalide" exit 1 fi -rsync -aP $APP_PATH/SRPMS/*.mga"$VERSION".* $MIRRORPATH/lalis/$VERSION/SRPMS/core/updates/ +for VERSION in `ls -A $MIRRORPATH/mageia/distrib` +do + echo "$MIRRORPATH/mageia/distrib/$VERSION" -if [ -e "$APP_PATH/RPMS/noarch" ]; then - NOARCH=1 -fi + rsync -aP $APP_PATH/SRPMS/*.mga"$VERSION".* $MIRRORPATH/lalis/$VERSION/SRPMS/core/updates/ -for i in $ARCH; do - if [ $NOARCH ]; then - echo "noarch" - ARCH_O="noarch" - else - echo "arch" - ARCH_O=$i + if [ -e "$APP_PATH/RPMS/noarch" ]; then + NOARCH=1 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/" + + for i in $ARCH; do + if [ $NOARCH ]; then + echo "noarch" + ARCH_O="noarch" + else + echo "arch" + ARCH_O=$i 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 + 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 done