vzstats: add --help and --view

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
bin/lsbrelease: add

From http://www.mail-archive.com/users@openvz.org/msg04770.html:

> 1) osrelease script tryes to find /etc/*-release which is not used in
> Debian. As solution I think it is possible to use lsb_release as
> distro-independent way to detect release.

Suggested-by: CoolCold <coolthecold@gmail.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
bin/vzlist: don't ask for unsupported fields

As reported in
http://www.mail-archive.com/users@openvz.org/msg04770.html:

> 2) vzlist script relyes on some newer vzctl version, for example, my
> system has backported vzctl 3.0.30.2 , and it doesn't contain output
> fields like 'layout' and 'vswap' , so it just exits.

So, let's check if fields are supported by vzlist and only use ones that
are supported.

Note:
* "layout" was added in vzctl 3.2
* "vswap" was added in vzctl 4.0 (fixed in > 4.2)

Reported-by: CoolCold <coolthecold@gmail.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
bin/vzlist: check vzlist is available

Don't try to call vzlist many times if it's not available (for some
reason).

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzstats: autodiscover http proxy

Added function to autodiscover http proxy if possible

1. if http_proxy already set, do nothing,
else
2. read /etc/wgetrc and use http_proxy setting if configured,
else
3. read /etc/yum.conf and use procy setting if configured,
else
4. do nothing and go on

[kir@openvz.org: improved regexes, strip whitespace from wget config]
vzstats discover_proxy(): use local variable

1. Rename PROXY to proxy_line

2. Mark it as local to limit scope

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzstats: reimplement usage() with here-document

Easier to expand this way

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzstats: move discover_proxy() to after opt parse

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzstats: introduce DISABLED_MARK

To be used by later patches

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzstats: allow more than one option

Loop through options as long as we have any.

This also fixes "unbound variable: $0" introduced by commit 3e61686.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzstats: allow to process options even if disabled

Even if vzstats is disabled, allow it to process command line options.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzstats: implement --disable/--enable

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzstats: print error in case of unknown option

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzctl --status: implement

Print current configuration etc.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzstats(8): add

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
README, %description: expand

Explain what stats are reported and why, links to more info

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Add bash_completion script

... although I wouldn't call it a script :)

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Released vzstats 0.3

- add options --help, --view, --enable, --disable and --status
- add vzstats(8) man page
- add lsbrelease script
- fix vzlist script to work with older vzctl
- add proxy discovery code
- add bash_completion script

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Released vzstats 0.3.1

- add options --help, --view, --enable, --disable and --status
- add vzstats(8) man page
- add lsbrelease script
- fix vzlist script to work with older vzctl
- add proxy discovery code
- add bash_completion script

(this is a respin due to missed VERSION fix in vzstats)

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
vzstats.spec: fix %triggerin call

The problem is trigger -p is called with some arguments, which
we don't understand, leading to the following error:

	Non-fatal <unknown> scriptlet failure in rpm package
	vzstats-0.3.1-1.noarch
	ERROR: Unknown option /var/tmp/rpm-tmp.gxKwVQ
	Usage:
	....

So let's stop using -p for %triggerin

Signed-off-by: Kir Kolyshkin <kir@openvz.org>