OpenPKG CVS Repository
http://cvs.openpkg.org/
Server: cvs.openpkg.org Name: Ralf S. Engelschall
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src Date: 20-Mar-2007 13:50:59
Branch: HEAD Handle: 2007032012505800
Modified files:
openpkg-src/openpkg HISTORY uuid.sh
Log:
improve generation of UUID_PLATFORM by using a better (no longer IP
based) discriminator value
Summary:
RevisionChanges Path
1.439 +1 -0 openpkg-src/openpkg/HISTORY
1.11+11 -33 openpkg-src/openpkg/uuid.sh
patch -p0 '@@ .'
Index: openpkg-src/openpkg/HISTORY
$ cvs diff -u -r1.438 -r1.439 HISTORY
--- openpkg-src/openpkg/HISTORY 20 Mar 2007 11:29:50 - 1.438
+++ openpkg-src/openpkg/HISTORY 20 Mar 2007 12:50:58 - 1.439
@@ -2,6 +2,7 @@
2007
+20070320 improve generation of UUID_PLATFORM by using a better (no longer IP
based) discriminator value
20070320 remove old support for never finished rcng
20070320 remove old backward compatibility from rc.func for OpenPKG 1.2's
opXXX functions
20070319 change rc to not check permissions for --print operations
@@ .
patch -p0 '@@ .'
Index: openpkg-src/openpkg/uuid.sh
$ cvs diff -u -r1.10 -r1.11 uuid.sh
--- openpkg-src/openpkg/uuid.sh 1 Jan 2007 17:40:20 - 1.10
+++ openpkg-src/openpkg/uuid.sh 20 Mar 2007 12:50:58 - 1.11
@@ -29,6 +29,7 @@
mgrp=@l_mgrp@
prog_rpm=$prefix/libexec/openpkg/rpm
prog_shtool=$prefix/lib/openpkg/shtool
+prog_miniperl=$prefix/lib/openpkg/miniperl
prog_uuid=$prefix/lib/openpkg/uuid
file_uuid=$prefix/etc/openpkg/uuid
@@ -62,34 +63,17 @@
eval `$prog_rpm --eval $query 2/dev/null`
# query OS information
-Q_platform=`$prog_shtool platform --type=binary 2/dev/null`
+Q_platform=`$prog_shtool platform --type=binary 2/dev/null |\
+sed -e 's;^\([^-][^-]*-[^.-][^.-]*\)\..*$;\1;'`
if [ .$Q_platform = . ]; then
Q_platform=unknown
fi
-Q_hostname=`$prog_shtool echo -e '%h%d' 2/dev/null`
-if [ .$Q_hostname = . ]; then
-Q_hostname=unknown
-fi
-Q_ipaddr=
-ifconfig=`$prog_shtool path -p /sbin:/usr/sbin:/bin:/usr/bin:$PATH
ifconfig`
-if [ .$ifconfig != . ]; then
-ips=`$ifconfig -a 21 | grep 'inet' | \
- sed -e 's;inet6;inet;g' \
- -e 's;inet addr:;inet ;' \
- -e 's;^;X;' \
- -e 's;^X.*inet *\([^ ][^ ]*\).*$;\1;' \
- -e 's;^X.*;;' | \
- sort`
-for ip in $ips; do
-if [ .$Q_ipaddr = . ]; then
-Q_ipaddr=$ip
-else
-Q_ipaddr=$Q_ipaddr,$ip
-fi
-done
-fi
-if [ .$Q_ipaddr = . ]; then
-Q_ipaddr=unknown
+Q_discriminator=`$prog_uuid -v1 | $prog_uuid -d -- - | awk
'/node:.*global unicast/ { printf(mac:%s, $2); }'`
+if [ .$Q_discriminator = . ]; then
+Q_discriminator=`$prog_miniperl -e 'if (-f /etc/openpkg) {
printf(inode:%s, (stat(/etc/openpkg))[1]); }' 2/dev/null`
+if [ .$Q_discriminator = . ]; then
+Q_discriminator=`$prog_shtool echo -e 'fqdn:%h%d' 2/dev/null`
+fi
fi
}
@@ -221,8 +205,7 @@
# update platform UUID
name=${Q_platform}
-name=$name:${Q_hostname}
-name=$name:${Q_ipaddr}
+name=$name:${Q_discriminator}
if [ .$opt_v = .yes ]; then
echo uuid: querying OpenPKG Platform OID
echo uuid: $prog_rpm --eval '%{l_openpkg_oid_platform}'
@@ -282,12 +265,7 @@
echo
echo OpenPKG Platform
echo Platform Id: $Q_platform
-echo Host Name: $Q_hostname
-n=1
-for ip in `echo $Q_ipaddr | sed -e 's;,; ;g'`; do
-echo . | awk '{ printf(Host IP Address %-6s %s\n, num, ip); }'
num=#$n ip=$ip
-n=`expr $n + 1`
-done
+echo Discriminator: $Q_discriminator
echo UUID_PLATFORM: $UUID_PLATFORM
echo
echo (run \$0 --verbose update\ to reproduce the UUID generation)
@@ .
__
OpenPKG http://openpkg.org
CVS Repository Commit List openpkg-cvs@openpkg.org