diff --git a/README.rst b/README.rst index 1211a434..ec6167eb 100644 --- a/README.rst +++ b/README.rst @@ -48,21 +48,24 @@ Command Line Tool Usage .. code-block:: bash - usage: slpkg [-h] [-v] [-u] [-a] [-s name script source] [-r] [-l] [-f] [-d] + usage: slpkg.py [-h] [-v] [-s script source] [-l all, sbo [all, sbo ...]] [-i] + [-u] [-a] [-r] [-f] [-d] Utility to help package management in Slackware - + optional arguments: - -h, --help show this help message and exit - -v, --verbose print version and exit - -u, --upgrade install-upgrade package with new - -a, --reinstall reinstall the same package - -s script source, --slackbuild script source - auto build package - -r, --remove remove package - -l, --list list of installed packages - -f, --find find if package installed - -d, --display display the contents of the package + -h, --help show this help message and exit + -v, --verbose print version and exit + -s script source, --slackbuild script source + auto build package + -l all, sbo [all, sbo ...], --list all, sbo [all, sbo ...] + list of installed packages + -i , --install install binary package + -u , --upgrade install-upgrade package with new + -a , --reinstall reinstall the same package + -r , --remove remove package + -f , --find find if package installed + -d , --display display the contents of the package Slpkg Examples diff --git a/bin/slpkg.py b/bin/slpkg.py index f89592a1..4d07ab86 100755 --- a/bin/slpkg.py +++ b/bin/slpkg.py @@ -29,14 +29,16 @@ def main(): action="store_true") parser.add_argument("-s", "--slackbuild", help="auto build package", type=str, nargs=2, metavar=('script','source')) + parser.add_argument("-l", "--list", help="list of installed packages", + nargs="+", choices="all sbo".split(), metavar=('all, sbo')) + parser.add_argument("-i", "--install", help="install binary package", + type=str, metavar=('')) parser.add_argument("-u", "--upgrade", help="install-upgrade package with new", type=str, metavar=('')) parser.add_argument("-a", "--reinstall", help="reinstall the same package", type=str, metavar=('')) parser.add_argument("-r", "--remove", help="remove package", type=str, metavar=('')) - parser.add_argument("-l", "--list", help="list of installed packages", - action="store_true") parser.add_argument("-f", "--find", help="find if package installed", type=str, metavar=('')) parser.add_argument("-d", "--display", help="display the contents of the package", @@ -65,6 +67,18 @@ def main(): os.chdir(path + pkg_name) os.system("sh {}{}{}".format(path, pkg_name + "/", pkg_name + ".SlackBuild")) + ''' view list of installed packages ''' + if args.list: + if "all" in args.list: + os.system("ls " + __packages__ + "* | more") + + if "sbo" in args.list: + os.system("ls " + __packages__ + "* | grep 'SBo' | more") + + ''' install binary package ''' + if args.install: + os.system("installpkg {}".format(args.install)) + ''' upgrade package with new ''' if args.upgrade: os.system("upgradepkg --install-new {}".format(args.upgrade)) @@ -83,10 +97,6 @@ def main(): if remove_pkg == "y" or remove_pkg == "Y": os.system("removepkg {}".format(args.remove)) - ''' view list of installed packages ''' - if args.list: - os.system("ls " + __packages__ + "* | more") - ''' find if package installed on your system ''' if args.find: if find_package(args.find) == "": @@ -101,8 +111,8 @@ def main(): else: os.system("cat {}".format(find_package(args.display))) ''' fix null arguments ''' - if not any([args.verbose, args.upgrade, args.reinstall, args.slackbuild, - args.remove, args.list, args.find, args.display]): + if not any([args.verbose, args.slackbuild, args.install, args.upgrade, args.reinstall, + args.remove, args.list, args.find, args.display]): os.system("slpkg -h") diff --git a/man/slpkg.8 b/man/slpkg.8 index ef34aecf..3aaaf635 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -22,16 +22,18 @@ remove, find and view Slackware packages contents. .PP It's a quick and easy way to manage your packages in slackware to a command. .SH EXAMPLES - \fB-h, --help show this help message and exit\fP - \fB-v, --verbose print version and exit\fP - \fB-u, --upgrade install-upgrade package with new\fP - \fB-a, --reinstall reinstall the same package\fP - \fB-s script source, --slackbuild script source\fP - \fB auto build package\fP - \fB-r, --remove remove package\fP - \fB-l, --list list of installed packages\fP - \fB-f, --find find if package installed\fP - \fB-d, --display display the contents of the package\fP + \fB-h, --help show this help message and exit\fP + \fB-v, --verbose print version and exit\fP + \fB-s script source, --slackbuild script source\fP + \fB auto build package\fP + \fB-l all, sbo [all, sbo ...], --list all, sbo [all, sbo ...]\fP + \fB list of installed packages\fP + \fB-i , --install install binary package\fP + \fB-u , --upgrade install-upgrade package with new\fP + \fB-a , --reinstall reinstall the same package\fP + \fB-r , --remove remove package\fP + \fB-f , --find find if package installed\fP + \fB-d , --display display the contents of the package\fP .SH GLOBAL OPTIONS .TP \fB\-v\fP, \fB\-\-verbose\fP @@ -39,7 +41,21 @@ Print the version of program and exit. .SH COMMANDS .PP The following commands are available. -.SS -u --upgrade +.SS -s script source, --slackbuild script source +\fBslpkg\fP \fB-s\fP <\fIscript\fP> <\fIsource\fP> +.PP +With this argument, build slackware package quickly and easy. +Support .tar.gz and .tar.bz2 slackbuilds archives. +.SS -l all, sbo [all, sbo ...], --list all, sbo [all, sbo ...] +\fBslpkg\fP \fB-l\fP <\fIall\fP> <\fIsbo\fP> +.PP +Two display options list, one for all packages and another +only for packages SBo. +.SS -i , --install install binary package +\fBslpkg\fP \fB-i\fP <\fIpackage.tgz or .txz\fP> +Installs single binary packages designed for use with the +Slackware Linux distribution into your system. +.SS -u , --upgrade install-upgrade package with new \fBslpkg\fP \fB-u\fP <\fIpackage.tgz or .txz\fP> .PP Normally upgrade only upgrades packages that are already @@ -49,16 +65,11 @@ already have a version installed. 'Requires root privileges' .SS -a --reinstall \fBslpkg\fP \fB-a\fP <\fIpackage.tgz or .tgz or else\fP> .PP -Upgradepkg usually skips packages ifthe exact same package +Upgradepkg usually skips packages if the exact same package (matching name, version, arch, and build number) is already installed on the system.'Requires root privileges' (like slackware command upgradepkg --reinstall) -.SS -s name script source -\fBslpkg\fP \fB-s\fP <\fIscript\fP> <\fIsource\fP> -.PP -With this argument, build slackware package quickly and easy. -Support .tar.gz and .tar.bz2 slackbuilds archives. -.SS -r --remove +.SS -r , --remove package \fBslpkg\fP \fB-r\fP <\fIname of package\fP> .PP Removes a previously installed Slackware package, while writing @@ -66,10 +77,6 @@ a progress report to the standard output. A package may be specified either by the full package name (as you'd see listed in /var/log/packages/), or by the base package name. 'Requires root privileges' (like slackware command removepkg) -.SS -l --list -\fBslpkg\fP \fB-l\fP -.PP -List all installed packages. .SS -f --find \fBslpkg\fP \fB-f\fP <\fIname of package\fP> .PP diff --git a/man/slpkg.8.gz b/man/slpkg.8.gz index bb0b02ab..ae3d8551 100644 Binary files a/man/slpkg.8.gz and b/man/slpkg.8.gz differ