Results 1 to 6 of 6

Thread: How to create custom fortune files?

  1. #1
    Join Date
    Aug 2006
    Location
    Uppsala, Sweden
    Beans
    136
    Distro
    Ubuntu 10.04 Lucid Lynx

    How to create custom fortune files?

    Hello,

    I saw a very cute litte application called "Wanda the Fish", which is a GUI verision of command line program "fortune". Now, I would like to create my own fortune cookies, which can be found in /usr/share/games/fortunes, but found that together with the text file containing the text, theres a binary .dat file.
    My question is: how do I create these .dat files in order to make my custom made fortunes? Searched the web but could only find manuals to fortune itself (which I've already read, hope I didn't miss something) or some pre-made files.
    Thanks for any help!
    PGP public key: 0xB39B0BA9

  2. #2
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    fortunes

    The package fortunes is the one with the data. Try grabbing the source package and poking around in that.


    Here is a somewhat old document that tells how to work with src packages:
    http://www.debian.org/doc/manuals/ap...ndling.en.html

  3. #3
    Join Date
    Aug 2006
    Location
    Uppsala, Sweden
    Beans
    136
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to create custom fortune files?

    OK, thank you very much for your help and time, but the solution was (as usual) to read the manual once again, this time more carefully. As I couldn't google a howto, I hereby create one.

    HOWTO: create custom fortune cookies files
    1. Open your favourite editor and add the strings that you want to be shown when running "fortune" in terminal. BE SURE to add a single line with a letter % in it, between every string.
    2. Save this file to whatever file name you want; this guide uses "yourlist" as example.
    3. When done adding strings, run the command "strfile -c % yourlist yourlist.dat". This will create a .dat file for your cookie file, which contains a header structure and a table of file offsets for each group of lines. This allows random access of the strings.
    4. Run "fortune yourlist" to eat the fruit of your work. That's it!
    5. If you want this cookie file to appear as any other of the standard fortune cookies (when simply running "fortune"), just add your string file and .dat file into "/usr/share/games/fortunes/".
    6. Oh, and one more thing: if you want to change anything in "yourfile", you will need to repeat this HOWTO again for it to work.


    Good luck!
    PGP public key: 0xB39B0BA9

  4. #4
    Join Date
    Oct 2010
    Location
    Dayton, Ohio
    Beans
    75
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to create custom fortune files?

    Just wanted to say "Thanks" publicly for this. I'd been searching for a while myself for exactly this reason - though I've been piping the output through cowsay instead.
    I inject people with radioactive stuff for a living. But only to serve the forces of good.
    webpage | blog

  5. #5
    Join Date
    Apr 2010
    Beans
    7

    Re: How to create custom fortune files?

    Thank you, qrwe! That's very helpful. I created my own custom fortunes in no time

  6. #6
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,616
    Distro
    Ubuntu

    Re: How to create custom fortune files?


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •