diff --git a/.hgignore b/.hgignore index b5072da..3f7ae11 100644 --- a/.hgignore +++ b/.hgignore @@ -1,7 +1,7 @@ -chroot\/.* +vabuild\/.* loop\/.* .*\.swp$ -Makefile\.[^(inc)] +.*\.cfg latest-stage3\.txt portage-latest\.tar\.bz2 stage3-.*-latest\.tar\.bz2 diff --git a/Makefile b/Makefile index ac71ccb..78ee224 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,64 @@ - -APPLIANCE=base -HOSTNAME=$(APPLIANCE) -RAW_IMAGE=$(HOSTNAME).img -QCOW_IMAGE=$(HOSTNAME).qcow -VMDK_IMAGE=$(HOSTNAME).vmdk +CHROOT=./vabuild +APPLIANCE = base +HOSTNAME = $(APPLIANCE) +RAW_IMAGE = $(HOSTNAME).img +QCOW_IMAGE = $(HOSTNAME).qcow +VMDK_IMAGE = $(HOSTNAME).vmdk KERNEL_CONFIG = kernel.config -VIRTIO=NO -TIMEZONE=UTC -DISK_SIZE=6.0G -SWAP_SIZE=30 -CHROOT=chroot -ARCH=amd64 -MAKEOPTS=-j4 -PRUNE_CRITICAL=NO -HEADLESS=NO -ACCEPT_KEYWORDS="amd64" +VIRTIO = NO +TIMEZONE = UTC +DISK_SIZE = 6.0G +SWAP_SIZE = 30 +SWAP_FILE = $(CHROOT)/.swap +ARCH = amd64 +MAKEOPTS = -j4 +PRUNE_CRITICAL = NO +HEADLESS = NO +ACCEPT_KEYWORDS = amd64 -INSTALL=install -M4=m4 -M4_DEFS=-D HOSTNAME=$(HOSTNAME) -M4C=$(M4) $(M4_DEFS) -NBD_DEV=/dev/nbd0 -PKGDIR = -USEPKG=--usepkg --binpkg-respect-use=y +M4 = m4 +EMERGE = /usr/bin/emerge +M4_DEFS = -D HOSTNAME=$(HOSTNAME) +M4C = $(M4) $(M4_DEFS) +NBD_DEV = /dev/nbd0 +USEPKG = --usepkg --binpkg-respect-use=y RSYNC_MIRROR = rsync://mirrors.rit.edu/gentoo/ -KERNEL=gentoo-sources -PACKAGE_FILES=$(APPLIANCE)/package.* -WORLD=$(APPLIANCE)/world -CRITICAL=$(APPLIANCE)/critical +KERNEL = gentoo-sources +PACKAGE_FILES = $(APPLIANCE)/package.* +WORLD = $(APPLIANCE)/world +CRITICAL = $(APPLIANCE)/critical -include $(APPLIANCE)/Makefile.inc +-include $(PROFILE).cfg + +ifneq ($(PKGDIR),) + MOUNT_PKGDIR = mkdir -p $(CHROOT)/var/portage/packages; \ + mount -o bind "$(PKGDIR)" $(CHROOT)/var/portage/packages + UMOUNT_PKGDIR = umount $(CHROOT)/var/portage/packages + ADD_PKGDIR = echo PKGDIR="/var/portage/packages" >> $(CHROOT)/etc/make.conf +endif + +ifeq ($(PRUNE_CRITICAL),YES) + COPY_LOOP = rsync -ax --exclude-from=rsync-excludes \ + --exclude-from=rsync-excludes-critical gentoo/ loop/ + UNMERGE_CRITICAL = chroot $(CHROOT) $(EMERGE) -C `cat $(CRITICAL)` +else + COPY_LOOP = rsync -ax --exclude-from=rsync-excludes gentoo/ loop/ +endif + +ifeq ($(VIRTIO),YES) + VIRTIO_FSTAB = sed -i 's/sda/vda/' $(CHROOT)/etc/fstab + VIRTIO_GRUB = sed -i 's/sda/vda/' $(CHROOT)/boot/grub/grub.conf +endif + +ifeq ($(HEADLESS),YES) + HEADLESS_INITTAB = sed -ri 's/^(c[0-9]:)/\#\1/' $(CHROOT)/etc/inittab + HEADLESS_GRUB = sed -i -f grub-headless.sed $(CHROOT)/boot/grub/grub.conf +endif + +export APPLIANCE ACCEPT_KEYWORDS CHROOT EMERGE HEADLESS M4 M4C +export HOSTNAME MAKEOPTS PRUNE_CRITICAL TIMEZONE USEPKG WORLD + +unexport PKGDIR ARCH NBD_DEV all: image @@ -37,16 +66,17 @@ $(RAW_IMAGE): qemu-img create -f raw $(RAW_IMAGE) $(DISK_SIZE) partitions: $(RAW_IMAGE) - parted -s $(RAW_IMAGE) mklabel msdos - parted -s $(RAW_IMAGE) mkpart primary ext2 0 $(DISK_SIZE) - parted -s $(RAW_IMAGE) set 1 boot on + parted -s $(RAW_IMAGE) mklabel msdos + parted -s $(RAW_IMAGE) mkpart primary ext2 0 $(DISK_SIZE) + parted -s $(RAW_IMAGE) set 1 boot on qemu-nbd -c $(NBD_DEV) $(RAW_IMAGE) sleep 3 mkfs.ext2 -O sparse_super -L "$(APPLIANCE)" $(NBD_DEV)p1 touch partitions -mounts: $(CHROOT) stage3 +mounts: stage3 + mkdir -p $(CHROOT) if [ ! -e mounts ] ; then \ mount -t proc none $(CHROOT)/proc; \ mount -o bind /dev $(CHROOT)/dev; \ @@ -55,12 +85,10 @@ mounts: $(CHROOT) stage3 touch mounts portage: stage3 - rsync -L $(RSYNC_MIRROR)/snapshots/portage-latest.tar.bz2 portage-latest.tar.bz2 + rsync --no-motd -L $(RSYNC_MIRROR)/snapshots/portage-latest.tar.bz2 portage-latest.tar.bz2 tar xjf portage-latest.tar.bz2 -C $(CHROOT)/usr - if [ -n "$(PKGDIR)" ]; then \ - mkdir -p $(CHROOT)/usr/portage/packages; \ - mount -o bind "$(PKGDIR)" $(CHROOT)/usr/portage/packages; \ - fi + $(MOUNT_PKGDIR) + chroot $(CHROOT) $(EMERGE) -un $(USEPKG) sys-apps/portage touch portage preproot: stage3 mounts portage @@ -69,13 +97,14 @@ preproot: stage3 mounts portage stage3: mkdir -p $(CHROOT) - rsync $(RSYNC_MIRROR)/releases/`echo $(ARCH)|sed 's/i.86/x86/'`/autobuilds/latest-stage3.txt . - rsync $(RSYNC_MIRROR)/releases/`echo $(ARCH)|sed 's/i.86/x86/'`/autobuilds/`tail -n 1 latest-stage3.txt` stage3-$(ARCH)-latest.tar.bz2 + rsync --no-motd $(RSYNC_MIRROR)/releases/`echo $(ARCH)|sed 's/i.86/x86/'`/autobuilds/latest-stage3.txt . + rsync --no-motd $(RSYNC_MIRROR)/releases/`echo $(ARCH)|sed 's/i.86/x86/'`/autobuilds/`tail -n 1 latest-stage3.txt` stage3-$(ARCH)-latest.tar.bz2 tar xjpf stage3-$(ARCH)-latest.tar.bz2 -C $(CHROOT) touch stage3 compile_options: portage make.conf locale.gen $(PACKAGE_FILES) cp make.conf $(CHROOT)/etc/make.conf + $(ADD_PKGDIR) echo ACCEPT_KEYWORDS=$(ACCEPT_KEYWORDS) >> $(CHROOT)/etc/make.conf cp locale.gen $(CHROOT)/etc/locale.gen chroot $(CHROOT) locale-gen @@ -90,7 +119,7 @@ base_system: mounts compile_options $(CHROOT)/boot/vmlinuz: base_system $(KERNEL_CONFIG) chroot $(CHROOT) cp /usr/share/zoneinfo/$(TIMEZONE) /etc/localtime - chroot $(CHROOT) emerge -n $(USEPKG) sys-kernel/$(KERNEL) + chroot $(CHROOT) $(EMERGE) -n $(USEPKG) 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 @@ -101,67 +130,68 @@ $(CHROOT)/boot/vmlinuz: base_system $(KERNEL_CONFIG) k=`/bin/ls -1 --sort=time vmlinuz-*|head -n 1` ; \ ln -nsf $$k vmlinuz -sysconfig: preproot fstab +$(SWAP_FILE): preproot + dd if=/dev/zero of=$(SWAP_FILE) bs=1M count=$(SWAP_SIZE) + /sbin/mkswap $(SWAP_FILE) + +$(CHROOT)/etc/fstab: fstab preproot 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 + +$(CHROOT)/etc/conf.d/hostname: preproot echo HOSTNAME=$(HOSTNAME) > $(CHROOT)/etc/conf.d/hostname + +$(CHROOT)/etc/conf.d/clock: preproot sed -i 's/^#TIMEZONE=.*/TIMEZONE="$(TIMEZONE)"/' $(CHROOT)/etc/conf.d/clock + +sysconfig: preproot $(SWAP_FILE) $(CHROOT)/etc/fstab $(CHROOT)/etc/conf.d/hostname $(CHROOT)/etc/conf.d/clock + @echo $(VIRTIO) + $(VIRTIO_FSTAB) sed -i 's/^#s0:/s0:/' $(CHROOT)/etc/inittab - if [ "$(HEADLESS)" == "YES" ] ; then \ - sed -i 's/^\(c[0-9]:\)/#\1/' $(CHROOT)/etc/inittab ; \ - fi + $(HEADLESS_INITTAB) echo 'config_eth0=( "dhcp" )' > $(CHROOT)/etc/conf.d/net chroot $(CHROOT) rc-update add net.eth0 default chroot $(CHROOT) rc-update del consolefont boot touch sysconfig systools: sysconfig compile_options - chroot $(CHROOT) emerge -n $(USEPKG) app-admin/syslog-ng + chroot $(CHROOT) $(EMERGE) -n $(USEPKG) app-admin/syslog-ng chroot $(CHROOT) rc-update add syslog-ng default - chroot $(CHROOT) emerge -n $(USEPKG) sys-power/acpid + chroot $(CHROOT) $(EMERGE) -n $(USEPKG) sys-power/acpid chroot $(CHROOT) rc-update add acpid default - chroot $(CHROOT) emerge -n $(USEPKG) net-misc/dhcpcd + chroot $(CHROOT) $(EMERGE) -n $(USEPKG) net-misc/dhcpcd touch systools grub: systools grub.conf $(CHROOT)/boot/vmlinuz - chroot $(CHROOT) emerge -nN $(USEPKG) sys-boot/grub + 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 - if [ "$(HEADLESS)" == "YES" ] ; then \ - sed -i -f grub-headless.sed $(CHROOT)/boot/grub/grub.conf ; \ - fi + $(VIRTIO_GRUB) + $(HEADLESS_GRUB) touch grub software: systools issue etc-update.conf $(CRITICAL) $(WORLD) - $(preinstall) + $(MAKE) -C $(APPLIANCE) preinstall cp etc-update.conf $(CHROOT)/etc/ # some packages, like, tar need xz-utils to unpack, but it not part of # the stage3 so may not be installed yet - chroot $(CHROOT) emerge -1n $(USEPKG) app-arch/xz-utils + chroot $(CHROOT) $(EMERGE) -1n $(USEPKG) app-arch/xz-utils - chroot $(CHROOT) emerge $(USEPKG) --update --newuse --deep `cat $(WORLD)` + chroot $(CHROOT) $(EMERGE) $(USEPKG) --update --newuse --deep `cat $(WORLD)` + chroot $(CHROOT) gcc-config 1 # Need gentoolkit to run revdep-rebuild - chroot $(CHROOT) emerge -1n $(USEPKG) app-portage/gentoolkit + chroot $(CHROOT) $(EMERGE) -1n $(USEPKG) app-portage/gentoolkit chroot $(CHROOT) revdep-rebuild -i cp issue $(CHROOT)/etc/issue - chroot $(CHROOT) emerge --depclean --with-bdeps=n - chroot $(CHROOT) etc-update chroot $(CHROOT) gcc-config 1 - $(postinstall) + chroot $(CHROOT) $(EMERGE) $(USEPKG) --update --newuse --deep world + chroot $(CHROOT) $(EMERGE) --depclean --with-bdeps=n + chroot $(CHROOT) etc-update + $(MAKE) -C $(APPLIANCE) postinstall chroot $(CHROOT) passwd -d root chroot $(CHROOT) passwd -e root - if [ "$(PRUNE_CRITICAL)" = "YES" ] ; then \ - chroot $(CHROOT) emerge -C `cat $(CRITICAL)` ; \ - fi + $(UNMERGE_CRITICAL) touch software device-map: $(RAW_IMAGE) @@ -172,11 +202,7 @@ image: $(RAW_IMAGE) grub partitions device-map grub.shell systools software mount -o noatime $(NBD_DEV)p1 loop mkdir -p gentoo mount -o bind $(CHROOT) gentoo - if [ "$(PRUNE_CRITICAL)" = "YES" ] ; then \ - rsync -ax --exclude-from=rsync-excludes --exclude-from=rsync-excludes-critical gentoo/ loop/ ; \ - else \ - rsync -ax --exclude-from=rsync-excludes gentoo/ loop/ ; \ - fi + $(COPY_LOOP) loop/sbin/grub --device-map=device-map --no-floppy --batch < grub.shell umount gentoo rmdir gentoo @@ -198,13 +224,15 @@ $(VMDK_IMAGE): $(RAW_IMAGE) image vmdk: $(VMDK_IMAGE) umount: - umount -l $(CHROOT)/usr/portage/packages - umount -l $(CHROOT)/var/tmp - umount -l $(CHROOT)/dev - umount -l $(CHROOT)/proc + $(UMOUNT_PKGDIR) + umount $(CHROOT)/var/tmp + umount $(CHROOT)/dev + umount $(CHROOT)/proc + touch umount remove_checkpoints: rm -f mounts compile_options base_system portage + rm -f umount rm -f parted grub stage3 software preproot sysconfig systools image partitions device-map clean: umount remove_checkpoints @@ -213,11 +241,11 @@ clean: umount remove_checkpoints rm -rf $(CHROOT) realclean: clean - rm -f $(RAW_IMAGE) $(QCOW_IMAGE) $(VMDK_IMAGE) + ${RM} $(RAW_IMAGE) $(QCOW_IMAGE) $(VMDK_IMAGE) distclean: rm -f *.qcow *.img *.vmdk rm -f latest-stage3.txt stage3-*-latest.tar.bz2 rm -f portage-latest.tar.bz2 -.PHONY: qcow vmdk clean umount realclean distclean remove_checkpoints +.PHONY: qcow vmdk clean realclean distclean remove_checkpoints diff --git a/base/Makefile b/base/Makefile new file mode 100644 index 0000000..d7bb5b4 --- /dev/null +++ b/base/Makefile @@ -0,0 +1,6 @@ +preinstall: + +postinstall: + +clean: + diff --git a/base/Makefile.inc b/base/Makefile.inc deleted file mode 100644 index 158b4f6..0000000 --- a/base/Makefile.inc +++ /dev/null @@ -1,2 +0,0 @@ -preinstall = -postinstall = diff --git a/gnome/Makefile b/gnome/Makefile new file mode 100644 index 0000000..fbc9589 --- /dev/null +++ b/gnome/Makefile @@ -0,0 +1,27 @@ + +ifneq ($(OVERLAY),YES) + DO_OVERLAY = \# +endif + +# totem gst-inspect requires a machine id (generated by dbus). we +# don't have one yet because we are in a virgin chroot. fake one +preinstall: + mkdir -p "$(CHROOT)/var/lib/dbus" + echo 1234567890abcdef1234567890abcdef > \ + "$(CHROOT)"/var/lib/dbus/machine-id + chroot "$(CHROOT)" $(EMERGE) $(USEPKG)-1n dev-util/pkgconfig + $(DO_OVERLAY) chroot $(CHROOT) $(EMERGE) $(USEPKG) -1n app-portage/layman + $(DO_OVERLAY) chroot $(CHROOT) $(EMERGE) $(USEPKG) -1n dev-vcs/git + $(DO_OVERLAY) chroot $(CHROOT) /usr/bin/layman --sync ALL + $(DO_OVERLAY) chroot $(CHROOT) /usr/bin/layman --add gnome + $(DO_OVERLAY) echo "source /var/lib/layman/make.conf" >> $(CHROOT)/etc/make.conf + $(DO_OVERLAY) echo USE='"$$USE clutter"' >> $(CHROOT)/etc/make.conf + +postinstall: custom.conf + $(RM) "$(CHROOT)"/var/lib/dbus/machine-id + cp custom.conf "$(CHROOT)"/etc/X11/gdm/custom.conf + #chroot "$(CHROOT)" rc-update add hald default + echo 'gdm &>/dev/null' >> "$(CHROOT)"/etc/conf.d/local.start + +clean: + diff --git a/gnome/Makefile.inc b/gnome/Makefile.inc deleted file mode 100644 index 0e4f1be..0000000 --- a/gnome/Makefile.inc +++ /dev/null @@ -1,22 +0,0 @@ -OVERLAY = NO - -# totem gst-inspect requires a machine id (generated by dbus). we -# don't have one yet because we are in a virgin chroot. fake one -preinstall = mkdir -p "$(CHROOT)/var/lib/dbus"; \ - echo 1234567890abcdef1234567890abcdef \ - > "$(CHROOT)"/var/lib/dbus/machine-id; \ - chroot "$(CHROOT)" emerge -1n dev-util/pkgconfig; \ - if [ "$(OVERLAY)" == "YES" ] ; then \ - chroot $(CHROOT) emerge -1n app-portage/layman; \ - chroot $(CHROOT) emerge -1n dev-vcs/git; \ - chroot $(CHROOT) /usr/bin/layman --sync ALL; \ - chroot $(CHROOT) /usr/bin/layman --add gnome; \ - echo "source /var/lib/layman/make.conf" >> \ - $(CHROOT)/etc/make.conf; \ - echo USE='"$$USE clutter"' >> $(CHROOT)/etc/make.conf; \ - fi; - -postinstall = rm -f "$(CHROOT)"/var/lib/dbus/machine-id; \ - cp "$(APPLIANCE)"/custom.conf "$(CHROOT)"/etc/X11/gdm/custom.conf; \ - chroot "$(CHROOT)" rc-update add hald default; \ - echo 'gdm &>/dev/null' >> "$(CHROOT)"/etc/conf.d/local.start; diff --git a/gnome/package.use b/gnome/package.use index 14a602f..2ea3355 100644 --- a/gnome/package.use +++ b/gnome/package.use @@ -23,7 +23,7 @@ x11-libs/pango X mail-client/evolution ssl gnome-extra/evolution-data-server ssl -net-libs/xulrunner cups -net-print/cups gnutls -app-text/poppler utils -app-text/ghostscript-gpl cups +#net-libs/xulrunner cups +#net-print/cups gnutls +#app-text/poppler utils +#app-text/ghostscript-gpl cups diff --git a/kde/Makefile b/kde/Makefile new file mode 100644 index 0000000..3a323ce --- /dev/null +++ b/kde/Makefile @@ -0,0 +1,18 @@ + +preinstall: + echo 'USE="$$USE qt3support xcomposite opengl"' >> "$(CHROOT)"/etc/make.conf; + +postinstall: kdmrc Xaccess + cp kdmrc Xaccess "$(CHROOT)"/usr/share/config/kdm + chroot "$(CHROOT)" rc-update add dbus default + if [ -e "$(CHROOT)"/etc/conf.d/xdm ]; then \ + sed -i 's/^DISPLAYMANAGER=.*/DISPLAYMANAGER="kdm"/' \ + "$(CHROOT)"/etc/conf.d/xdm; \ + chroot "$(CHROOT)" rc-update add xdm default; \ + else \ + echo "/usr/bin/kdm -daemon" >> "$(CHROOT)"/etc/conf.d/local.start; \ + fi + +clean: + + diff --git a/kde/Makefile.inc b/kde/Makefile.inc deleted file mode 100644 index c5e6c04..0000000 --- a/kde/Makefile.inc +++ /dev/null @@ -1,13 +0,0 @@ -preinstall = echo 'USE="$$USE qt3support xcomposite opengl"' >> \ - "$(CHROOT)"/etc/make.conf; - -postinstall = cp "$(APPLIANCE)"/kdmrc "$(APPLIANCE)"/Xaccess \ - "$(CHROOT)"/usr/share/config/kdm; \ - chroot "$(CHROOT)" rc-update add dbus default; \ - if [ -e "$(CHROOT)"/etc/conf.d/xdm ] ; then \ - sed -i 's/^DISPLAYMANAGER=.*/DISPLAYMANAGER="kdm"/' \ - "$(CHROOT)"/etc/conf.d/xdm; \ - chroot "$(CHROOT)" rc-update add xdm default; \ - else \ - echo "/usr/bin/kdm -daemon" >> "$(CHROOT)"/etc/conf.d/local.start; \ - fi diff --git a/lodgeit/Makefile b/lodgeit/Makefile new file mode 100644 index 0000000..c064048 --- /dev/null +++ b/lodgeit/Makefile @@ -0,0 +1,28 @@ +# set up apache modules in make.conf + +POST_FILES = lodgeit.sh 10_lodgeit.conf apache2.conf genkey.py lodgeit.wsgi +POST_FILES += issue + +preinstall: make.conf.extra + cat make.conf.extra >> $(CHROOT)/etc/make.conf + +postinstall: $(POST_FILES) + chroot $(CHROOT) $(EMERGE) -1n $(USEPKG) dev-vcs/mercurial + chroot $(CHROOT) $(EMERGE) -1n $(USEPKG) dev-python/virtualenv + chroot $(CHROOT) getent group lodgeit || chroot $(CHROOT) groupadd lodgeit + chroot $(CHROOT) getent passwd lodgeit || \ + chroot $(CHROOT) useradd -c "Lodgeit Pastebin" -m -g lodgeit lodgeit + cp lodgeit.sh $(CHROOT)/tmp + chroot $(CHROOT) su -c /tmp/lodgeit.sh lodgeit + cp 10_lodgeit.conf $(CHROOT)/etc/apache2/vhosts.d + cp apache2.conf $(CHROOT)/etc/conf.d/apache2 + python genkey.py $(CHROOT) + cp lodgeit.wsgi $(CHROOT)/home/lodgeit/lodgeitproject/lodgeit + cp issue $(CHROOT)/etc/issue + chroot $(CHROOT) rc-update add apache2 default + chroot $(CHROOT) $(EMERGE) -C dev-vcs/mercurial + chroot $(CHROOT) $(EMERGE) -C dev-python/virtualenv + chroot $(CHROOT) $(EMERGE) --depclean --with-bdeps=n + +clean: + diff --git a/lodgeit/Makefile.inc b/lodgeit/Makefile.inc deleted file mode 100644 index a31790f..0000000 --- a/lodgeit/Makefile.inc +++ /dev/null @@ -1,22 +0,0 @@ -# set up apache modules in make.conf -preinstall = cat $(APPLIANCE)/make.conf.extra >> $(CHROOT)/etc/make.conf - -postinstall = chroot $(CHROOT) emerge -1n --usepkg mercurial; \ - chroot $(CHROOT) emerge -1n --usepkg dev-python/virtualenv; \ - chroot $(CHROOT) getent group lodgeit || \ - chroot $(CHROOT) groupadd lodgeit; \ - chroot $(CHROOT) getent passwd lodgeit || \ - chroot $(CHROOT) useradd -c "Lodgeit Pastebin" -m -g lodgeit lodgeit; \ - cp $(APPLIANCE)/lodgeit.sh $(CHROOT)/tmp; \ - chroot $(CHROOT) su -c /tmp/lodgeit.sh lodgeit; \ - cp $(APPLIANCE)/10_lodgeit.conf $(CHROOT)/etc/apache2/vhosts.d; \ - cp $(APPLIANCE)/apache2.conf $(CHROOT)/etc/conf.d/apache2; \ - python $(APPLIANCE)/genkey.py $(CHROOT); \ - cp $(APPLIANCE)/lodgeit.wsgi \ - $(CHROOT)/home/lodgeit/lodgeitproject/lodgeit; \ - \ - cp $(APPLIANCE)/issue $(CHROOT)/etc/issue; \ - chroot $(CHROOT) rc-update add apache2 default; \ - chroot $(CHROOT) emerge -C mercurial; \ - chroot $(CHROOT) emerge -C dev-python/virtualenv; \ - chroot $(CHROOT) emerge --depclean --with-bdeps=n; diff --git a/teamplayer/Makefile b/teamplayer/Makefile new file mode 100644 index 0000000..0c7a4eb --- /dev/null +++ b/teamplayer/Makefile @@ -0,0 +1,47 @@ +HG_REPO = ../../teamplayer +TP_USER = teamplayer +TP_HOME = /opt/teamplayer +TP_DB = /var/lib/teamplayer +PGVER = 9.0 + +M4_DEFS += -D TP_USER=$(TP_USER) -D TP_HOME=$(TP_HOME) -D TP_DB=$(TP_DB) +M4C = $(M4) $(M4_DEFS) + +post_files = bash_profile settings_local.py start-teamplayer stop-teamplayer +post_files += local.start local.stop issue lighttpd.conf + +preinstall: + +postinstall: $(post_files) + chroot $(CHROOT) $(EMERGE) -n $(USEPKG) =dev-db/postgresql-server-$(PGVER)* + chroot $(CHROOT) passwd -d postgres + yes | chroot $(CHROOT) $(EMERGE) --config =postgresql-server-$(PGVER)* + chroot $(CHROOT) rc-update add postgresql-$(PGVER) default + chroot $(CHROOT) getent passwd $(TP_USER) || \ + chroot $(CHROOT) useradd -c "Teamplayer Server" -G postgres -U -d $(TP_HOME) $(TP_USER) + rm -rf $(CHROOT)/$(TP_HOME) + hg clone --pull $(HG_REPO) $(CHROOT)/$(TP_HOME) + cp bash_profile $(CHROOT)$(TP_HOME)/.bash_profile + chroot $(CHROOT) mkdir -p /etc/teamplayer + $(M4C) settings_local.py > $(CHROOT)/etc/teamplayer/settings_local.py + mkdir -p $(CHROOT)$(TP_HOME)/bin + $(M4C) start-teamplayer > $(CHROOT)$(TP_HOME)/bin/start-teamplayer + chmod +x $(CHROOT)$(TP_HOME)/bin/start-teamplayer + $(M4C) stop-teamplayer > $(CHROOT)$(TP_HOME)/bin/stop-teamplayer + chmod +x $(CHROOT)$(TP_HOME)/bin/stop-teamplayer + chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB) + chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)/songs + chroot $(CHROOT) rm -rf $(TP_HOME)/web/media/songs + chroot $(CHROOT) ln -s $(TP_DB)/songs $(TP_HOME)/web/media/songs + chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)/mpd + chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) /var/log/teamplayer + $(M4C) local.start > $(CHROOT)/etc/conf.d/local.start + $(M4C) local.stop > $(CHROOT)/etc/conf.d/local.stop + cp issue $(CHROOT)/etc/issue + $(M4C) lighttpd.conf > $(CHROOT)/etc/lighttpd/lighttpd.conf + chroot $(CHROOT) gpasswd -a lighttpd teamplayer + chroot $(CHROOT) rc-update add lighttpd default + chroot $(CHROOT) rc-update add ntpd default + +clean: + diff --git a/teamplayer/Makefile.inc b/teamplayer/Makefile.inc deleted file mode 100644 index 36326e8..0000000 --- a/teamplayer/Makefile.inc +++ /dev/null @@ -1,45 +0,0 @@ -HG_REPO = ../teamplayer -TP_USER = teamplayer -TP_HOME = /opt/teamplayer -TP_DB = /var/lib/teamplayer -PGVER = 9.0 - -M4_DEFS += -D TP_USER=$(TP_USER) -D TP_HOME=$(TP_HOME) -D TP_DB=$(TP_DB) -M4C = $(M4) $(M4_DEFS) - -preinstall = -postinstall = \ - chroot $(CHROOT) emerge -n $(USEPKG) =dev-db/postgresql-server-$(PGVER)*; \ - chroot $(CHROOT) passwd -d postgres; \ - yes | chroot $(CHROOT) emerge --config =postgresql-server-$(PGVER)*; \ - chroot $(CHROOT) rc-update add postgresql-$(PGVER) default; \ - chroot $(CHROOT) getent passwd $(TP_USER) || \ - chroot $(CHROOT) useradd -c "Teamplayer Server" -G postgres -U \ - -d $(TP_HOME) $(TP_USER); \ - rm -rf $(CHROOT)/$(TP_HOME); \ - hg clone --pull $(HG_REPO) $(CHROOT)/$(TP_HOME); \ - cp $(APPLIANCE)/bash_profile $(CHROOT)$(TP_HOME)/.bash_profile; \ - chroot $(CHROOT) mkdir -p /etc/teamplayer; \ - $(M4C) $(APPLIANCE)/settings_local.py \ - > $(CHROOT)/etc/teamplayer/settings_local.py; \ - mkdir -p $(CHROOT)$(TP_HOME)/bin; \ - $(M4C) $(APPLIANCE)/start-teamplayer \ - > $(CHROOT)$(TP_HOME)/bin/start-teamplayer; \ - chmod +x $(CHROOT)$(TP_HOME)/bin/start-teamplayer; \ - $(M4C) $(APPLIANCE)/stop-teamplayer \ - > $(CHROOT)$(TP_HOME)/bin/stop-teamplayer; \ - chmod +x $(CHROOT)$(TP_HOME)/bin/stop-teamplayer; \ - chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB); \ - chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)/songs; \ - chroot $(CHROOT) rm -rf $(TP_HOME)/web/media/songs; \ - chroot $(CHROOT) ln -s $(TP_DB)/songs $(TP_HOME)/web/media/songs; \ - chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)/mpd; \ - chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) \ - /var/log/teamplayer; \ - $(M4C) $(APPLIANCE)/local.start > $(CHROOT)/etc/conf.d/local.start; \ - $(M4C) $(APPLIANCE)/local.stop > $(CHROOT)/etc/conf.d/local.stop; \ - cp $(APPLIANCE)/issue $(CHROOT)/etc/issue; \ - $(M4C) $(APPLIANCE)/lighttpd.conf > $(CHROOT)/etc/lighttpd/lighttpd.conf; \ - chroot $(CHROOT) gpasswd -a lighttpd teamplayer; \ - chroot $(CHROOT) rc-update add lighttpd default; \ - chroot $(CHROOT) rc-update add ntpd default; diff --git a/x/Makefile b/x/Makefile new file mode 100644 index 0000000..a5bb833 --- /dev/null +++ b/x/Makefile @@ -0,0 +1,10 @@ +xdm_files = $(wildcard xdm/*) + +preinstall: + +postinstall: $(xdm_files) + cp xdm/* "$(CHROOT)"/etc/X11/xdm + chroot "$(CHROOT)" rc-update add xdm default; + +clean: + diff --git a/x/Makefile.inc b/x/Makefile.inc deleted file mode 100644 index c5bf4af..0000000 --- a/x/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -preinstall = -postinstall = cp "$(APPLIANCE)"/xdm/* "$(CHROOT)"/etc/X11/xdm; \ - chroot "$(CHROOT)" rc-update add xdm default; diff --git a/xfce/Makefile b/xfce/Makefile new file mode 100644 index 0000000..f1533fc --- /dev/null +++ b/xfce/Makefile @@ -0,0 +1,13 @@ +xdm_files = $(wildcard xdm/*) + +preinstall: + +postinstall: $(xdm_files) + cp $(xdm_files) "$(CHROOT)"/etc/X11/xdm + echo "XSESSION=Xfce4" > "$(CHROOT)"/etc/env.d/99local + chroot "$(CHROOT)" env-update + chroot "$(CHROOT)" rc-update add xdm default + +clean: + + diff --git a/xfce/Makefile.inc b/xfce/Makefile.inc deleted file mode 100644 index ba8b9ce..0000000 --- a/xfce/Makefile.inc +++ /dev/null @@ -1,7 +0,0 @@ -preinstall = -postinstall = cp "$(APPLIANCE)"/xdm/* "$(CHROOT)"/etc/X11/xdm; \ - echo "XSESSION=Xfce4" > "$(CHROOT)"/etc/env.d/99local; \ - chroot "$(CHROOT)" env-update; \ - chroot "$(CHROOT)" rc-update add xdm default; - -