138 lines
3.9 KiB
Bash
Executable File
138 lines
3.9 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# vpm - a simple (to use) wrapper script for XBPS - the X Binary Package System (see http://www.voidlinux.eu)
|
|
# Copyright (c) 2016 Armin Jenewein <a@m2m.pm> - Released under the terms of the GNU G
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
version="0.2"
|
|
|
|
usage () {
|
|
echo
|
|
echo "vpm - void package manager"
|
|
echo
|
|
echo "USAGE: "
|
|
echo
|
|
echo "vpm <OPTIONS> [<args>]"
|
|
echo
|
|
echo "OPTIONS: "
|
|
echo
|
|
echo "sync - Synchronize remote repository data"
|
|
echo "update - Update the system"
|
|
echo "repolist - list configured repositories"
|
|
echo
|
|
echo "info <package(s)> - Show information about package"
|
|
echo "filelist <package(s)> - Show file-list of package"
|
|
echo "dependencies <package(s)> - Show dependendies of package"
|
|
echo "reverse <package(s)> - Show reverse dependendies of package"
|
|
echo
|
|
echo "search <name> - Search for package(s) by name/description"
|
|
echo "searchfile <file> - Search for package containing <file>"
|
|
echo
|
|
echo "install <package(s)> - Install <package(s)>"
|
|
echo "forceinstall <package(s)> - Force installation of <package(s)>"
|
|
echo
|
|
echo "list - List installed packages"
|
|
echo "remove <package(s) - Remove (uninstall) <package(s)"
|
|
echo "cleanup - Empty (clean-up) cache directory"
|
|
echo "autoremove - Remove orphaned packages"
|
|
echo "help - Show this help screen"
|
|
echo
|
|
}
|
|
|
|
|
|
if [[ "$1" == "" ]]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
case "$1" in
|
|
info)
|
|
shift
|
|
xbps-query -R "$@"
|
|
;;
|
|
filelist)
|
|
shift
|
|
xbps-query -R -f "$@"
|
|
;;
|
|
dependencies)
|
|
shift
|
|
xbps-query -R -x "$@"
|
|
;;
|
|
reverse)
|
|
shift
|
|
xbps-query -R -X "$@"
|
|
;;
|
|
searchfile)
|
|
shift
|
|
echo "This might take a long time, please be patient..."
|
|
sleep 1
|
|
xbps-query -R -o "*/$1"
|
|
;;
|
|
list)
|
|
echo
|
|
xbps-query -l
|
|
echo
|
|
shift
|
|
;;
|
|
sync)
|
|
echo "Synchronizing remote repository data ... "
|
|
xbps-install -S
|
|
echo "done."
|
|
;;
|
|
install)
|
|
shift
|
|
echo "Installing Package(s): $@"
|
|
xbps-install -S "$@"
|
|
;;
|
|
forceinstall)
|
|
shift
|
|
echo "force-install: Forcing installation (incl. eventual Upgrade/Downgrade) of package(s): $@"
|
|
xbps-install -Sf "$@"
|
|
;;
|
|
remove)
|
|
shift
|
|
xbps-remove "$@"
|
|
;;
|
|
autoremove)
|
|
shift
|
|
echo -n "Removing orphaned packages... "
|
|
xbps-remove -O
|
|
echo "done."
|
|
;;
|
|
update)
|
|
shift
|
|
echo "Running system update..."
|
|
xbps install -Suv
|
|
;;
|
|
search)
|
|
shift
|
|
xbps-query -Rs "$@"
|
|
;;
|
|
cleanup)
|
|
echo "Cleaning up packages (will remove orphaned packages)..."
|
|
shift
|
|
xbps-remove -O "$@"
|
|
;;
|
|
help|--help)
|
|
usage
|
|
;;
|
|
''|*)
|
|
a="$1"
|
|
if hash "xbps-${a}" >/dev/null 2>&1; then echo "Running: xbps-${a} $@"; xbps-${a} $@; else echo "No XBPS sub-command binary found for: $@" && exit 1; fi
|
|
exit 1
|
|
echo
|
|
echo "Unrecognized or no subcommand: $1"
|
|
shift
|
|
echo "Try: xbps-${a} $@ "
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
|