aboutsummarylogtreecommitdiffstats
path: root/haur
diff options
context:
space:
mode:
Diffstat (limited to 'haur')
-rwxr-xr-xhaur31
1 files changed, 29 insertions, 2 deletions
diff --git a/haur b/haur
index c142d7cdf8c5..cf4da3f71613 100755
--- a/haur
+++ b/haur
@@ -23,10 +23,12 @@ fi
REMOVE=false
CLEAR_CACHE=false
+UPDATE=false
for arg in "$@"; do
shift
case "$arg" in
+ "--update") set -- "$@" "-u" ;;
"--remove") set -- "$@" "-r" ;;
"--clear-cache") set -- "$@" "-c" ;;
"--help") set -- "$@" "-h" ;;
@@ -36,8 +38,11 @@ for arg in "$@"; do
done
shift $((OPTIND -1))
-while getopts ":rch" opt; do
+while getopts ":urch" opt; do
case $opt in
+ u )
+ UPDATE=true
+ ;;
r )
REMOVE=true
;;
@@ -45,7 +50,7 @@ while getopts ":rch" opt; do
CLEAR_CACHE=true
;;
h )
- echo "Usage: haur [--remove | -r] | [--clear-cache | -c] <package names>"
+ echo "Usage: haur [--remove | -r] | [--clear-cache | -c] [--update | -u] <package names>"
exit 0
;;
\?)
@@ -75,6 +80,28 @@ if [ $REMOVE == true ]; then
echo "${blue}Nothing to clear${normal}"
fi
fi
+elif [ $UPDATE == true ]; then
+ for PACKAGE_NAME in "$@"; do
+ echo "${blue}Updating $PACKAGE_NAME...${normal}"
+ cd ~/.haur
+ cd $PACKAGE_NAME
+ git pull origin master
+ rm -rf pkg src
+ rm -f *.pkg.tar.gz
+ makepkg -si
+ done
+ if [ $CLEAR_CACHE == true ]; then
+ if test -f "$HOME/.haur_cache"; then
+ echo "${blue}Clearing cache...${normal}"
+ while IFS= read -r line || [[ -n "$line" ]]; do
+ echo "${blue}Removing $line${normal}"
+ rm -rf $HOME/.haur/$line
+ done < "$HOME/.haur_cache"
+ rm ~/.haur_cache
+ else
+ echo "${blue}Nothing to clear${normal}"
+ fi
+ fi
else
if [ $CLEAR_CACHE == true ]; then
if test -f "$HOME/.haur_cache"; then