From 7cf0f4ecf268195936f70d7d693afd4826ece159 Mon Sep 17 00:00:00 2001 From: Albert Hopkins Date: Wed, 6 Oct 2010 07:37:32 -0400 Subject: [PATCH] Changed from preinstall/postintall scripts to Makefile include files --- .hgignore | 2 +- Makefile | 9 +++---- base/Makefile.inc | 2 ++ base/postinstall | 3 --- base/preinstall | 3 --- gnome/Makefile.inc | 21 ++++++++++++++++ gnome/postinstall | 10 -------- gnome/preinstall | 11 --------- kde/Makefile.inc | 13 ++++++++++ kde/postinstall | 18 -------------- kde/preinstall | 7 ------ lodgeit/Makefile.inc | 22 +++++++++++++++++ lodgeit/issue | 6 +++++ lodgeit/make.conf.extra | 4 +++ lodgeit/postinstall | 24 ------------------ lodgeit/preinstall | 13 ---------- teamplayer/Makefile.inc | 46 ++++++++++++++++++++++++++++++++++ teamplayer/postinstall | 55 ----------------------------------------- teamplayer/preinstall | 4 --- x/Makefile.inc | 3 +++ x/postinstall | 7 ------ x/preinstall | 3 --- xfce/Makefile.inc | 7 ++++++ xfce/postinstall | 11 --------- xfce/preinstall | 3 --- 25 files changed, 129 insertions(+), 178 deletions(-) create mode 100644 base/Makefile.inc delete mode 100755 base/postinstall delete mode 100755 base/preinstall create mode 100644 gnome/Makefile.inc delete mode 100755 gnome/postinstall delete mode 100755 gnome/preinstall create mode 100644 kde/Makefile.inc delete mode 100755 kde/postinstall delete mode 100755 kde/preinstall create mode 100644 lodgeit/Makefile.inc create mode 100644 lodgeit/issue create mode 100644 lodgeit/make.conf.extra delete mode 100755 lodgeit/postinstall delete mode 100755 lodgeit/preinstall create mode 100644 teamplayer/Makefile.inc delete mode 100755 teamplayer/postinstall delete mode 100755 teamplayer/preinstall create mode 100644 x/Makefile.inc delete mode 100755 x/postinstall delete mode 100755 x/preinstall create mode 100644 xfce/Makefile.inc delete mode 100755 xfce/postinstall delete mode 100755 xfce/preinstall diff --git a/.hgignore b/.hgignore index 8b3d275..319f0d8 100644 --- a/.hgignore +++ b/.hgignore @@ -2,5 +2,5 @@ chroot\/.* gentoo\/.* loop\/.* .*\.swp$ -Makefile\..* +Makefile\.[^(inc)] stage3-.*\.tar\.bz2 diff --git a/Makefile b/Makefile index 681ff34..ad8625d 100644 --- a/Makefile +++ b/Makefile @@ -28,9 +28,8 @@ KERNEL=gentoo-sources PACKAGE_FILES=$(APPLIANCE)/package.* WORLD=$(APPLIANCE)/world CRITICAL=$(APPLIANCE)/critical -PREINSTALL=$(APPLIANCE)/preinstall -POSTINSTALL=$(APPLIANCE)/postinstall +include $(APPLIANCE)/Makefile.inc all: image @@ -147,8 +146,8 @@ grub: systools grub.conf $(CHROOT)/boot/vmlinuz fi touch grub -software: systools issue etc-update.conf $(CRITICAL) $(WORLD) $(PREINSTALL) $(POSTINSTALL) - ./$(PREINSTALL) "$(CHROOT)" $(HOSTNAME) +software: systools issue etc-update.conf $(CRITICAL) $(WORLD) + $(preinstall) chroot $(CHROOT) emerge -DN $(USEPKG) system cp etc-update.conf $(CHROOT)/etc/ chroot $(CHROOT) etc-update @@ -158,7 +157,7 @@ software: systools issue etc-update.conf $(CRITICAL) $(WORLD) $(PREINSTALL) $(PO cp issue $(CHROOT)/etc/issue chroot $(CHROOT) emerge --depclean --with-bdeps=n chroot $(CHROOT) gcc-config 1 - ./$(POSTINSTALL) "$(CHROOT)" $(HOSTNAME) + $(postinstall) chroot $(CHROOT) passwd -d root chroot $(CHROOT) passwd -e root if [ "$(PRUNE_CRITICAL)" = "YES" ] ; then \ diff --git a/base/Makefile.inc b/base/Makefile.inc new file mode 100644 index 0000000..158b4f6 --- /dev/null +++ b/base/Makefile.inc @@ -0,0 +1,2 @@ +preinstall = +postinstall = diff --git a/base/postinstall b/base/postinstall deleted file mode 100755 index aa6c897..0000000 --- a/base/postinstall +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -CHROOT="$1" diff --git a/base/preinstall b/base/preinstall deleted file mode 100755 index aa6c897..0000000 --- a/base/preinstall +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -CHROOT="$1" diff --git a/gnome/Makefile.inc b/gnome/Makefile.inc new file mode 100644 index 0000000..555e988 --- /dev/null +++ b/gnome/Makefile.inc @@ -0,0 +1,21 @@ +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; \ + 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/postinstall b/gnome/postinstall deleted file mode 100755 index 82083b4..0000000 --- a/gnome/postinstall +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -CHROOT="$1" -APPLIANCE="`dirname $0`" - -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/preinstall b/gnome/preinstall deleted file mode 100755 index 44aa9d8..0000000 --- a/gnome/preinstall +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -CHROOT="$1" - -# 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 -mkdir -p "${CHROOT}/var/lib/dbus" -echo 1234567890abcdef1234567890abcdef > "${CHROOT}"/var/lib/dbus/machine-id - -# argh, something depends on pkgconfig but it's not in it's deps -chroot "${CHROOT}" emerge -1n dev-util/pkgconfig diff --git a/kde/Makefile.inc b/kde/Makefile.inc new file mode 100644 index 0000000..c5e6c04 --- /dev/null +++ b/kde/Makefile.inc @@ -0,0 +1,13 @@ +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/kde/postinstall b/kde/postinstall deleted file mode 100755 index 96fd1d6..0000000 --- a/kde/postinstall +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -CHROOT="$1" -APPLIANCE="`dirname $0`" - -# Copy modified kdm config files -cp "$APPLIANCE"/kdmrc "$APPLIANCE"/Xaccess "$CHROOT"/usr/share/config/kdm - -# enable hal -chroot "$CHROOT" rc-update add dbus default - -# enable kdm -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/kde/preinstall b/kde/preinstall deleted file mode 100755 index f5f1587..0000000 --- a/kde/preinstall +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -CHROOT="$1" - -# Add a few flags to global USE -echo -e '\n#Added for the KDE virtual appliance' >> "$CHROOT"/etc/make.conf -echo 'USE="$USE qt3support xcomposite opengl"' >> "$CHROOT"/etc/make.conf diff --git a/lodgeit/Makefile.inc b/lodgeit/Makefile.inc new file mode 100644 index 0000000..a31790f --- /dev/null +++ b/lodgeit/Makefile.inc @@ -0,0 +1,22 @@ +# 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/lodgeit/issue b/lodgeit/issue new file mode 100644 index 0000000..84c9412 --- /dev/null +++ b/lodgeit/issue @@ -0,0 +1,6 @@ + + ------------------------------------------------------------------------------ + LODGEIT CONSOLE + ------------------------------------------------------------------------------ + + diff --git a/lodgeit/make.conf.extra b/lodgeit/make.conf.extra new file mode 100644 index 0000000..f1a1396 --- /dev/null +++ b/lodgeit/make.conf.extra @@ -0,0 +1,4 @@ + +# Apache config for LodgeIt +APACHE2_MPMS="prefork" +APACHE2_MODULES="authz_host dir mime" diff --git a/lodgeit/postinstall b/lodgeit/postinstall deleted file mode 100755 index 8e1e5db..0000000 --- a/lodgeit/postinstall +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -e -set -v - -CHROOT="$1" -HOSTNAME="$2" -APPLIANCE="`dirname $0`" - -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 - -sed -i 's/Gentoo Virtual Machine/LODGEIT CONSOLE/' ${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/lodgeit/preinstall b/lodgeit/preinstall deleted file mode 100755 index 38fda21..0000000 --- a/lodgeit/preinstall +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -ev - -CHROOT="$1" -APPLIANCE="`dirname $0`" - -# set up apache modules in make.conf -cat >> ${CHROOT}/etc/make.conf << EOF - -# Apache config for LodgeIt -APACHE2_MPMS="prefork" -APACHE2_MODULES="authz_host dir mime" -EOF - diff --git a/teamplayer/Makefile.inc b/teamplayer/Makefile.inc new file mode 100644 index 0000000..a7caa3e --- /dev/null +++ b/teamplayer/Makefile.inc @@ -0,0 +1,46 @@ +HG_REPO = ../teamplayer +TP_USER = teamplayer +TP_HOME = /opt/teamplayer +TP_DB = /var/lib/teamplayer +PGVER = 8.4 + +INSTALL = /usr/bin/install +M4 = /usr/bin/m4 +M4_DEFS = -D HOSTNAME=$(HOSTNAME) -D TP_USER=$(TP_USER) -D TP_HOME=$(TP_HOME) +M4_DEFS += -D TP_DB=$(TP_DB) +M4C = $(M4) $(M4_DEFS) + +postinstall = \ + 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/teamplayer/postinstall b/teamplayer/postinstall deleted file mode 100755 index 3eab335..0000000 --- a/teamplayer/postinstall +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -ve - -CHROOT="$1" -HOSTNAME="$2" -APPLIANCE="`dirname $0`" - -HG_REPO="../teamplayer" -TP_USER="teamplayer" -TP_HOME="/opt/teamplayer" -TP_DB="/var/lib/teamplayer" -PGVER="8.4" - -INSTALL="/usr/bin/install" -M4="/usr/bin/m4" -M4_DEFS="-D HOSTNAME=${HOSTNAME} -D TP_USER=${TP_USER} -D TP_HOME=${TP_HOME}" -M4_DEFS="${M4_DEFS} -D TP_DB=${TP_DB}" -M4C="${M4} ${M4_DEFS}" - -# Postgres config -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 - -# lighttpd config -${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/teamplayer/preinstall b/teamplayer/preinstall deleted file mode 100755 index 0f31792..0000000 --- a/teamplayer/preinstall +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -ev - -CHROOT="$1" -APPLIANCE="`dirname $0`" diff --git a/x/Makefile.inc b/x/Makefile.inc new file mode 100644 index 0000000..c5bf4af --- /dev/null +++ b/x/Makefile.inc @@ -0,0 +1,3 @@ +preinstall = +postinstall = cp "$(APPLIANCE)"/xdm/* "$(CHROOT)"/etc/X11/xdm; \ + chroot "$(CHROOT)" rc-update add xdm default; diff --git a/x/postinstall b/x/postinstall deleted file mode 100755 index 32efd89..0000000 --- a/x/postinstall +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -ev - -CHROOT="$1" -APPLIANCE="`dirname $0`" - -cp "${APPLIANCE}"/xdm/* "${CHROOT}"/etc/X11/xdm -chroot "${CHROOT}" rc-update add xdm default diff --git a/x/preinstall b/x/preinstall deleted file mode 100755 index aa6c897..0000000 --- a/x/preinstall +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -CHROOT="$1" diff --git a/xfce/Makefile.inc b/xfce/Makefile.inc new file mode 100644 index 0000000..ba8b9ce --- /dev/null +++ b/xfce/Makefile.inc @@ -0,0 +1,7 @@ +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; + + diff --git a/xfce/postinstall b/xfce/postinstall deleted file mode 100755 index c371554..0000000 --- a/xfce/postinstall +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -CHROOT="$1" -APPLIANCE="`dirname $0`" - -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 - - diff --git a/xfce/preinstall b/xfce/preinstall deleted file mode 100755 index aa6c897..0000000 --- a/xfce/preinstall +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -CHROOT="$1"