2010-08-16 00:04:54 +02:00
|
|
|
#!/bin/sh -ve
|
2010-07-22 05:09:09 +02:00
|
|
|
|
|
|
|
CHROOT="$1"
|
|
|
|
HOSTNAME="$2"
|
|
|
|
APPLIANCE="`dirname $0`"
|
|
|
|
|
2010-08-02 14:18:11 +02:00
|
|
|
HG_REPO="../teamplayer"
|
2010-07-22 05:09:09 +02:00
|
|
|
TP_USER="teamplayer"
|
|
|
|
TP_HOME="/opt/teamplayer"
|
2010-08-16 00:04:54 +02:00
|
|
|
TP_DB="/var/run/teamplayer"
|
|
|
|
PGVER="8.4"
|
2010-07-22 05:09:09 +02:00
|
|
|
|
|
|
|
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}"
|
|
|
|
|
2010-08-16 00:04:54 +02:00
|
|
|
# Postgres config
|
|
|
|
chroot ${CHROOT} passwd -d postgres
|
|
|
|
yes | chroot ${CHROOT} emerge --config =postgresql-server-${PGVER}*
|
|
|
|
chroot ${CHROOT} rc-update add postgresql-${PGVER} default
|
|
|
|
|
2010-07-22 05:09:09 +02:00
|
|
|
chroot ${CHROOT} getent passwd ${TP_USER} || \
|
2010-08-16 00:04:54 +02:00
|
|
|
chroot ${CHROOT} useradd -c "Teamplayer Server" -G postgres -U \
|
|
|
|
-d ${TP_HOME} ${TP_USER}
|
2010-08-22 15:22:10 +02:00
|
|
|
rm -rf ${CHROOT}/${TP_HOME}
|
2010-07-22 05:09:09 +02:00
|
|
|
hg clone --pull ${HG_REPO} ${CHROOT}/${TP_HOME}
|
2010-08-16 00:04:54 +02:00
|
|
|
|
2010-08-02 14:14:14 +02:00
|
|
|
cp ${APPLIANCE}/bash_profile ${CHROOT}${TP_HOME}/.bash_profile
|
2010-08-16 00:04:54 +02:00
|
|
|
|
|
|
|
chroot ${CHROOT} mkdir -p /etc/teamplayer
|
|
|
|
${M4C} ${APPLIANCE}/settings_local.py > ${CHROOT}/etc/teamplayer/settings_local.py
|
|
|
|
|
2010-07-22 05:09:09 +02:00
|
|
|
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
|
2010-08-16 00:04:54 +02:00
|
|
|
chroot ${CHROOT} ${INSTALL} -d -o ${TP_USER} -g ${TP_USER} /var/log/teamplayer
|
2010-07-22 05:09:09 +02:00
|
|
|
${M4C} ${APPLIANCE}/local.start > ${CHROOT}/etc/conf.d/local.start
|
|
|
|
${M4C} ${APPLIANCE}/local.stop > ${CHROOT}/etc/conf.d/local.stop
|
2010-08-16 00:04:54 +02:00
|
|
|
cp ${APPLIANCE}/issue ${CHROOT}/etc/issue
|
|
|
|
|
2010-08-22 15:22:10 +02:00
|
|
|
# lighttpd config
|
|
|
|
${M4C} ${APPLIANCE}/lighttpd.conf > ${CHROOT}/etc/lighttpd/lighttpd.conf
|
|
|
|
chroot ${CHROOT} gpasswd -a lighttpd teamplayer
|
|
|
|
chroot ${CHROOT} rc-update add lighttpd default
|
|
|
|
|
2010-08-16 00:04:54 +02:00
|
|
|
chroot ${CHROOT} rc-update add ntpd default
|