From 785295bfa38f83a1329f91390d7395c729143982 Mon Sep 17 00:00:00 2001 From: Seppia Date: Sun, 3 Jun 2018 23:56:28 +0200 Subject: Architecture variable Used variable for cpu architecture of local repo packages instead of hardcoded value. --- repofish | 17 +++++++++++------ 1 file 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 -- cgit v1.2.3