Changed from preinstall/postintall scripts to Makefile include files

This commit is contained in:
Albert Hopkins 2010-10-06 07:37:32 -04:00
parent 9b19fd1590
commit 7cf0f4ecf2
25 changed files with 129 additions and 178 deletions

View File

@ -2,5 +2,5 @@ chroot\/.*
gentoo\/.*
loop\/.*
.*\.swp$
Makefile\..*
Makefile\.[^(inc)]
stage3-.*\.tar\.bz2

View File

@ -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 \

2
base/Makefile.inc Normal file
View File

@ -0,0 +1,2 @@
preinstall =
postinstall =

View File

@ -1,3 +0,0 @@
#!/bin/sh
CHROOT="$1"

View File

@ -1,3 +0,0 @@
#!/bin/sh
CHROOT="$1"

21
gnome/Makefile.inc Normal file
View File

@ -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;

View File

@ -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

View File

@ -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

13
kde/Makefile.inc Normal file
View File

@ -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

View File

@ -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

View File

@ -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

22
lodgeit/Makefile.inc Normal file
View File

@ -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;

6
lodgeit/issue Normal file
View File

@ -0,0 +1,6 @@

------------------------------------------------------------------------------
LODGEIT CONSOLE
------------------------------------------------------------------------------

4
lodgeit/make.conf.extra Normal file
View File

@ -0,0 +1,4 @@
# Apache config for LodgeIt
APACHE2_MPMS="prefork"
APACHE2_MODULES="authz_host dir mime"

View File

@ -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

View File

@ -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

46
teamplayer/Makefile.inc Normal file
View File

@ -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;

View File

@ -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

View File

@ -1,4 +0,0 @@
#!/bin/sh -ev
CHROOT="$1"
APPLIANCE="`dirname $0`"

3
x/Makefile.inc Normal file
View File

@ -0,0 +1,3 @@
preinstall =
postinstall = cp "$(APPLIANCE)"/xdm/* "$(CHROOT)"/etc/X11/xdm; \
chroot "$(CHROOT)" rc-update add xdm default;

View File

@ -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

View File

@ -1,3 +0,0 @@
#!/bin/sh
CHROOT="$1"

7
xfce/Makefile.inc Normal file
View File

@ -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;

View File

@ -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

View File

@ -1,3 +0,0 @@
#!/bin/sh
CHROOT="$1"