* Use rsync --exclude-from instead of copying and removing

* Made a change so that "make -j2" works
This commit is contained in:
Albert Hopkins 2010-11-05 01:53:07 -04:00
parent 4f2bcd184e
commit 7a21aed5fe
4 changed files with 21 additions and 18 deletions

View File

@ -1,6 +1,7 @@
chroot\/.* chroot\/.*
gentoo\/.*
loop\/.* loop\/.*
.*\.swp$ .*\.swp$
Makefile\.[^(inc)] Makefile\.[^(inc)]
stage3-.*\.tar\.bz2 latest-stage3\.txt
portage-latest\.tar\.bz2
stage3-.*-\d{8}.tar.bz2

View File

@ -59,7 +59,7 @@ mounts: $(CHROOT) stage3
portage: stage3 portage: stage3
rsync -L $(RSYNC_MIRROR)/snapshots/portage-latest.tar.bz2 portage-latest.tar.bz2 rsync -L $(RSYNC_MIRROR)/snapshots/portage-latest.tar.bz2 portage-latest.tar.bz2
tar xvjf portage-latest.tar.bz2 -C $(CHROOT)/usr tar xjf portage-latest.tar.bz2 -C $(CHROOT)/usr
if [ -n "$(PKGDIR)" ]; then \ if [ -n "$(PKGDIR)" ]; then \
mkdir -p $(CHROOT)/usr/portage/packages; \ mkdir -p $(CHROOT)/usr/portage/packages; \
mount -o bind "$(PKGDIR)" $(CHROOT)/usr/portage/packages; \ mount -o bind "$(PKGDIR)" $(CHROOT)/usr/portage/packages; \
@ -76,7 +76,7 @@ stage3: chroot
stage3=`tail -n 1 latest-stage3.txt` ; tar xjpf `basename $$stage3` -C $(CHROOT) stage3=`tail -n 1 latest-stage3.txt` ; tar xjpf `basename $$stage3` -C $(CHROOT)
touch stage3 touch stage3
compile_options: make.conf locale.gen $(PACKAGE_FILES) compile_options: portage make.conf locale.gen $(PACKAGE_FILES)
cp make.conf $(CHROOT)/etc/make.conf cp make.conf $(CHROOT)/etc/make.conf
echo ACCEPT_KEYWORDS=$(ACCEPT_KEYWORDS) >> $(CHROOT)/etc/make.conf echo ACCEPT_KEYWORDS=$(ACCEPT_KEYWORDS) >> $(CHROOT)/etc/make.conf
cp locale.gen $(CHROOT)/etc/locale.gen cp locale.gen $(CHROOT)/etc/locale.gen
@ -92,7 +92,7 @@ base_system: mounts compile_options
$(CHROOT)/boot/vmlinuz: base_system $(KERNEL_CONFIG) $(CHROOT)/boot/vmlinuz: base_system $(KERNEL_CONFIG)
chroot $(CHROOT) cp /usr/share/zoneinfo/$(TIMEZONE) /etc/localtime chroot $(CHROOT) cp /usr/share/zoneinfo/$(TIMEZONE) /etc/localtime
chroot $(CHROOT) emerge -N sys-kernel/$(KERNEL) chroot $(CHROOT) emerge -n $(USEPKG) sys-kernel/$(KERNEL)
cp $(KERNEL_CONFIG) $(CHROOT)/usr/src/linux/.config cp $(KERNEL_CONFIG) $(CHROOT)/usr/src/linux/.config
chroot $(CHROOT) gcc-config 1 chroot $(CHROOT) gcc-config 1
chroot $(CHROOT) make $(MAKEOPTS) -C /usr/src/linux oldconfig chroot $(CHROOT) make $(MAKEOPTS) -C /usr/src/linux oldconfig
@ -166,27 +166,20 @@ device-map: $(RAW_IMAGE)
image: $(RAW_IMAGE) grub partitions device-map grub.shell systools software image: $(RAW_IMAGE) grub partitions device-map grub.shell systools software
mkdir -p loop mkdir -p loop
mount $(NBD_DEV)p1 loop/ mount -o noatime $(NBD_DEV)p1 loop
mkdir -p gentoo mkdir -p gentoo
mount -o bind $(CHROOT) gentoo mount -o bind $(CHROOT) gentoo
rm -rf gentoo/usr/src/linux-*
rm -rf gentoo/usr/portage
rm -rf gentoo/tmp/*
rm -rf gentoo/var/tmp/*
if [ "$(PRUNE_CRITICAL)" = "YES" ] ; then \ if [ "$(PRUNE_CRITICAL)" = "YES" ] ; then \
rm -rf gentoo/usr/lib/python*/test ; \ rsync -ax --exclude-from=rsync-excludes --exclude-from=rsync-excludes-critical gentoo/ loop/ ; \
rm -rf gentoo/usr/share/gtk-doc ; \ else \
rm -rf gentoo/var/db/pkg ; \ rsync -ax --exclude-from=rsync-excludes gentoo/ loop/ ; \
rm -rf gentoo/usr/lib/perl* ; \
rm -f gentoo/usr/bin/python*; \
fi fi
rsync -ax gentoo/ loop/
loop/sbin/grub --device-map=device-map --no-floppy --batch < grub.shell loop/sbin/grub --device-map=device-map --no-floppy --batch < grub.shell
umount loop
umount gentoo umount gentoo
rmdir gentoo
umount loop
sleep 3 sleep 3
rmdir loop rmdir loop
rm -rf gentoo
qemu-nbd -d $(NBD_DEV) qemu-nbd -d $(NBD_DEV)
touch image touch image

5
rsync-excludes Normal file
View File

@ -0,0 +1,5 @@
usr/src/linux-*
usr/portage
tmp/*
var/tmp/*

4
rsync-excludes-critical Normal file
View File

@ -0,0 +1,4 @@
usr/lib/python*/test
usr/share/gtk-doc
var/db/pkg
usr/lib/perl*