summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeppia <seppia@seppia.net>2018-06-03 23:56:28 +0200
committerSeppia <seppia@seppia.net>2018-06-03 23:56:28 +0200
commit785295bfa38f83a1329f91390d7395c729143982 (patch)
tree6117b4cc7d72587e250dd6e174fa7575bcd2015b
parent3e15e085e13d1b942ca52af8a82f2be804d7c904 (diff)
downloadrepofish-785295bfa38f83a1329f91390d7395c729143982.tar.gz
repofish-785295bfa38f83a1329f91390d7395c729143982.tar.bz2
repofish-785295bfa38f83a1329f91390d7395c729143982.zip
Architecture variable
Used variable for cpu architecture of local repo packages instead of hardcoded value.
-rwxr-xr-xrepofish17
1 files changed, 11 insertions, 6 deletions
diff --git a/repofish b/repofish
index 5a6da3c..a1f40bc 100755
--- a/repofish
+++ b/repofish
@@ -2,6 +2,7 @@
## You can set these variables here or in your enviroment
+#ARCH='your_CPU_architecture'
#SRC_PATH='/path/to/packages/sources'
#REPO_PATH='/path/to/archlinux/repo'
#REPO_NAME='repo_name'
@@ -154,13 +155,13 @@ update_repo() {
declare -a pkg=("${!1}")
echo -e '\033[1;34m:: \033[1;37mUpdating following packages in local repository: '"${pkg[@]}"'\033[m'
for i in "${pkg[@]}"; do
- find ${SRC_PATH} -type f -iname "*$i*pkg.tar.xz" -exec cp {} ${REPO_PATH}/x86_64/ \;
- repo-add ${REPO_PATH}/x86_64/${REPO_NAME}.db.tar.gz ${REPO_PATH}/x86_64/*$i*.pkg.tar.xz
+ find ${SRC_PATH} -type f -iname "*$i*pkg.tar.xz" -exec cp {} ${REPO_PATH}/${ARCH}/ \;
+ repo-add ${REPO_PATH}/${ARCH}/${REPO_NAME}.db.tar.gz ${REPO_PATH}/${ARCH}/*$i*.pkg.tar.xz
done
else
echo -e '\033[1;34m:: \033[1;37mUpdating all packages in local repository\033[m'
- find ${SRC_PATH} -type f -iname "*pkg.tar.xz" -exec cp {} ${REPO_PATH}/x86_64/ \;
- repo-add ${REPO_PATH}/x86_64/${REPO_NAME}.db.tar.gz ${REPO_PATH}/x86_64/*.pkg.tar.xz
+ find ${SRC_PATH} -type f -iname "*pkg.tar.xz" -exec cp {} ${REPO_PATH}/${ARCH}/ \;
+ repo-add ${REPO_PATH}/${ARCH}/${REPO_NAME}.db.tar.gz ${REPO_PATH}/${ARCH}/*.pkg.tar.xz
fi
}
@@ -169,11 +170,11 @@ archive_repo_packages() {
declare -a pkg=("${!1}")
echo -e '\033[1;34m:: \033[1;37mArchiving following packages in local repository: '"${pkg[@]}"'\033[m'
for i in "${pkg[@]}"; do
- find ${REPO_PATH}/x86_64/ -type f -iname "*$i*pkg.tar.xz" -exec mv {} ${ARCHIVE_PATH}/x86_64/ \;
+ find ${REPO_PATH}/${ARCH}/ -type f -iname "*$i*pkg.tar.xz" -exec mv {} ${ARCHIVE_PATH}/${ARCH}/ \;
done
else
echo -e '\033[1;34m:: \033[1;37mArchiving all packages in local repository\033[m'
- find ${REPO_PATH}/x86_64/ -type f -iname "*pkg.tar.xz" -exec mv {} ${ARCHIVE_PATH}/x86_64/ \;
+ find ${REPO_PATH}/${ARCH}/ -type f -iname "*pkg.tar.xz" -exec mv {} ${ARCHIVE_PATH}/${ARCH}/ \;
fi
}
@@ -292,6 +293,8 @@ elif [ "$1" == 'update-repo' ]; then
echo -e '\033[1;31mERROR:\033[m REPO_PATH variable set to invalid path.'
elif [ "${REPO_NAME}" == '' ];then
echo -e '\033[1;31mERROR:\033[m REPO_NAME variable not set.'
+ elif [ "${ARCH}" == '' ];then
+ echo -e '\033[1;31mERROR:\033[m ARCH variable not set.'
elif [ "$2" != '' ]; then
N=2
while [ "${!N}" != '' ]; do
@@ -309,6 +312,8 @@ elif [ "$1" == 'archive' ]; then
echo -e '\033[1;31mERROR:\033[m REPO_PATH variable set to invalid path.'
elif [ "${REPO_NAME}" == '' ];then
echo -e '\033[1;31mERROR:\033[m REPO_NAME variable not set.'
+ elif [ "${ARCH}" == '' ];then
+ echo -e '\033[1;31mERROR:\033[m ARCH variable not set.'
elif [ "${ARCHIVE_PATH}" == '' ];then
echo -e '\033[1;31mERROR:\033[m ARCHIVE_PATH variable not set.'
elif [ ! -d "${ARCHIVE_PATH}" ]; then