summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeppia <seppia@seppia.net>2018-06-03 14:49:10 +0200
committerSeppia <seppia@seppia.net>2018-06-03 14:49:10 +0200
commit00eeed46627b15881b3ccc92336e32c5cc7fce72 (patch)
treeb7698bd0c7ac028e35d2cbf34ea1fca4b4eeb625
parent8cb69c3aa2409f992b138511c1c3b9774ff008b2 (diff)
downloadrepofish-00eeed46627b15881b3ccc92336e32c5cc7fce72.tar.gz
repofish-00eeed46627b15881b3ccc92336e32c5cc7fce72.tar.bz2
repofish-00eeed46627b15881b3ccc92336e32c5cc7fce72.zip
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.
-rwxr-xr-xrepo.sh46
1 files changed, 39 insertions, 7 deletions
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.'