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

Re: %post and RHN


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.

if [ "$RUNNINGAS" != 'root' ]; then
        echo >&2 "$0 must run as root - exiting."
        exit 1
# 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
if [ -r /etc/sysconfig/rhn/activationkey ]; then
        ACTKEY=`cat /etc/sysconfig/rhn/activationkey`
        echo >&2 "No activation key found - cannot self register."
        exit 1
# 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
        /sbin/service rhnsd start
        echo >&2 "RHN registration command returned non-zero result:
        exit 1

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.

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