CUR=$PWD
FROM=.
-REPO=/opt/msys2/repositories/saetta/
+CMD_COPY_TO_REPO="cp -f <pkgsfilename> /opt/msys2/repositories/saetta"
+CMD_ADD_TO_REPO="cd /opt/msys2/repositories/saetta && ./repo-add saetta.db.tar.gz <pkgsfilename>"
-while getopts ":f:t:" opt; do
+while getopts ":f:c:a:" opt; do
case $opt in
f)
FROM=$OPTARG
;;
- t)
- REPO=$OPTARG
+ c)
+ CMD_COPY_TO_REPO=$OPTARG
+ ;;
+ a)
+ CMD_ADD_TO_REPO=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
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
pkgfilename32="mingw-w64-i686-"$realname"-"$pkgver"-"$pkgrel"-any.pkg.tar.xz"
pkgfilename64="mingw-w64-x86_64-"$realname"-"$pkgver"-"$pkgrel"-any.pkg.tar.xz"
-cp -f $pkgfilename32 $REPO
-cp -f $pkgfilename64 $REPO
+if [ -e ~/.zak_msys2_copy_to_repo ]; then . ~/.zak_msys2_copy_to_repo; fi
+
+CMD_COPY_TO_REPO=${CMD_COPY_TO_REPO/"<pkgsfilename>"/"$pkgfilename32 $pkgfilename64"}
+CMD_ADD_TO_REPO=${CMD_ADD_TO_REPO/"<pkgsfilename>"/"$pkgfilename32 $pkgfilename64"}
+
+echo "Command copy to report: "$CMD_COPY_TO_REPO
+echo "Command add to report: "$CMD_ADD_TO_REPO
-cd $REPO
-./repo-add saetta.db.tar.gz $pkgfilename32 $pkgfilename64
+$CMD_COPY_TO_REPO
-cd $CUR
+$CMD_ADD_TO_REPO