Re: %post and RHN

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

 



Zate,

When we were using RHN, we had an RPM which installed itself during
kickstart and created a symlink to /etc/cron.daily.  This way the
registration did not take place during kickstart, but sometime afterward
within 24 hours.

The script we used is below.  It's called /usr/sbin/self-rhn_register
and it's symlinked to /etc/cron.daily.  It assumes your %post puts a
proper activation key in place for your organization.  Once the
registration is successful, it removes the symlink in cron.daily.

#!/bin/sh
 
RUNNINGAS=`/usr/bin/whoami`
 
if [ "$RUNNINGAS" != 'root' ]; then
        echo >&2 "$0 must run as root - exiting."
        exit 1
fi
 
# Already registered?
if [ -f /etc/sysconfig/rhn/systemid ]; then
        echo >&2 "System already registered - to re-register, remove"
        echo >&2 "/etc/sysconfig/rhn/systemid first. Exiting."
        exit 1
fi
 
if [ -r /etc/sysconfig/rhn/activationkey ]; then
        ACTKEY=`cat /etc/sysconfig/rhn/activationkey`
else
        echo >&2 "No activation key found - cannot self register."
        exit 1
fi
                                                                                
# We have the key, let's try to do the registration. If successful,
# we'll remove the link from cron.daily so we don't run again.
/usr/sbin/rhnreg_ks --activationkey=$ACTKEY
                                                                                
if [ $? -eq 0 ]; then
        if [ -L /etc/cron.daily/self-rhn-register.cron ]; then
                rm /etc/cron.daily/self-rhn-register.cron
        fi
        /sbin/service rhnsd start
else
        echo >&2 "RHN registration command returned non-zero result:
$?."
        exit 1
fi
                                                                               

On Tue, 2003-10-28 at 09:30, Zate wrote:
> How am I able to script signing a system up for RHN and doing an update? 
> Mainly its the signing up that I am not sure how to do.  Can I copy a file
> from another system that has the login name and password/email address and
> then have the system update its packages etc etc itself ?  I'd like to be
> able to sign it up and have it do an update after its reboot.




[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux