Running BFSMD chrooted (debian oriented)

michielb at stack.nl michielb at stack.nl
Wed Feb 4 15:33:30 EST 2004




my setup:
bfsmd + battlefield server running chrooted under user battlefield
in /opt/battlefield/

unpack:
unpacked bf .run in /<somedir>/battlefield/server/
so bf1942_lnxded.dynamic resides in that dir. Set up bfsmd like u
usualy would in /<somedir>/battlefield/server/

chown battlefield:battlefield /<somedir>/battlefield/server/

/lib/ files:
mkdir /<somedir>/battlefield/lib/
copy the following libs from /lib into that dir
     ld-linux.so.2
     libc.so.6
     libdl.so.2
     libgcc_s.so.1
     libm.so.6
     libncurses.so.5
     libpthread.so.0
     libstdc++.so.5

/etc/ files:
mkdir /<somedir>/battlefield/etc/
copy /etc/group into that dir
remove all lines except the battlefield user.

/proc/ files:
mkdir /<somedir>/battlefield/proc/
mount --bind /proc /<somedir>/battlefield/proc/
( might be able to mount it readonly not tryed,
can adding -o ro I thought)

make a softlink from bf1942_lnxded.* to the one you want ( I had to do
that)

I hope I didn't forget anything

I added the /etc/init.d/battlefield file under here.

contact me if you have problems,
michielb at stack.nl / apex at thtclan.com

<-- PAST /etc/init.d/battlefield -->
#!/bin/sh
#
# battlefield server setup
#

PID=/var/run/battlefield.pid

case "$1" in
        start)
                echo -n "Starting Battlefield Control server: "
                start-stop-daemon --start --pidfile $PID \
                                  --chuid battlefield \
                                  --chroot /opt/battlefield/ \
                        --exec /opt/battlefield/server/bfsmd \
                        --startas /server/bfsmd -- -path /server/ -daemon -restart
                sleep 2
                ;;
        stop)
                echo -n "Stopping Battlefield Control server: Battlefield"
                start-stop-daemon --stop --quiet --exec /opt/battlefield/server/bfsmd
                start-stop-daemon --stop --quiet --user battlefield
                echo "."
                ;;
        restart | force-reload)
                $0 stop
                sleep 2
                $0 start
                if [ "$?" != "0" ]; then
                        exit 1
                fi
                ;;
        *)
                echo "Usage: /etc/init.d/battlefield {start|stop|restart|force-reload}"
                exit 1
esac

exit 0

<-- END PAST -->




More information about the Bf1942 mailing list