summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeppia <seppia@seppia.net>2018-06-03 23:22:08 +0200
committerSeppia <seppia@seppia.net>2018-06-03 23:22:08 +0200
commit29f94b4ced3e262354e3c30dd13555bc725982c7 (patch)
treed229a8e2ba144218fbf78c77365d5226b291b633
parent648e959ca4506c8d821b109246f479b41b4eaa51 (diff)
downloadrepofish-29f94b4ced3e262354e3c30dd13555bc725982c7.tar.gz
repofish-29f94b4ced3e262354e3c30dd13555bc725982c7.tar.bz2
repofish-29f94b4ced3e262354e3c30dd13555bc725982c7.zip
Archiving packages support
Added support for archiving old packages from local repository to a specific archiving folder.
-rwxr-xr-xrepofish36
1 files changed, 36 insertions, 0 deletions
diff --git a/repofish b/repofish
index d84c256..6b820f6 100755
--- a/repofish
+++ b/repofish
@@ -5,6 +5,7 @@
#SRC_PATH='/path/to/packages/sources'
#REPO_PATH='/path/to/archlinux/repo'
#REPO_NAME='repo_name'
+#ARCHIVE_PATH='/path/to/archlinux/archive/repo'
## Search variables
URL_PREFIX='https://aur.archlinux.org/'
@@ -163,6 +164,19 @@ update_repo() {
fi
}
+archive_repo_pacakges() {
+ if [ "$1" != '' ]; then
+ 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/ \;
+ 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/ \;
+ fi
+}
+
search_packages() {
declare -a key=("${!1}")
LIST_INST=$($0 list | tail -n +2 | tr '\n' '|')
@@ -195,6 +209,7 @@ print_help() {
echo ' USAGE: '"$0"' COMMAND PKGNAME(s) (default ALL)'
echo
echo ' add adds packages from from AUR'
+ echo ' archive archives packages of local repository'
echo ' clone (url) clones git package repository'
echo ' rm remove packages'
echo ' check check PKGBUILD'
@@ -287,6 +302,27 @@ elif [ "$1" == 'update-repo' ]; then
else
update_repo
fi
+elif [ "$1" == 'archive' ]; then
+ if [ "${REPO_PATH}" == '' ];then
+ echo -e '\033[1;31mERROR:\033[m REPO_PATH variable not set.'
+ elif [ ! -d "${REPO_PATH}" ]; 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 [ "${ARCHIVE_PATH}" == '' ];then
+ echo -e '\033[1;31mERROR:\033[m ARCHIVE_PATH variable not set.'
+ elif [ ! -d "${ARCHIVE_PATH}" ]; then
+ echo -e '\033[1;31mERROR:\033[m ARCHIVE_PATH variable set to invalid path.'
+ elif [ "$2" != '' ]; then
+ N=2
+ while [ "${!N}" != '' ]; do
+ packages[$((N-2))]=${!N}
+ let N=N+1
+ done
+ archive_repo_packages packages[@]
+ else
+ archive_repo_packages
+ fi
elif [ "$1" == 'build' ]; then
if [ "$2" != '' ]; then
N=2