From 00eeed46627b15881b3ccc92336e32c5cc7fce72 Mon Sep 17 00:00:00 2001 From: Seppia Date: Sun, 3 Jun 2018 14:49:10 +0200 Subject: New update function and help fixes Added new function that only updates the sources without building them and changed already existent update function to update-repo. There are also some fixes in the help message. --- repo.sh | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'repo.sh') diff --git a/repo.sh b/repo.sh index 6f6af11..2e8d8aa 100755 --- a/repo.sh +++ b/repo.sh @@ -103,6 +103,26 @@ upgrade_packages() { fi } +update_packages() { + if [ "$1" != '' ]; then + declare -a pkg=("${!1}") + for i in "${pkg[@]}"; do + cd $(find ${SRC_PATH}/* -type d -prune -iname "*$i") + git fetch + git diff origin/master + git merge + done + else + for i in $(find ${SRC_PATH}/* -type d -prune) + do + cd $i + git fetch + git diff origin/master + git merge + done + fi +} + install_package() { declare -a pkg=("${!1}") for i in "${pkg[@]}"; do @@ -159,17 +179,18 @@ print_help() { echo echo ' USAGE: repo.sh COMMAND PKGNAME (default ALL)' echo - echo ' add adds package from from AUR' + echo ' add adds packages from from AUR' echo ' clone (url) clones git package repository' - echo ' rm remove package' + echo ' rm remove packages' echo ' check check PKGBUILD' - echo ' list lists availables packages' - echo ' update updates the packages in the repo' + echo ' list lists locally available packages' + echo ' update-repo updates the packages in the repo' echo ' build builds the packages' - echo ' upgrade upgrades the packages' + echo ' upgrade upgrades and builds the packages' + echo ' update updates the packages' echo ' install builds and installs the package' echo ' clean cleans the packages' - echo ' search searches packages in AUR' + echo ' search searches packages in the AUR' echo ' help prints this help' echo @@ -234,7 +255,7 @@ elif [ "$1" == 'list' ]; then else list_packages fi -elif [ "$1" == 'update' ]; then +elif [ "$1" == 'update-repo' ]; then if [ "${REPO_PATH}" == '' ];then echo 'ERROR: REPO_PATH variable not set.' elif [ ! -d "${REPO_PATH}" ]; then @@ -273,6 +294,17 @@ elif [ "$1" == 'upgrade' ]; then else upgrade_packages fi +elif [ "$1" == 'update' ]; then + if [ "$2" != '' ]; then + N=2 + while [ "${!N}" != '' ]; do + packages[$((N-2))]=${!N} + let N=N+1 + done + update_packages packages[@] + else + update_packages + fi elif [ "$1" == 'install' ]; then if [ "$2" == '' ]; then echo 'ERROR: missing argument.' -- cgit v1.2.3