Re: Help me triage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 23, 2008 at 04:30:15PM -0700, John Poelstra wrote:
>
> I'm trying to meet a (probably overly aggressive) personal goal .....
......
> # Is there a general policy around using perl in pre/post ?
> https://bugzilla.redhat.com/show_bug.cgi?id=462996

John,

I suspect that there is not but perhaps there should be.

I have see numerous packages fail in their pre/post scripts on inspection
of kickstart logs all for want of perl and various other tools.....

Eliminating unnecessary and redundant tools when possible would be a positive step....
But what tools are the desired core set of tools?

In the context of Linux as it is today I would prefer Python over Perl and while
sh+stuff is traditional I think Python is rich enough and just fine.

As the below shows, Perl is not doing anything very complex and if the
system has enough Python to run rpm and yum it should be possible to
recode the scripts.

With regard to sh in pre/post tools....
With sh the interesting actions are commonly done by tools in the "+stuff"
category for which a partial list looks sort of like:
	[, ar, at, awk, basename, bash, batch, bc, cat, chcon,
	checkpolicy, chgrp, chmod, chown, ci, cksum, clear, cmp, co, col,
	colcrt, colrm, column, cp, cpio, curl, cut, cut, date, dc, dd,
	df, diff, diff3, dig, domainname, du, echo, ed, ed, egrep, env,
	ex, exec, expect, false, fgrep, file, find, find, fmt, ftp, gawk,
	getopt, gettext, grep, gtar, gunzip, gzip, head, HEAD, hexdump,
	host, hostname, install, ipcalc, join, kill, last, ldd, less,
	link, ln, locale, ls, make, mkdir, mknod, mktemp, mv, netstat,
	nisdomainname, od, ping, ping6, ps, pwd, rcp, rcs, rm, rmdir,
	rsync, scp, sed, sleep, sort, stty, sudo, sum, tail, tar,
	tee, test, time, touch, tr, uniq, unlink, unzip, uptime, w,
	wall, wc, wget, which, who, yes, zcat....
The point of the list is that sh and friends can pull in a longish list so shell
scripts are not always the simplifying win one might want.

In the case of nss-mdns when wanted it is so fundamental (name services) 
that the less stuff it depends on the better.

======================================================================================
Description :
nss-mdns is a plugin for the GNU Name Service Switch (NSS) functionality of
the GNU C Library (glibc) providing host name resolution via Multicast DNS
(aka Zeroconf, aka Apple Rendezvous, aka Apple Bonjour), effectively allowing
name resolution by common Unix/Linux programs in the ad-hoc mDNS domain .local.

======================================================================================
$ rpm -q -f  /etc/nsswitch.conf
glibc-2.8-8.x86_64
glibc-2.8-8.i686

======================================================================================
# rpm -q --scripts -p ./fedora/packages/nss-mdns-0.10-4.fc9.x86_64.rpm
postinstall scriptlet (using /bin/sh):
/sbin/ldconfig
# Perl-fu to add mdns4_minimal to the hosts line of /etc/nsswitch.conf
if [ -f /etc/nsswitch.conf ] ; then
	perl -ibak -pe '
		sub insert {
			my @bits = split(" ", shift);
		
			if (grep { $_ eq "mdns4_minimal" || $_ eq "mdns4"
				|| $_ eq "mdns6_minimal" || $_ eq "mdns6"
				|| $_ eq "mdns_minimal" || $_ eq "mdns" } @bits) {
				return join " ", @bits;
			}
			
			return join " ", map {
				$_ eq "dns" ? ("mdns4_minimal", "[NOTFOUND=return]", $_) : $_
			} @bits;
		}

		s/^(hosts:\s+)(.*)$/$1.insert($2)/e;
	' /etc/nsswitch.conf
fi
preuninstall scriptlet (using /bin/sh):
# Perl-fu to remove mdns4_minimal from the hosts line of /etc/nsswitch.conf
if [ "$1" -eq 0 -a -f /etc/nsswitch.conf ] ; then
	perl -ibak -pe '
		my @remove = (
			"mdns4_minimal [NOTFOUND=return]",
			"mdns4_minimal",
			"mdns4",
			"mdns6_minimal [NOTFOUND=return]",
			"mdns6_minimal",
			"mdns6",
			"mdns_minimal [NOTFOUND=return]",
			"mdns_minimal",
			"mdns",
		);
		sub remove {
			my $s = shift;
			foreach my $bit (@remove) {
				$s =~ s/\s+\Q$bit\E//g;
			}
			return $s;
		}
		s/^(hosts:\s+)(.*)$/$1.remove($2)/e;
	' /etc/nsswitch.conf
fi
postuninstall program: /sbin/ldconfig
======================================================================================
 
BTW: Some projects like the OLPC project have very limited resources and perl is
not on the default list but Python is.  I noticed this with ntptrace....  on an XO
recently...  






-- 
	T o m  M i t c h e l l 
	Found me a new hat, now what?

-- 
fedora-test-list mailing list
fedora-test-list@xxxxxxxxxx
To unsubscribe: 
https://www.redhat.com/mailman/listinfo/fedora-test-list

[Index of Archives]     [Fedora Desktop]     [Fedora SELinux]     [Photo Sharing]     [Yosemite Forum]     [KDE Users]

  Powered by Linux