Hi,
a little off topic, but I wrote a small script which is able to install packages, either from the Slackware distribution or from third party repositories.
For example, if I type `script -A vlc ffmpeg google', it will display the following:
Code:
[alien] [ ] phonon-vlc-0.6.0-i486-1alien
[alien][*] npapi-vlc-20130408-i486-1alien
[alien][*] vlc-2.0.8-i486-1alien
[restricted][*] npapi-vlc-20130408-i486-1alien
[restricted][*] vlc-2.0.8-i486-1alien
[slacky] [ ] vlc-qt-0.7.0-i486-1sl
[slacky] [u] vlc-2.0.6-i486-1sl -> vlc-2.0.8-i486-1alien
[slacky] [ ] vlc-append-0.6-i686-3sl
[alien][*] ffmpeg-1.2-i486-1alien
[alien] [ ] gst-plugins-ffmpeg-0.10.13-i486-2alien
[restricted][*] ffmpeg-1.2-i486-1alien
[slacky] [u] ffmpeg-1.1.2-i686-1sl -> ffmpeg-1.2-i486-1alien
[slacky] [ ] ffmpeg2theora-0.29-i486-1sl
[slacky] [ ] ffmpegthumbnailer-2.0.8-i486-1sl
[slacky] [ ] gst-ffmpeg-0.10.13-i486-1sl
[extra][*] google-chrome-pam-solibs-1.1.3-i486-1
[slacky] [ ] google-go-lang-1.1.1-i486-2sl
[slacky] [ ] google-talkplugin-4.0.3.0-i386-1sl
[slacky] [ ] googleearth-6.0.3.2197-i386-1sl
[slacky] [u] google-chrome-29.0.1547.57-i386-1sl -> google-chrome-29.0.1547.62-i386-1
(`script -a vlc ffmpeg google' would result in the same display, minus the installed status, so that this option can also be used on a non-Slackware system.)
Typing `script -r install vlc ffmpeg xbindkeys nvi' results in:
Code:
slacker: processing `` vlc ffmpeg xbindkeys nvi ''
.....
[restricted] vlc-2.0.8-i486-1alien.txz
[restricted] ffmpeg-1.2-i486-1alien.txz
[rlworkman] nvi-1.81.6-i486-1_rlw.txz
[slacky] xbindkeys-1.8.5-i486-1sl.txz
-------------------------------------------------------------------------------
slacker: 4 packages to install
slacker: proceed? [ny](n)
Typing `script install e' gives:
Code:
slacker: processing `` e ''
..
[e] emacs-24.3-i486-3.txz
-------------------------------------------------------------------------------
slacker: one package to install
slacker: proceed? [y/n](n)
(The dots are something of a progress bar.)
`script -r install pkg1 pkg2 ...' would install the packages, honoring REPOPRIO: a variable that is similiar to the PKG_PRIORITY variable of slackpkg+ (I implemented it after I read about it). I can also type `script -r <repo> install pkg1 pkg2 ...' and it would install those packages from said <repo> (it does GPG and MD5 checking as well). Without `install', it would just download the packages to `$DEST/slackware${SLACKARCH}-$SLACKVER'.
It can also download/copy/link (or install|upgrade|reinstall|remove) packages from extra, pasture, testing, patches and the Slackware series; for this, typing `script [<install|reinstall|upgrade|remove>] pkg1 pkg2 dir ...' suffices, though testing comes last, so to get a package from testing, one can do `testing:pkg1,pkg2,...' (this syntax works for pasture, patches, testing and extra, not for slackware series, which would be kind of pointless anyway) or set the PRIO variable to, for example, "testing series patches extra pasture" so that testing comes first. One can also use a local path---can be prefixed with file://---for the main Slackware packages variable SLACKMIRROR and for each repository.
I can also do whole directories with it by typing, e. g., `script ap extra', a whole repository can be downloaded using `script -r <repo>'. For some repositories, it supports downloading directories as well: for example, I can get the `deps' or `kde' directory of alien-kde's repo by issuing `script -r alien-kde upgrade kde deps' or `script -r upgrade kde deps' if GREP_DIR is true (the latter command honors REPOPRIO).
It also supports searching and getting the SlackBuilds from source/ using -z for searching, -Z for getting; `script -r <repo> -z/-Z <pkg>' does the same for third party repositories, this currently supports slacky and Alien BOB's repos, I did not test this with others.
So `script -Z mpg123 lynx' gives this:
Code:
slacker: processing `` lynx mpg123 ''
...
source/ap/mpg123/mpg123-1.15.4.tar.xz
source/ap/mpg123/mpg123.SlackBuild
source/ap/mpg123/slack-desc
source/n/lynx/lynx2.8.7.tar.xz
source/n/lynx/lynx.cfg.diff.gz
source/n/lynx/lynx.path.diff.gz
source/n/lynx/lynx.SlackBuild
source/n/lynx/slack-desc
-------------------------------------------------------------------------------
slacker: 8 files to link to ``/tmp/slackware-current''
slacker: proceed? [y/n](n)
`script -r <repo> -A' lists all packages for <repo> and displays if the package is installed, upgraded or not installed; if an older kde release is installed, one can run `script -r alien-kde -A | grep '\[ \]'' and get a list of added packages, or `script -r alien-kde -n -i' and it will install the added packages (-n alone just displays them: the -n option I added for my own convenience); my script does not display which packages from kde have been removed, though. For this, the README still needs to get consulted.
`script -r -U' would check for updates from all third party repositories, `script -r <repo> -u' only for updates from <repo>, `-u -i' installs upgrades, `script -r alien-kde upgrade deps' would only upgrade the deps (though this does not work for multilib, and as I don't have a 64 bit system I couldn't test this much). Each repository also has a blacklist to blacklist packages that should not be checked for updates.
`script -C' checks the ChangeLog for updates and displays only those bits that have changed since the last run of `-C'. `-C -s' shows the whole ChangeLog, `-C -l' the last updates (basically the diff between the current ChangeLog and the one saved in ~/.script/ChangeLog.txt.gz).
It can also update packages: either with the -u or the -U switch. `-u' checks for updates from patches/ and only gets those updated packages that are installed, `-U' checks the installed packages against the package list and gets those that differ -- useful for tracking current or upgrading only those package that are installed from one release to another (first set SLACKER to the new version: this can be done on the command line via `SLACKVER=ver script -U' [or setenv SLACKVER] or in its configuration file ~/.script/config). (It also supports updating packages from extra and, with a switch, prefers testing.) Though updating a -current system with my script is slower than with slackpkg. It has a little progress bar, not as fancy as slackpkg's one, it just echos dots (honors 80 columns).
(One can also use `script upgrade pkg1 series ...' and it would just update the pkg1 and every package of `series' that differs [and is installed, of course].)
-u, -U and `install|remove|reinstall|upgrade' also support a blacklist; this can be the package name, like kernel-huge, but can also be part of a directory like `nosmp-sdk', a regular expression like [0-9]+alien is also supported (it is a simple egrep -v -f $blacklist). There is a -b option that will: add a whole series to the blacklist, with a -u switch it will only add those packages from a series that are upgraded, it can also add single packages. And there is a -B option which will delete a whole series from the blacklist, or, with the -u switch, only those packages of a series that are upgraded, or package names: it can't delete regular expressions. The -u switch to -b is useful for ktown packages, though of course one could use [0-9]+alien, which is simpler.
`script upgrade <series>' only updates those packages that differ, `script install <series>' installs all missing packages from <series>, `reinstall' reinstalls those that are installed, etc.
`script -R' rsyncs a copy of the Slackware tree, `script -R -x source,extra/source' would exclude these directories, the version can be specified using `-v' (though it defaults to $SLACKVER), the dir to rsync to with `-d' and a dry run with `-n'; `-R -D' runs rsync using --delete. RSYNCMIRROR can be defined in the script's config file, on the command-line or as first argument.
Doing
Code:
for i in `script -l`; do YES=true script $i; done
would get all slackware series directories.
It does a few other things as well: listing information for packages from /var/log/packages; listing the contents of a package; showing which file belongs to which package; displaying foreign packages; displaying the available versions on one's Slackware mirror (needs lynx, links or w3m); displaying and downloading ISO files in case they are available (needs lynx, links or w3m, my script supports resuming downloads by setting RESUME=true, supported FETCHCMDs for resuming are curl, lftp, wget and ncftpget [ftp only], otherwise FETCHCMD also supports fetch [FreeBSD], tnftp [Net- and OpenBSD], hget [plan9port, http-only] and axel);
it can run `upgradepkg --install-new' on /path/to/series, so that one can run `script -Y /path/to/series' and either type in the desired directories, use a preset or use the existing directories, does MD5 checking if /path/to/CHECKSUMS.md5 exists (this is similiar to the method in UPGRADE.TXT): I used this when my script did not support installing packages. After installing, it also notifies the user if .new files have been installed; `-x' will display .new files found (except for some, like shadow or passwd) and move these files over and back up old configuration files with a .bak suffix: this is similar to the method described in UPGRADE.TXT.
It can also display added and removed packages between two versions (so you can run `script -n 14.0 current -R | xargs removepkg' -- `-R' only displays those packages that have been removed that are installed, `-r' displays all packages that have been removed, -a displays added, -A asks if they should be downloaded). Though `-n' does not work if SLACKMIRROR uses a local path, so one can do `SLACKMIRROR=mirror script -n ...' or `script
http://mirror -n ...' to temporarily override SLACKMIRROR. There's also an option which can be used to check the integrity (MD5 and, optionally, PGP signatures) of Slackware packages: syntax is `script -V /path/to/CHECKSUMS.md5(.gz) /path/to/dir' where /path/to/dir points to the directory holding the slackware, extra, pasture, testing etc. directories.
I envy slackpkg for its file-search: I only have an option to grep in Slackware's MANIFEST.bz2 files, as I don't know awk(1) well enough to reformat the MANIFEST files.
It is written in ash, not bash, so it's quite simple (~5700 loc, 153K). It is not as sophisticated as slackpkg; it uses slackpkg's regex for grepping packages, though (including its useful ARCH check). Its options are letters with one hyphen, like -A, -s, etc, except for the install|reinstall|upgrade|remove targets. It does not support a dialog interface, instead it displays up to twenty packages on the terminal, or uses $PAGER (if available) for viewing packages to be acted upon.
I called it `slacker'. But with slackpkg being available (and now even having support for third party repositories), the use of my script is questionable. I'm also not a coder, more a `tinkerer'.
Regards
lems