#Author Alexander Gretencord PM=metamod-1.12.1 METAMOD=${WORKDIR}/${PM} S=${WORKDIR}/hlds_l P=hlds_l_3109_full DESCRIPTION="Halflife Linux Server" SRC_URI="http://metamod.org/files/${PM}.tgz ftp://ftp.splatterworld.de/games/hl/server/${P}.bin" DEPEND="" RDEPEND="virtual/glibc app-misc/screen" export DEBUG="yes" RESTRICT="nostrip" src_unpack () { # Why O Why must valve do this to us ;( cp ${DISTDIR}/${P}.bin ${WORKDIR} chmod u+x ${WORKDIR}/${P}.bin cd ${WORKDIR} echo -e "yes\n" | ${WORKDIR}/${P}.bin > /dev/null rm -f ${WORKDIR}/${P}.bin tar zxf ${P}.tar.gz || die rm -f ${P}.tar.gz unpack ${PM}.tgz } src_install () { insinto /etc/env.d newins ${FILESDIR}/halflife.envd 90halflife insinto /etc/init.d newins ${FILESDIR}/halflife.rc halflife chmod 754 ${D}/etc/init.d/halflife dodir /opt mv ${S} ${D}/opt/halflife || die insinto /opt/halflife doins ${FILESDIR}/starthl insinto /opt/halflife/valve/dlls doins ${METAMOD}/dlls/metamod_i386.so ${METAMOD}/dlls/stub_mm_i386.so ${METAMOD}/dlls/trace_mm_i386.so dosed 's:gamedll_linux "dlls/hl_i386.so":gamedll_linux "dlls/metamod_i386.so":' /opt/halflife/valve/liblist.gam echo -e "linux dlls/stub_mm_i386.so\nlinux dlls/trace_mm_i386.so" > ${D}/opt/halflife/valve/metamod.ini dodir /opt/halflife/valve/logs chown -R root.games ${D}/opt/halflife find ${D}/opt/halflife -type d -print0 | xargs --null chmod 755 find ${D}/opt/halflife -type f -print0 | xargs --null chmod 744 chmod 754 ${D}/opt/halflife/starthl ${D}/opt/halflife/hlds_run ${D}/opt/halflife/hlds ${D}/opt/halflife/hltv } pkg_postinst() { if [ -z `awk -F":" '/^halflife:/ { print }' /etc/passwd` ]; then useradd -g games -d /opt/halflife -c "Halflife dedicated server" -s /bin/bash halflife fi chown halflife.games /opt/halflife/valve/logs echo -e "\t#########################################" echo -e "\t# Use the halflife file in init.d to #" echo -e "\t# start the dedicated server. It uses #" echo -e "\t# screen so you can get to the console #" echo -e "\t# whenever you want with: #" echo -e "\t# #" echo -e "\t# screen -r halflife #" echo -e "\t# #" echo -e "\t# Have a look at "starthl" in the #" echo -e "\t# halflife dir to set other options #" echo -e "\t# when starting the server. #" echo -e "\t# #" echo -e "\t# The Server is started by the user #" echo -e "\t# halflife. #" echo -e "\t#########################################" } pkg_postrm() { userdel halflife }