Initial commit

This commit is contained in:
Albert Hopkins 2010-07-08 23:22:37 -04:00
commit fe5646804c
14 changed files with 1545 additions and 0 deletions

3
.hgignore Normal file
View File

@ -0,0 +1,3 @@
chroot\/.*
loop\/.*
.*\.swp$

180
Makefile Normal file
View File

@ -0,0 +1,180 @@
HOSTNAME=gstable
RAW_IMAGE=$(HOSTNAME).img
QCOW_IMAGE=$(HOSTNAME).qcow
VMDK_IMAGE=$(HOSTNAME).vmdk
VIRTIO=NO
TIMEZONE=UTC
DISK_SIZE=6.0G
SWAP_SIZE=30
CHROOT=chroot
ARCH=amd64
MAKEOPTS=-j4
PRUNE_CRITICAL=NO
INSTALL=install
M4=m4
M4_DEFS=-D HOSTNAME=$(HOSTNAME)
M4C=$(M4) $(M4_DEFS)
USEPKG=--usepkg --binpkg-respect-use=y
PARTED=/usr/sbin/parted
PORTAGE=/portage
DISTFILES=/var/portage/distfiles
STAGE3=ftp://ftp.osuosl.org/pub/gentoo/releases/$(ARCH)/autobuilds/current-stage3/stage3-$(ARCH)-*.tar.bz2
KERNEL=gentoo-sources
all: image
$(RAW_IMAGE):
qemu-img create -f raw $(RAW_IMAGE) $(DISK_SIZE)
partitions: parted $(RAW_IMAGE)
$(PARTED) -s -a optimal $(RAW_IMAGE) mklabel msdos
$(PARTED) -s -a optimal $(RAW_IMAGE) mkpart primary ext4 0 $(DISK_SIZE)
$(PARTED) -s -a optimal $(RAW_IMAGE) set 1 boot on
touch partitions
parted:
emerge -n1 $(USEPKG) parted
touch parted
preproot: stage3
cp -L /etc/resolv.conf $(CHROOT)/etc/
mkdir -p $(CHROOT)/usr/portage
mount -t proc none $(CHROOT)/proc
mount -o bind /dev/ $(CHROOT)/dev
mount -o bind /var/tmp $(CHROOT)/var/tmp
mount -o bind $(PORTAGE) $(CHROOT)/usr/portage
mkdir -p $(CHROOT)/usr/portage/distfiles
mount -o bind $(DISTFILES) $(CHROOT)/usr/portage/distfiles
chroot $(CHROOT) locale-gen
touch preproot
stage3: make.conf package.use package.keywords locale.gen
mkdir -p $(CHROOT)
wget -c -q -nc $(STAGE3)
tar xvjpf stage3-*.tar.bz2 -C $(CHROOT)
cp make.conf $(CHROOT)/etc/make.conf
cp locale.gen $(CHROOT)/etc/locale.gen
mkdir -p $(CHROOT)/etc/portage
cp package.use $(CHROOT)/etc/portage/package.use
cp package.keywords $(CHROOT)/etc/portage/package.keywords
touch stage3
kernel: preproot kernel.config
chroot $(CHROOT) cp /usr/share/zoneinfo/GMT /etc/localtime
chroot $(CHROOT) emerge -N sys-kernel/$(KERNEL)
cp kernel.config $(CHROOT)/usr/src/linux/.config
chroot $(CHROOT) gcc-config 1
chroot $(CHROOT) make $(MAKEOPTS) -C /usr/src/linux oldconfig
chroot $(CHROOT) make $(MAKEOPTS) -C /usr/src/linux
chroot $(CHROOT) make $(MAKEOPTS) -C /usr/src/linux modules_install
chroot $(CHROOT) make $(MAKEOPTS) -C /usr/src/linux install
cd $(CHROOT)/boot ; \
k=`/bin/ls -1 --sort=time vmlinuz-*|head -n 1` ; \
ln -nsf $$k vmlinuz
touch kernel
sysconfig: preproot fstab
cp fstab $(CHROOT)/etc/fstab
if [ "$(VIRTIO)" == "YES" ] ; then \
sed -i 's/sda/vda/' $(CHROOT)/etc/fstab; \
fi
dd if=/dev/zero of=$(CHROOT)/.swap bs=1M count=$(SWAP_SIZE)
/sbin/mkswap $(CHROOT)/.swap
echo HOSTNAME=$(HOSTNAME) > $(CHROOT)/etc/conf.d/hostname
sed -i 's/^#TIMEZONE=.*/TIMEZONE="$(TIMEZONE)"/' $(CHROOT)/etc/conf.d/clock
echo 'config_eth0=( "dhcp" )' > $(CHROOT)/etc/conf.d/net
chroot $(CHROOT) rc-update add net.eth0 default
echo "127.0.0.1 $(HOSTNAME) localhost" > $(CHROOT)/etc/hosts
touch sysconfig
systools: sysconfig world etc-update.conf
chroot $(CHROOT) emerge -n $(USEPKG) syslog-ng
chroot $(CHROOT) rc-update add syslog-ng default
chroot $(CHROOT) emerge -DN $(USEPKG) system
chroot $(CHROOT) emerge -Nn $(USEPKG) `cat world`
#chroot $(CHROOT) emerge -DuN $(USEPKG) world
chroot $(CHROOT) emerge --depclean --with-bdeps=n
chroot $(CHROOT) emerge -1n app-portage/gentoolkit
cp etc-update.conf $(CHROOT)/etc/
chroot $(CHROOT) revdep-rebuild -i
chroot $(CHROOT) etc-update
chroot $(CHROOT) emerge -C gentoolkit
touch systools
grub: preproot grub.conf kernel
chroot $(CHROOT) emerge -nN $(USEPKG) sys-boot/grub
cp grub.conf $(CHROOT)/boot/grub/grub.conf
if [ "$(VIRTIO)" == "YES" ] ; then \
sed -i 's/sda/vda/' $(CHROOT)/boot/grub/grub.conf ; \
fi
touch grub
software: systools issue critical
cp issue $(CHROOT)/etc/issue
chroot $(CHROOT) emerge --depclean --with-bdeps=n
chroot $(CHROOT) gcc-config 1
chroot $(CHROOT) passwd -d root
chroot $(CHROOT) passwd -e root
if [ "$(PRUNE_CRITICAL)" = "YES" ] ; then \
chroot $(CHROOT) emerge -C `cat critical` ; \
fi
touch software
device-map: $(RAW_IMAGE)
echo '(hd0) ' $(RAW_IMAGE) > device-map
image: $(RAW_IMAGE) partitions systools grub software device-map grub.shell
mkdir -p loop
qemu-nbd -c /dev/nbd1 $(RAW_IMAGE)
sleep 3
mkfs.ext4 /dev/nbd1p1
mount /dev/nbd1p1 loop/
mkdir -p gentoo
mount -o bind $(CHROOT) gentoo
rm -rf gentoo/usr/src/linux-*
rm -rf gentoo/tmp/*
rm -rf gentoo/var/tmp/*
if [ "$(PRUNE_CRITICAL)" = "YES" ] ; then \
rm -rf gentoo/usr/lib/python*/test ; \
rm -rf gentoo/usr/share/gtk-doc ; \
rm -rf gentoo/var/db/pkg ; \
rm -rf gentoo/usr/lib/perl* ; \
fi
rsync -ax gentoo/ loop/
loop/sbin/grub --device-map=device-map --no-floppy --batch < grub.shell
umount loop
umount gentoo
sleep 3
rmdir loop
rm -rf gentoo
qemu-nbd -d /dev/nbd1
touch image
$(QCOW_IMAGE): $(RAW_IMAGE) image
qemu-img convert -f raw -O qcow2 -c $(RAW_IMAGE) $(QCOW_IMAGE)
qcow: $(QCOW_IMAGE)
$(VMDK_IMAGE): $(RAW_IMAGE) image
qemu-img convert -f raw -O vmdk $(RAW_IMAGE) $(VMDK_IMAGE)
vmdk: $(VMDK_IMAGE)
.PHONY: qcow vmdk clean
clean:
umount $(CHROOT)/usr/portage/distfiles $(CHROOT)/usr/portage $(CHROOT)/var/tmp $(CHROOT)/dev $(CHROOT)/proc || true
rm -f parted grub stage3 software preproot sysconfig systools image kernel partitions device-map
rm -rf loop
rm -rf gentoo
rm -rf $(CHROOT)
realclean: clean
rm -f $(RAW_IMAGE) $(QCOW_IMAGE) $(VMDK_IMAGE)

36
critical Normal file
View File

@ -0,0 +1,36 @@
app-editors/nano
net-misc/openssh
net-misc/rsync
net-misc/wget
sys-kernel/gentoo-sources
sys-kernel/linux-headers
sys-devel/gcc
sys-devel/automake
sys-devel/bison
sys-devel/make
sys-devel/flex
sys-devel/automake-wrapper
sys-devel/autoconf-wrapper
sys-devel/autoconf
sys-devel/m4
sys-devel/gcc-config
sys-devel/libtool
sys-devel/binutils
sys-devel/binutils-config
sys-devel/patch
sys-devel/gnuconfig
app-admin/python-updater
app-admin/perl-cleaner
sys-apps/man-pages
sys-apps/man
sys-apps/file
sys-apps/less
sys-apps/texinfo
sys-apps/busybox
sys-apps/debianutils
sys-apps/man-pages-posix
sys-apps/sandbox
sys-apps/which
dev-lang/perl
sys-devel/libperl
sys-apps/portage

75
etc-update.conf Normal file
View File

@ -0,0 +1,75 @@
# /etc/etc-update.conf: config file for `etc-update` utility
# edit the lines below to your liking
# mode - 0 for text, 1 for menu (support incomplete)
# note that you need dev-util/dialog installed
mode="0"
# Whether trivial/comment changes should be automerged
eu_automerge="yes"
# arguments used whenever rm is called
rm_opts=""
# arguments used whenever mv is called
mv_opts=""
# arguments used whenever cp is called
cp_opts=""
# pager for use with diff commands
#pager=""
# For emacs-users (see NOTE_2)
# diff_command="eval emacs -nw --eval=\'\(ediff\ \"%file1\"\ \"%file2\"\)\'"
#using_editor=1
# vim-users: you CAN use vimdiff for diff_command. (see NOTE_1 and NOTE_2)
#diff_command="vim -d %file1 %file2"
#using_editor=1
diff_command="diff -uN %file1 %file2"
using_editor=0
# vim-users: don't use vimdiff for merging (see NOTE_1)
merge_command="sdiff -s -o %merged %orig %new"
# EXPLANATION
#
# pager:
#
# Examples of pager usage:
# pager="" # don't use a pager
# pager="less -E" # less
# pager="more" # more
#
#
# diff_command:
#
# Arguments:
# %file1 [REQUIRED]
# %file2 [REQUIRED]
#
# Examples of diff_command:
# diff_command="diff -uN %file1 %file2" # diff
# diff_command="vim -d %file1 %file2" # vimdiff
#
#
# merge_command:
#
# Arguments:
# %orig [REQUIRED]
# %new [REQUIRED]
# %merged [REQUIRED]
#
# Examples of merge_command:
# merge_command="sdiff -s -o %merged %old %new" # sdiff
#
# NOTE_1: Editors such as vim/vimdiff are not usable for the merge_command
# because it is not known what filenames the produced files have (the user can
# choose while using those programs)
# NOTE_2: Make sure using_editor is set to "1" when using an editor as
# diff_command!

4
fstab Normal file
View File

@ -0,0 +1,4 @@
# <fs> <mountpoint> <type> <opts> <dump/pass>
/dev/vda1 / ext4 noatime 1 1
/.swap none swap sw 0 0
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0

7
grub.conf Normal file
View File

@ -0,0 +1,7 @@
default 0
timeout 5
title Gentoo Linux
root (hd0,0)
kernel /boot/vmlinuz root=/dev/sda1

4
grub.shell Normal file
View File

@ -0,0 +1,4 @@
root (hd0,0)
setup (hd0)
quit

6
issue Normal file
View File

@ -0,0 +1,6 @@

------------------------------------------------------------------------------
Gentoo Virtual Machine
------------------------------------------------------------------------------

1185
kernel.config Normal file

File diff suppressed because it is too large Load Diff

31
locale.gen Normal file
View File

@ -0,0 +1,31 @@
# /etc/locale.gen: list all of the locales you want to have on your system
#
# The format of each line:
# <locale> <charmap>
#
# Where <locale> is a locale located in /usr/share/i18n/locales/ and
# where <charmap> is a charmap located in /usr/share/i18n/charmaps/.
#
# All blank lines and lines starting with # are ignored.
#
# For the default list of supported combinations, see the file:
# /usr/share/i18n/SUPPORTED
#
# Whenever glibc is emerged, the locales listed here will be automatically
# rebuilt for you. After updating this file, you can simply run `locale-gen`
# yourself instead of re-emerging glibc.
en_US ISO-8859-1
en_US.UTF-8 UTF-8
#ja_JP.EUC-JP EUC-JP
#ja_JP.UTF-8 UTF-8
#ja_JP EUC-JP
#en_HK ISO-8859-1
#en_PH ISO-8859-1
#de_DE ISO-8859-1
#de_DE@euro ISO-8859-15
#es_MX ISO-8859-1
#fa_IR UTF-8
#fr_FR ISO-8859-1
#fr_FR@euro ISO-8859-15
#it_IT ISO-8859-1

10
make.conf Normal file
View File

@ -0,0 +1,10 @@
CFLAGS="-O2 -pipe"
CXXFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
MAKEOPTS="-j4"
USE="-* nptl pam unicode"
CLEAN_DELAY="0"
AUTO_CLEAN="yes"
EPAUSE_IGNORE="1"
EMERGE_DEFAULT_OPTS="--jobs=4"
FEATURES="noinfo -test nodoc noman unmerge-orphans buildpkg"

0
package.keywords Normal file
View File

3
package.use Normal file
View File

@ -0,0 +1,3 @@
app-editors/nano ncurses
dev-lang/python ssl threads xml
sys-kernel/gentoo-sources symlink

1
world Normal file
View File

@ -0,0 +1 @@
net-misc/dhcpcd