Make (hopefully) work with non-gentoo hosts
This commit is contained in:
parent
d0a5559775
commit
795211626e
38
Makefile
38
Makefile
|
@ -20,10 +20,9 @@ M4=m4
|
||||||
M4_DEFS=-D HOSTNAME=$(HOSTNAME)
|
M4_DEFS=-D HOSTNAME=$(HOSTNAME)
|
||||||
M4C=$(M4) $(M4_DEFS)
|
M4C=$(M4) $(M4_DEFS)
|
||||||
NBD_DEV=/dev/nbd0
|
NBD_DEV=/dev/nbd0
|
||||||
|
PKGDIR =
|
||||||
USEPKG=--usepkg --binpkg-respect-use=y
|
USEPKG=--usepkg --binpkg-respect-use=y
|
||||||
PARTED=/usr/sbin/parted
|
RSYNC_MIRROR = rsync://mirrors.rit.edu/gentoo/
|
||||||
PORTAGE=/usr/portage
|
|
||||||
STAGE3=ftp://ftp.osuosl.org/pub/gentoo/releases/$(ARCH)/autobuilds/current-stage3/stage3-$(ARCH)-*.tar.bz2
|
|
||||||
KERNEL=gentoo-sources
|
KERNEL=gentoo-sources
|
||||||
PACKAGE_FILES=$(APPLIANCE)/package.*
|
PACKAGE_FILES=$(APPLIANCE)/package.*
|
||||||
WORLD=$(APPLIANCE)/world
|
WORLD=$(APPLIANCE)/world
|
||||||
|
@ -36,20 +35,16 @@ all: image
|
||||||
$(RAW_IMAGE):
|
$(RAW_IMAGE):
|
||||||
qemu-img create -f raw $(RAW_IMAGE) $(DISK_SIZE)
|
qemu-img create -f raw $(RAW_IMAGE) $(DISK_SIZE)
|
||||||
|
|
||||||
partitions: parted $(RAW_IMAGE)
|
partitions: $(RAW_IMAGE)
|
||||||
$(PARTED) -s -a optimal $(RAW_IMAGE) mklabel msdos
|
parted -s $(RAW_IMAGE) mklabel msdos
|
||||||
$(PARTED) -s -a optimal $(RAW_IMAGE) mkpart primary ext4 0 $(DISK_SIZE)
|
parted -s $(RAW_IMAGE) mkpart primary ext4 0 $(DISK_SIZE)
|
||||||
$(PARTED) -s -a optimal $(RAW_IMAGE) set 1 boot on
|
parted -s $(RAW_IMAGE) set 1 boot on
|
||||||
|
|
||||||
qemu-nbd -c $(NBD_DEV) $(RAW_IMAGE)
|
qemu-nbd -c $(NBD_DEV) $(RAW_IMAGE)
|
||||||
sleep 3
|
sleep 3
|
||||||
mkfs.ext4 $(NBD_DEV)p1
|
mkfs.ext4 $(NBD_DEV)p1
|
||||||
touch partitions
|
touch partitions
|
||||||
|
|
||||||
parted:
|
|
||||||
emerge -n1 $(USEPKG) parted
|
|
||||||
touch parted
|
|
||||||
|
|
||||||
$(CHROOT):
|
$(CHROOT):
|
||||||
mkdir -p $(CHROOT)
|
mkdir -p $(CHROOT)
|
||||||
|
|
||||||
|
@ -62,9 +57,11 @@ mounts: $(CHROOT) stage3
|
||||||
touch mounts
|
touch mounts
|
||||||
|
|
||||||
portage: stage3
|
portage: stage3
|
||||||
if [ ! -e portage ] ; then \
|
rsync -L $(RSYNC_MIRROR)/snapshots/portage-latest.tar.bz2 portage-latest.tar.bz2
|
||||||
mkdir -p $(CHROOT)/usr/portage; \
|
tar xvjf portage-latest.tar.bz2 -C $(CHROOT)/usr
|
||||||
mount -o bind $(PORTAGE) $(CHROOT)/usr/portage; \
|
if [ -n "$(PKGDIR)" ]; then \
|
||||||
|
mkdir -p $(CHROOT)/usr/portage/packages; \
|
||||||
|
mount -o bind "$(PKGDIR)" $(CHROOT)/usr/portage/packages; \
|
||||||
fi
|
fi
|
||||||
touch portage
|
touch portage
|
||||||
|
|
||||||
|
@ -73,13 +70,9 @@ preproot: stage3 mounts portage
|
||||||
touch preproot
|
touch preproot
|
||||||
|
|
||||||
stage3: chroot
|
stage3: chroot
|
||||||
if [ ! -e stage3 ] ; then \
|
rsync $(RSYNC_MIRROR)/releases/$(ARCH)/autobuilds/latest-stage3.txt .
|
||||||
wget -c -q -nc $(STAGE3); \
|
rsync $(RSYNC_MIRROR)/releases/$(ARCH)/autobuilds/`tail -n 1 latest-stage3.txt` .
|
||||||
tar xjpf `/bin/ls -1 stage3-*.tar.bz2|tail -n1` -C $(CHROOT); \
|
stage3=`tail -n 1 latest-stage3.txt` ; tar xjpf `basename $$stage3` -C $(CHROOT)
|
||||||
fi
|
|
||||||
# is it me or does the latest stage3 have python3 as the system
|
|
||||||
# default?!
|
|
||||||
chroot $(CHROOT) eselect python set python2.6
|
|
||||||
touch stage3
|
touch stage3
|
||||||
|
|
||||||
compile_options: make.conf locale.gen $(PACKAGE_FILES)
|
compile_options: make.conf locale.gen $(PACKAGE_FILES)
|
||||||
|
@ -174,6 +167,7 @@ image: $(RAW_IMAGE) grub partitions device-map grub.shell systools software
|
||||||
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/src/linux-*
|
||||||
|
rm -rf gentoo/usr/portage
|
||||||
rm -rf gentoo/tmp/*
|
rm -rf gentoo/tmp/*
|
||||||
rm -rf gentoo/var/tmp/*
|
rm -rf gentoo/var/tmp/*
|
||||||
if [ "$(PRUNE_CRITICAL)" = "YES" ] ; then \
|
if [ "$(PRUNE_CRITICAL)" = "YES" ] ; then \
|
||||||
|
@ -208,7 +202,7 @@ vmdk: $(VMDK_IMAGE)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
for mntpt in \
|
for mntpt in \
|
||||||
$(CHROOT)/usr/portage \
|
$(CHROOT)/usr/portage/packages \
|
||||||
$(CHROOT)/var/tmp \
|
$(CHROOT)/var/tmp \
|
||||||
$(CHROOT)/dev \
|
$(CHROOT)/dev \
|
||||||
$(CHROOT)/proc; do \
|
$(CHROOT)/proc; do \
|
||||||
|
|
Loading…
Reference in New Issue