OpenBSD support thread

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
Post Reply
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

OpenBSD support thread

Post by belenus »

As Z-Man wishes, an extra *BSD thread...

...I moved the content of the other thread to this one, but leaving links for reference.

Hmm, how about having seperate dev sub forums for BSD, Linux, Mac, Windows?



HOWTO: Installing AA 0.2.8.x under OpenBSD 3.8
- Works with 0.2.8.0 and 0.2.8.1 -

Version 0.2.8.2.1 of the dedicated server works out of the box.

Port and packages available for OpenBSD 4.0, ready to install!
Last edited by belenus on Sun Jan 21, 2007 3:26 pm, edited 14 times in total.
- bel
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

Since the new dedicated doesn't work with windows I tried to compile AA 0.2.8.0 under OpenBSD using gmake... works just fine, BUT when I want to start it, I get this message:
[0] Warning in void FindConfigurationPath(const char*) in tools/tDirectories.cpp:1166 :
[0] Could not determine path to configuration files. Using defaults or command line arguments.
[0]
Internal Error: Internal error in static tLanguage* tLanguage::FindStrict(const tString&) in tools/tLocale.cpp:150 :
Language British English not found.
Please send a Bug report!
When I start AA from the directory that contains "configure" the server can be started and runs... but I also get this message there:
[0] Warning in tString tPathResource::GetWritePath(const char*) const in tools/tDirectories.cpp:454 :
[0] Could not create path to ./resource/automatic/file:///var/db/xmlcatalog. Check your user's rights.
[0] ERROR: Cannot determine path to write resource to.
Fix for above error:
z-man wrote:For the other error, try replacing "file:///etc/xml/catalog" in gParser.cpp with "file:///var/db/xmlcatalog".
Well its just fine that it doesn't work out of the installation dir, but maybe it gives you a hint whats wrong...

Oh and, I did all as "root" so no issue with user rights.
Last edited by belenus on Mon Mar 20, 2006 1:14 pm, edited 2 times in total.
- bel
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

Could there be a search for bash implemented in configure as you did with SDL and LIBXML2?

At least OpenBSD (and I guess other BSDs too) don't come with bash preinstalled... (bash is needed for gmake install) ...other systems may need it installed first too.

Or remove bash from Makefile...
Last edited by belenus on Mon Mar 20, 2006 1:15 pm, edited 2 times in total.
- bel
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

While trying to get AA running on OpenBSD I worked on the rcd script and found some issue with the way some commands are used... Linux seems more forgiving than BSD in some cases...

in "rcd_startstop" it should be:

Code: Select all

chown -R "$user" $LOGDIR
chown -R "$user" $PIDDIR
chown -R "$user" $VARDIR
the -R what at the end of each line...

...and..., same file:

Code: Select all

renice $niceness_level -p `cat $MAINPIDFILE`    > /dev/null
renice $niceness_level -p `cat $STARTERPIDFILE` > /dev/null
The "-p" wasnt specified in from of the 'cat...'

Now I get to the point that it complains about not existing PID files... I wonder why they aren't created...

Edit:
OK, I found the reason... some scripts got "#!/bin/sh" and some "#!/bin/bash"

The issue now is that you cannot execute "./rcd_server" from OpenBSDs ksh shell (only with calling "sh rcd_server") if the script got "#!/bin/bash" inside and not "#!/bin/sh"... so the serverstarter script didn't get executed from within rcd_server.

I changed all scripts to using "#!/bin/sh" and replaced the "bash -i" in serverstarter to "sh -i" (doesn't make a difference I guess, correct me when I'm wrong) and now it seems to work... well that is, if the server could be started outside of the build directory :D

I would so love to see if my script modifications work :D
z-man wrote: Second, write a small wrapper script, something simple like

Code: Select all

#!/bin/sh
while ./armagetronad-dedicated; do true; done
or the other way round if you want to continue after crashes or fatal exits.
I tried both but couldn't see a difference, when I type in "exit" both versions just restart... and btw... it only works without the "./"
- bel
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

Got it running from within the build directory with my slightly modified starter scripts from Z-Man.
(The original scripts doesn't work with BSD for the reasons mentioned above)

Had to do a lot of virtual linking (to make the use relativle comfortable) but now it works...

Still, would be nice if, one day, the path problem gets fixed for BSD. =)
- bel
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

I don't think symbolic links are a problem.

Does the server run correctly if you start it manually? Because if not, our current rcd script has the problem of not noticing and restarting the server over and over, just as you describe.
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

z-man wrote:I don't think symbolic links are a problem.
Im confused now... I restored the original dirs and it worked.
Then I made the symbolic links again and it works too?

Happen I just made a typo with on of the symbolic links before?


Well, I attached the "unbashified" scripts so you can look through them and maybe implement in the next beta, RC or release, whatever...
Last edited by belenus on Mon Mar 20, 2006 2:14 pm, edited 1 time in total.
- bel
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

HOWTO: Installing AA 0.2.8.x under OpenBSD 3.8
AA versions 0.2.8.0 and 0.2.8.1 work if description below is followed.
OpenBSD 3.7 and upcomming 3.9 SHOULD work too... will test 3.9 as soon as I get it. =)

If not otherwise mentioned, the user is root.

Step 1: Install the needed packages

Install from ports or as packages:
gmake
libxml-2
bash
nano
Also get the depending packages...


Step 2: Download and unpack source of AA 0.2.8.x to your home directory

Code: Select all

cd ~
wget http://heanet.dl.sourceforge.net/sourceforge/armagetronad/armagetronad-0.2.8.1.src.tar.gz
tar zxvf arma*0.2.8.*gz

Step 3: Editing sources

Code: Select all

cd armagetronad-0.2.8.*/src/tron
nano gParser.cpp
goto line 901 or search for "xml/calalog"
replace "file:///etc/xml/catalog" with "file:///var/db/xmlcatalog"
save and exit nano (Ctrl+O and Ctrl+X)


Step 4: Building

Code: Select all

cd ../../
MAKE=gmake ./configure --disable-glout
gmake
gmake install

Step 5: Customizing for OpenBSD

Code: Select all

mkdir -p /home/armagetronad-dedicated
cd ..
cp -r armagetronad-0.2.8.* /home/armagetronad-dedicated
if not already done by the AA installer, create a user named "armagetronad-dedicated" with the home directory at "/home/armagetronad-dedicated" and then:

Code: Select all

chown -R armagetronad-dedicated /home/armagetronad-dedicated

cd /home/armagetronad-dedicated/arma*0.2.8.*
Install a symbolic link to the modified serverstarter script that will be installed soon:

Code: Select all

ln -s /usr/local/share/games/armagetronad-dedicated/scripts_bsd/rcd_server aactl
We want the server using the real config directory, so we rename the config dir inside the build directory and create a symbolic link instead, pointing to the real config dir:

Code: Select all

mv config config_build
ln -s /etc/armagetronad-dedicated config
Extract the directory from my scripts_bsd.tar.gz into:

Code: Select all

/usr/local/share/games/armagetronad-dedicated
Extract the script from aactl.tar.gz into:

Code: Select all

/usr/local/bin
and if nececarry

Code: Select all

chmod 755 /usr/local/bin/aactl
chown root.wheel /usr/local/bin/aactl
it.

Make sure you only have ONE armagetronad-0.2.8.* subdirectory in "/home/armagetronad-dedicated" because aactl won't work otherwise.

Deleting stuff you don't need

Code: Select all

rm -r /etc/init.d
Step 6: Starting the server

Enter from anywhere you like:
aactl start|stop|restart|status|log


Step 7: Making AA start at system boot

Add these lines to /etc/rc.local

Code: Select all

# Armagetron Advanced                                         #TAG_AACTL
if [ X"${aactl}" != X"NO" -a -x /usr/local/bin/aactl ]; then  #TAG_AACTL
     echo -n " ArmagetronAd"                                  #TAG_AACTL
     /usr/local/bin/aactl start                               #TAG_AACTL
fi                                                            #TAG_AACTL   
And this to /rc/rc.conf.local

Code: Select all

aactl="NO"              #TAG_AACTL, change "NO" to "" for autostart
where you have to change "NO" to "" if you want AA to start at system boot.

Step 8: Be happy and report any erros you find :D

The server should now run as user "armagetronad-dedicated" and all configuration comes from inside the default directories:

/etc/armagetronad
/usr/local/share/games/armagetronad-dedicated/resource

If you want to have the server started automaticly at system start, just modify "/etc/rc.local" to include "/usr/local/bin/aactl start" if it exists.

Thats it, for now we can only wait for the path problems getting solved so it can be started directly without all the trouble and maybe my changed scripts find a way into the official version... :D
Attachments
scripts_bsd.tar.gz
(4.15 KiB) Downloaded 430 times
aactl.tar.gz
(171 Bytes) Downloaded 400 times
Last edited by belenus on Tue Mar 28, 2006 7:19 pm, edited 26 times in total.
- bel
Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: luke@dashjr.org

Post by Luke-Jr »

We seem to be avoiding launch scripts for some reason... (with exception to init, obviously)
The directory handling was all messed up for non-FHS systems this release, I'm probably going to focus on fixing this soon.
User avatar
n54
MVP
Posts: 1587
Joined: Sun Dec 21, 2003 12:40 pm

Post by n54 »

Hi belenus, this is seperate and a bit offtopic but I'm wondering if you're (also) running the ArmagetronAD client on OpenBSD and if you do; have you tried or given any tought to jailing it?

I'm personally only thinking about the AAD client and not about the AAD server but I guess they use pretty much the same resources/dependencies. If you have any experiences or toughts about jailing AAD I would like to hear them (I'm not playing AAD on OpenBSD yet but will possibly do so later on) and I'm sure others running AAD on OpenBSD would be interested as well (if there is any that is, might be a bit too esoteric) :D
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

n54 wrote:Hi belenus, this is seperate and a bit offtopic but I'm wondering if you're (also) running the ArmagetronAD client on OpenBSD and if you do; have you tried or given any tought to jailing it?
I play AA on a machine running Ubuntu and no, I haven't thought about jailing it, especially not the client, why would you? Do you also jail Firefox? Thunderbird?

Jailing the server is another matter, since I am already running the server from build directory, as would any other people who run AA on OpenBSD (but I doubt there are many) . So jailing it shouldn't be too hard since everything you need is in the build directory I guess...

However, if you wanted to use the rcd_scripts you would need some major tweaking to change all paths to be within the chroot directory.

But that also makes some other things quite uncomfortable, like making the statistics available on the internet, because jailed Apache cannot access AA and jailed AA could not access Apache.
Sure, one could make a cronjob that copies the statstics files every few minutes or every minute...


Edit:
Updated the HOWTO...
added a part how to start AA at system boot.
- bel
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Allright, the CVS branch b0_2_8 is now FreeBSD compatible. Complete with user addition and startup scripts, FreeBSD is using the same system as Linux.
I chose to keep the bash references for now, until we find a shell zoologist who can tell us that all /bin/sh support functions, that's the only possible shell incompatibility issue that would be cumbersome to work around. bash and what (Free|Open)BSD are using seem to comply.

Hmm, found one:
info autoconf wrote:You should not use shell functions, aliases, negated character classes, or other features that are not found in all Bourne-compatible shells; restrict yourself to the lowest common denominator.
So we'll stick to bash.

The directory finding code now also respects the prefix the game was compiled with, so if binreloc is not supported, it finds its files anyway.

Credit for the rest of the fixes goes to belenus.

OpenBSD is already installed, time to give that a try.
Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: luke@dashjr.org

Post by Luke-Jr »

z-man wrote:The directory finding code now also respects the prefix the game was compiled with, so if binreloc is not supported, it finds its files anyway.
I hope it also respects the configuration exec-prefix, bindir, sbindir, libexecdir, datadir, sysconfdir, sharedstatedir, localstatedir, libdir, and includedir. I've made this one of my todo-asap goals, fyi.
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

No :) I just didn't break things. One step at a time.
Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: luke@dashjr.org

Post by Luke-Jr »

z-man wrote:I just didn't break things.
Not this time, anyway... Who was responsible for 'sysinstall'? ;)
Post Reply