numerous bug-fixes

This commit is contained in:
Armin Jenewein 2016-04-20 03:26:56 +00:00
parent b94cfe2f5e
commit 744e73e27d
2 changed files with 21 additions and 14 deletions

BIN
foo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

35
vpm
View File

@ -8,12 +8,17 @@
version="0.3" version="0.3"
version () { version () {
echo "vpm $version, Copyright (c) 2016 Armin Jenewein <a@m2m.pm>" tput setaf 67
echo "[vpm $version]"
tput sgr0
echo
echo "XBPS version: $(xbps-query --version)" echo "XBPS version: $(xbps-query --version)"
} }
msg () { msg () {
echo "vpm: $@" tput setaf 67
echo "[vpm] $@"
tput setaf 10
} }
# extract versionstring appendix from given package name # extract versionstring appendix from given package name
@ -81,7 +86,7 @@ case "$1" in
searchfile) searchfile)
shift shift
echo "This might take a long time, please be patient..." msg "searchfile: This might take a long time, please be patient..."
sleep 1 sleep 1
xbps-query -R -o "*/$1" xbps-query -R -o "*/$1"
;; ;;
@ -94,55 +99,57 @@ case "$1" in
echo echo
echo "Package name: $pkgname" echo "Package name: $pkgname"
echo "Version: $version" echo "Version: $version"
echo
done done
echo echo
shift shift
;; ;;
sync) sync)
echo "Synchronizing remote repository data ... " msg "Synchronizing remote repository data: (xbps-install -S):"
xbps-install -S xbps-install -S
echo "done." msg "done."
;; ;;
install) install)
shift shift
echo "Installing Package(s): $@" msg "Installing Package(s): $@ (xbps-install -S $@)"
xbps-install -S "$@" xbps-install -S "$@"
;; ;;
forceinstall) forceinstall)
shift shift
echo "force-install: Forcing installation (incl. eventual Upgrade/Downgrade) of package(s): $@" msg "Force-Installing Package(s): $@ (xbps-install -Sf $@)"
xbps-install -Sf "$@" xbps-install -Sf "$@"
;; ;;
remove) remove)
shift shift
msg "Removing package(s): $@ (xbps-remove $@)"
xbps-remove "$@" xbps-remove "$@"
;; ;;
autoremove) autoremove)
shift shift
echo -n "Removing orphaned packages... " msg "autoremove: Removing orphaned packages (xbps-remove -Q)"
xbps-remove -O xbps-remove -O
echo "done." msg "done."
;; ;;
update) update)
shift shift
echo "Running system update..." msg "Running system update (xbps-install -Sduv)"
xbps-install -Suv xbps-install -Suv
msg "done."
;; ;;
search) search)
shift shift
msg "Searching for: $@ (xbps-query -Rs $@)"
xbps-query -Rs "$@" xbps-query -Rs "$@"
;; ;;
cleanup) cleanup)
echo "Cleaning up packages (will remove orphaned packages)..." msg "Cleaning up packages (will remove orphaned packages) (xbps-remove -O $@)"
shift shift
xbps-remove -O "$@" xbps-remove -O "$@"
;; ;;
@ -155,10 +162,10 @@ case "$1" in
a="$1" a="$1"
if hash "xbps-${a}" >/dev/null 2>&1; then if hash "xbps-${a}" >/dev/null 2>&1; then
# xbps-<subcommand> found # xbps-<subcommand> found
msg "(relaying): xbps-${a} $@" msg "(relaying to XBPS): xbps-${a} $@"
xbps-${a} $@ xbps-${a} $@
else else
msg "Unrecognized subcommand: $1" msg "Unrecognized subcommand: $1 - try: $0 help"
echo echo
exit 1 exit 1
fi fi