Quick Script For Automated Setup


Aninhumer

Guy with scary face.
Joined
Dec 13, 2005
Messages
1,156
Age
32
Website
Visit site
Despite the development of the PND system, I've seen quite a few people being confused by file placement already.
This could be solved by a quick script that checks if the files exist, and prompts for their location otherwise.
I'm sure many devs are working on much more important bugs, so I thought I'd post this script for packagers to adapt:
(Example for prboom. Untested. Variables possibly incorrect, but you get the idea.)

Code:
#!/bin/bash

TARGET="./doom.wad"            #The location for the necessary file
TITLE="Locate Doom .wad file"  #Window title of file selector
FILE_FILTER="*.wad"            #Filter on displayed files
LAUNCH="./prboom"              #Command to run after script is finished

if ! ls $TARGET
then
    FILE=`zenity --title "$TITLE" --file-selection --file-filter "$FILE_FILTER"`
    if [ $? != 0 ]; then exit; fi
    cp $FILE $TARGET
fi

exec $LAUNCH
I'm assuming that anything written to the . local directory by this script will go to the correct appdata/ directory automatically?

This script can also be adapted in various ways, you could run checksums to make sure the file is correct, for example.

Note:
FILE_FILTER takes the form: (Filetype description | ) filter1 (filter2 filter3 ...)
So for example: "Archives (zip/rar/7z) | *.zip *.rar *.7z"
 
A few of us do this, and I consider it 'good pnd form' when time permits. ie: Hatari will prompt "hey, you'r emissing TOS, put it here /foo" rather than just silently exit.

Hopefully a lot of 'best practices' will come up over the next little while..

I put in some in the pnd dev wiki; ie: always include documentation if theres any setup for your application at all; its automatically handled so you just supply a file and a line in the PXML, so every non-trivial app should have a documentation entry in the xfce and minimenu menus. Stuff like that, hopefulyl will catch on :)

jeff
 
skeezix said:
A few of us do this, and I consider it 'good pnd form' when time permits. ie: Hatari will prompt "hey, you'r emissing TOS, put it here /foo" rather than just silently exit.
While that's certainly better, I think actually prompting for the file and copying it automatically is probably best, as there are various different ways someone could get confused even by that message.

I put in some in the pnd dev wiki; ie: always include documentation if theres any setup for your application at all; its automatically handled so you just supply a file and a line in the PXML, so every non-trivial app should have a documentation entry in the xfce and minimenu menus. Stuff like that, hopefulyl will catch on :)
I certainly think something integrated into libpnd would be very nice, although as I said above, it would probably have to be more complex than just a documentation dialog.

Shoving READMEs in people's faces will probably go a long way to helping, but it's still not exactly "professional". ;)
 
Last edited by a moderator:
Back
Top