Re: coping files off the CD.

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

 



On Tue, 10 Apr 2001, ext Brian Brock wrote:
> On Tue, Apr 10, 2001 at 10:20:27AM -0400, hesselsp@xxxxxxxxxxxxxxx wrote:
> >
> > one resulting question:
> > can I have two `%post`s?
> >
> > for example:
> > %post --nochroot
> > /usr/bin/cp /mnt/source/file.tgz /mnt/sysimage/
> > %post
> > /usr/sbin/useradd hesselsp
>
> at first glance, I'd say that you can't / shouldn't do that... but I haven't
> tested it myself.
>
> Mainly because %post contains the script that is to be evaluated post-install,
> and --nochroot is an option to %post, interpreted by anaconda, and that %post
> is viewed as a definition of the script.  You've defined %post twice in the
> above example, and I'm not sure how that's interpreted by the installer, or if
> there is defined behavior other than "everything after the %post line is run
> by bash (or the interpeter specified in ks.cfg)".
>
> perhaps doing --nochroot and running `chroot` inside %post as needed would be
> better, I've heard of at least partial success in that case.  You might also
> try running `chroot [new root] [command]` as needed.  Again, I've not tested
> chroot inside the installer myself, but don't see any obvious reasons that it
> should act differently than on a system that's running installed Red Hat Linux.

Here's what I've been using:

%post --nochroot
if [ -e /linuxrc ]; then
        chrootdir="/mnt/sysimage"
        CP="$chrootdir/bin/cp"
        CHROOT="$chrootdir/usr/sbin/chroot"
        # without this DNS stops working after chroot
        $CP /etc/resolv.conf $chrootdir/etc
        $CP /tmp/ks-script $chrootdir/tmp/ks-script
        # so we can find where we were installed from later on
        mount >> ${chrootdir}/tmp/mounts
        chmod 755 ${chrootdir}/tmp/ks-script
        $CHROOT ${chrootdir} /tmp/ks-script
        exit
fi
# chrooted %post begins here

..works beautifully :)

	- Panu -

>
>
> --Brian
>
>
>
>

-- 





[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