Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: making .deb package of NWN  (Read 2882 times)

malimbar04

  • Bay Watcher
    • View Profile
making .deb package of NWN
« on: January 08, 2011, 04:03:17 pm »

Before Dwarf Fortress, I was addicted to Neverwinter nights. There is a server called Arelith which functions largely as a MMORPG, is well maintained and updated, and is otherwise really amazing with what they've done with simple server-side scripts. As of the last patch they will ever serve (1.69), it no longer even requires a CD to work.

Neverwinter nights is completely linux compatible, though it's common to have troubles during install and update. It is completely WINE compatible, but then you have to install and use WINE, deal with an extra layer of actively developed software, and so forth. It's a crappy solution.

So I would like to create a debian package to install it on a system, only requiring the CD keys from your disk. So far I've made a simple control file from a template, read two different tutorials, and organized all the resources into a file: the total working install from WINE, the total contents of NWN_DIAMOND

What I would like to do is make a .deb package that would install NWN fully updated.

I currently have in a folder:
Files from working WINE install at version 1.69
NW_DIAMOND dvd files in a folder
English linux binary for version 1.29 (off nwn website)
nwn resources for version 1.29 (off nwn website)
English linux update for version 1.69 (off nwn website).

The next question I have is how to make the install scripts and uninstall scripts to put into the deb package. Figuring out if I'm missing anything will be the question after that.
« Last Edit: January 08, 2011, 04:06:30 pm by malimbar04 »
Logged
No! No! I will not massacre my children. Instead, I'll make them corpulent on crappy mass-produced quarry bush biscuits and questionably grown mushroom alcohol, and then send them into the military when they turn 12...

Hugehead

  • Bay Watcher
    • View Profile
Re: making .deb package of NWN
« Reply #1 on: January 08, 2011, 05:01:44 pm »

Make sure you include the CEP, that's needed for quite a few gameworlds and is a good builder resource.
Logged
We're Bay12er's. If there is a bug, we will find it, exploit it, and make a recursive statue out of it. Just look up Planepacked.
When a dwarf enters a martial trance, they become Jedi. Short, drunken Jedi.

malimbar04

  • Bay Watcher
    • View Profile
Re: making .deb package of NWN
« Reply #2 on: January 08, 2011, 05:17:52 pm »

Make sure you include the CEP, that's needed for quite a few gameworlds and is a good builder resource.
Will do, though I'm thinking about it as a separate package. I don't personally care about the CEP (arelith works around it, and not everyone has it), and we could save almost a GB if we don't include it (and the game is already a few GB).
Logged
No! No! I will not massacre my children. Instead, I'll make them corpulent on crappy mass-produced quarry bush biscuits and questionably grown mushroom alcohol, and then send them into the military when they turn 12...

malimbar04

  • Bay Watcher
    • View Profile
Re: making .deb package of NWN
« Reply #3 on: January 08, 2011, 05:26:18 pm »

The control file is currently as such:

Code: [Select]
Package: nwn_1.69.1
Version: 1.0
Section: unknown
Priority: optional
Architecture: x86
Essential: no
Depends:
Pre-Depends:
Recommends:   
Suggests: 
Installed-Size: 4.5 GB
Maintainer: Nathan Lee [nathanlee2@gmail.com]
Conflicts:
Replaces:
Provides:
Description: Neverwinter nights role playing game updated to latest version with both expansions (Shadows of the Undrentide, Hordes of the Underdark). Must have a CD key to work.
.
More descriptive text.
I'm not sure if I can delete many of those settings, but I'm positive it wouldn't conflict or replace anything. It does require SDL libraries, which I'll add later.
---
So far, I've looked at:
http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/How-to-make-deb-packages/

http://tldp.org/HOWTO/html_single/Debian

http://www.debian.org/doc/FAQ/ch-pkg_basics.en.html-Binary-Package-Building-HOWTO/

and I'm working off the first one (which is the one that is easiest to understand, even if it's 7 years old). However, I havne't the slightest clue how to make an instlal script or uninstall script. (though I think they're named install,  and prerm, and postinst for thigns to do after installation.
Logged
No! No! I will not massacre my children. Instead, I'll make them corpulent on crappy mass-produced quarry bush biscuits and questionably grown mushroom alcohol, and then send them into the military when they turn 12...

malimbar04

  • Bay Watcher
    • View Profile
Re: making .deb package of NWN
« Reply #4 on: January 08, 2011, 06:36:19 pm »

found a websites to teach shell scripting:
http://www.freeos.com/guides/lsst/ch02sec01.html

hope this will help me :)
Logged
No! No! I will not massacre my children. Instead, I'll make them corpulent on crappy mass-produced quarry bush biscuits and questionably grown mushroom alcohol, and then send them into the military when they turn 12...

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: making .deb package of NWN
« Reply #5 on: January 09, 2011, 08:54:02 am »

and I'm working off the first one (which is the one that is easiest to understand, even if it's 7 years old). However, I havne't the slightest clue how to make an instlal script or uninstall script. (though I think they're named install,  and prerm, and postinst for thigns to do after installation.
Do you need install scripts? If all you're doing is dropping some files in certain places then making a package is very easy.
See this, deb(5) (open a terminal and type 'man 5 deb') and deb-control(5).
Logged

malimbar04

  • Bay Watcher
    • View Profile
Re: making .deb package of NWN
« Reply #6 on: January 09, 2011, 10:21:10 am »

That whole guide is like reading gibberish to me. The guide to installing nwn the normal way simply has all files in a NWN directory in the users home folder, not in the seperate linux folders. I'm not sure the benefit here of following the linux directory scheme.  So... would I do this?

Code: [Select]
#!/bin/bash
dh_install nwn
Though, the example they use in 5.11 looks something like this:
Code: [Select]
#!/bin/bash
src/foo/NWN
Which neither makes that much sense to me. If it doesn't make sense, then for all I know it's going to delete my home directory. I'll keep reading it, and post if I figure out exactly what I need to do.
Logged
No! No! I will not massacre my children. Instead, I'll make them corpulent on crappy mass-produced quarry bush biscuits and questionably grown mushroom alcohol, and then send them into the military when they turn 12...

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: making .deb package of NWN
« Reply #7 on: January 09, 2011, 12:02:49 pm »

It's been a while since I built a deb package/used dpkg, but I think it goes like this. Assuming you have a directory called "package" in your home directory:
Code: [Select]
~/package/DEBIAN/usr/bin/app.exe
~/package/DEBIAN/usr/local/app/file_a
~/package/DEBIAN/usr/local/app/file_b
~/package/DEBIAN/usr/local/app/file_c
~/package/DEBIAN/usr/local/app/file_d
~/package/DEBIAN/usr/local/app/file_e
~/package/control
then dpkg --build ./package; mv package.deb <name_of_your_package>.deb. I'm pretty sure it's --build, though, I may be wrong.

Logged

malimbar04

  • Bay Watcher
    • View Profile
Re: making .deb package of NWN
« Reply #8 on: January 09, 2011, 01:15:48 pm »

It's been a while since I built a deb package/used dpkg, but I think it goes like this. Assuming you have a directory called "package" in your home directory:
Code: [Select]
~/package/DEBIAN/usr/bin/app.exe
~/package/DEBIAN/usr/local/app/file_a
~/package/DEBIAN/usr/local/app/file_b
~/package/DEBIAN/usr/local/app/file_c
~/package/DEBIAN/usr/local/app/file_d
~/package/DEBIAN/usr/local/app/file_e
~/package/control
then dpkg --build ./package; mv package.deb <name_of_your_package>.deb. I'm pretty sure it's --build, though, I may be wrong.
Which is simply listing a directory? You don't have to say that you're copying files or cutting/pasting files?
Also, everything fits in a single 4.5 GB folder, but there are a lot of individual files. do I have to list them all separately?

In the absence of knowing what I'm doing, I did find the copy command (cp), so this is what I'm currently working with:
Code: [Select]
#!/bin/bash
# Shell script to copy NWN folder to /home/foo/NWN

echo "copying to $HOME"
cp $nwn $HOME
exit 0
[/copy]
I'm currently trying to find if there is a way that doesn't require copying (using 9 GB to install a game less than 5 seems like a waste of hard drive space, and that can really suck sometimes).
Logged
No! No! I will not massacre my children. Instead, I'll make them corpulent on crappy mass-produced quarry bush biscuits and questionably grown mushroom alcohol, and then send them into the military when they turn 12...

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: making .deb package of NWN
« Reply #9 on: January 09, 2011, 01:57:43 pm »

Which is simply listing a directory? You don't have to say that you're copying files or cutting/pasting files?
I'm not listing the files, those are files in package. package contains a directory called DEBIAN, in it are directories usr/bin/ and usr/local/app, etc.
Also, everything fits in a single 4.5 GB folder, but there are a lot of individual files. do I have to list them all separately?
Like I said, you need each and every file in your directory copied to "package/DEBIAN/full/path/to/file/". If you're having trouble putting this together, just say so. I can write a script to do it for you if you like.

e, My bad, the directory structure should look like this:
Code: [Select]
~/package/DEBIAN/control
~/package/usr/bin/app.exe
~/package/usr/local/app/file_a
~/package/usr/local/app/file_b
~/package/usr/local/app/file_c
~/package/usr/local/app/file_d
~/package/usr/local/app/file_e
etc.
build with dpkg-deb -b package

ee, Take a look at this too: http://thedarkmaster.wordpress.com/2008/05/24/how-to-create-manipulate-a-deb-file-of-a-compiled-application/
« Last Edit: January 09, 2011, 03:51:55 pm by ILikePie »
Logged

malimbar04

  • Bay Watcher
    • View Profile
Re: making .deb package of NWN
« Reply #10 on: January 09, 2011, 06:24:19 pm »

Ah, I see what you're saying now.

Well, I created the first draft of the project. Apparently it doesn't "need" an install script (or prerm, postrm, postinst). I'm also not entirely sure if it works yet, as the script to start nwn says it has to be in the current directory, but I put it in nwn/usr/bin as opposed to nwn/usr/local/app . I'll test it out afterward.

Going to that website really helped on the level of knowing what's in a deb package. I didn't know you could open a deb package with archive manager and see files and folders. That makes more sense now.
----
Is there any reason I would need scripts for prerm, postrm, and postinst? Or would removing the package normally delete all those files? In other words I'm still playing with it, but I'm very happy it worked (or rather dpkg didn't yell at me, it's still in the process of "working" as I type this).

EDIT: nevermind, it doesn't install. ubuntu software center can't open the resulting .deb file, and neither can archive manager. it's also 2.5 Gb, as opposed to the source folder of 4.5 GB. I'm guessing this is compression, but I don't know otherwise.
« Last Edit: January 09, 2011, 06:32:28 pm by malimbar04 »
Logged
No! No! I will not massacre my children. Instead, I'll make them corpulent on crappy mass-produced quarry bush biscuits and questionably grown mushroom alcohol, and then send them into the military when they turn 12...

Azkanan

  • Bay Watcher
    • View Profile
Re: making .deb package of NWN
« Reply #11 on: January 10, 2011, 12:24:52 pm »

I played Neverwinter Nights for years upon years, especially online. Good, damn, times.

I began to craft the entire of the Forgotten Realms once. Got as far as finishing Icewind Dale and moving south to Waterdeep before, a virus, I think, destroyed it all.
Logged
A pool of Dwarven Ale.
WHO IS RESPONSIBLE FOR THIS ?

Mephisto

  • Bay Watcher
    • View Profile
Re: making .deb package of NWN
« Reply #12 on: January 10, 2011, 12:37:00 pm »

For inspiration, you could check out Arch Linux's User Repository entry for NWN. In particular, PKGBUILD and nwn.install under the Files link may be helpful. I know you're creating a .deb, but surely the two processes are similar.
Logged

malimbar04

  • Bay Watcher
    • View Profile
Re: making .deb package of NWN
« Reply #13 on: January 22, 2011, 09:35:54 am »

I have worked a bit with a guy in another forum to get working postinst and  prerm scripts. I've also compressed all of the finished nwn files with both expansions and the CEP into 7z format (2.6 Gb - tar.gz was something closer to 3.6).

Unfortunately there is still something funky going on with permissions. Before making a nwn.deb package I tested the script. It works in a normal directory, but for some reason fails to copy all filse into the /usr/local/games directory. I have tried it with sudo as well, but only a few of the files copy over, and they are not organized into the folder hierarchy that is in the 7z file.

Ideally I wanted the whole nwn folder copied cleanly to the /usr/local/games directory as such:
/usr/local/games/nwn/fixinstall
/usr/local/games/nwn/nwn_icon.png
/usr/local/games/nwn/ambient/something.wav
etc

instead, I'm getting only a few files (.txt files, .key files, shell scripts, .png files, and .wav files) in the directory as such:
/usr/local/games/fixinstall
/usr/local/games/nwn_icon.png
/usr/local/games/something.wav

... how can this even happen?

Further info:
By default the nwn.7z file is in the /tmp directory, and is deleted at the end of the postinst script I'm using.
All I'm doing is copying the nwn.7z file into the /tmp folder and then running the script via command line as such:
$ sudo ./postinst

The postinst script is as follows:
Code: [Select]
#!/bin/sh
path=/usr/local/games
mkdir -p "$path"

echo "Extracting..."
"$(which 7z || which 7zr)" x -o"$path" /tmp/nwn.7z || (echo "Extracting NWN archive failed." && exit 1)

rm /tmp/nwn.7z
« Last Edit: January 22, 2011, 09:41:12 am by malimbar04 »
Logged
No! No! I will not massacre my children. Instead, I'll make them corpulent on crappy mass-produced quarry bush biscuits and questionably grown mushroom alcohol, and then send them into the military when they turn 12...

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: making .deb package of NWN
« Reply #14 on: January 22, 2011, 12:22:58 pm »

I'm pretty sure newer versions of dpkg support lzma compression by default, that's the compression used by 7zip, so there's no need for the script or 7zip (Most distros come with an lzma inflater/deflater by default.).

I'd say the archive doesn't include all of the files, try extracting it with "7z x -o ./temp /path/to/archive.7z" (Files should show up in a directory called temp), then paste the output of "ls ./temp". You should also change "path=/usr/local/games" to "path=/usr/local/games/nwn".
Logged
Pages: [1] 2