]> saetta.ns0.it Git - msys2/commitdiff
autobuilder: parametrizzati l'origine e la destinazione dei pacchetti creati.
authorAndrea Zagli <azagli@libero.it>
Tue, 23 Aug 2016 09:24:17 +0000 (11:24 +0200)
committerAndrea Zagli <azagli@libero.it>
Tue, 23 Aug 2016 09:24:17 +0000 (11:24 +0200)
tools/autobuilder/copy_to_repo.sh

index 9b5fa9ab169b6c0bf8fcf92fc3e8e9b02d8760f6..c9b7aa95908ddd8cfaa3ee2f680fbfec36abc517 100644 (file)
@@ -1,8 +1,36 @@
 #!/bin/bash
 
+CUR=$PWD
+FROM=.
 REPO=/opt/msys2/repositories/saetta/
 
-if [ ! -e PKGBUILD ]; then exit 0; fi
+while getopts ":f:t:" opt; do
+       case $opt in
+               f)
+                   FROM=$OPTARG
+                       ;;
+               t)
+                   REPO=$OPTARG
+                       ;;
+               \?)
+                       echo "Invalid option: -$OPTARG" >&2
+                       exit 1
+                       ;;
+               :)
+                       echo "Option -$OPTARG requires an argument." >&2
+                       exit 1
+                       ;;
+       esac
+done
+
+echo "From: "$FROM
+echo "Repo: "$REPO
+
+if [ ! -d $FROM ]; then echo $FROM" isn't a directory" && exit 0; fi
+if [ ! -d $REPO ]; then echo $REPO" isn't a directory" && exit 0; fi
+
+cd $FROM
+if [ ! -e PKGBUILD ]; then "No PKGBUILD file found in "$FROM && exit 0; fi
 
 _realname=`cat PKGBUILD | grep _realname=`
 _pkgver=`cat PKGBUILD | grep pkgver=`
@@ -12,9 +40,9 @@ realname=${_realname:10}
 pkgver=${_pkgver:7}
 pkgrel=${_pkgrel:7}
 
-echo $realname
-echo $pkgver
-echo $pkgrel
+echo "realname: "$realname
+echo "pkgver: "$pkgver
+echo "pkgrel: "$pkgrel
 
 pkgfilename32="mingw-w64-i686-"$realname"-"$pkgver"-"$pkgrel"-any.pkg.tar.xz"
 pkgfilename64="mingw-w64-x86_64-"$realname"-"$pkgver"-"$pkgrel"-any.pkg.tar.xz"
@@ -24,3 +52,5 @@ cp -f $pkgfilename64 $REPO
 
 cd $REPO
 ./repo-add saetta.db.tar.gz $pkgfilename32 $pkgfilename64
+
+cd $CUR