New on the FatElk repo
#8
OK, I think I can claim to have the first app on an actual repository that uses Yoshi (apart from Yoshi itself, of course)

I ported this little Java IDE called Judo that comes in 6 interface languages, depending on the contents of a configuration file in the same directory. This meant that I had to make six different packages. Now, it has become a single package (judo_j) with a selection menu, courtesy of yoshi.

First, I relocated the configuration file to /boot/home/config/settings with a post-install script and a symlink.

Next I created six configuration files named, I kid you not, "radio=option1" to "radio=option6".

Now here comes the hard part. I don't know for a fact that the user subscribes to the FatElk repo, so if I make it a requirement I will end up with users unable to install the app. I could parse the output of pkgman list-repos, but really ... the app is not that important to me.

So the script searches for yoshi. If yoshi is not found, it defaults to an English interface. If it is found, the user is confronted with:

[Image: judo-yoshi.png]

Here's the code:

judo.yoshi
Code:
#set up the window
*.title JUDO
*.look = bordered

txt.type = text
txt.default = LANGUAGE SELECTION[return]==============
txt.lines = 3
txt.align = center

radio.type = radiobutton
radio.label = Please select the interface language for JUDO.
radio.option1 = Bahasa Indonesia
radio.option2 = English
radio.option3 = Español
radio.option4 = Français
radio.option5 = Italiano
radio.option6 = Slovenščina
radio.default = option2
radio.tooltip = Please make your selection.


Judo.sh
Code:
#!/boot/system/bin/bash

## who am i? ##
_script="$(readlink -f ${BASH_SOURCE[0]})"
## Delete last component from $_script ##
_base="$(dirname $_script)"
cd $_base

settingsfile=/boot/home/config/settings/judo.properties
tmpfile=`finddir B_COMMON_TEMP_DIRECTORY`/JUDO.out
runyoshi=`which yoshi`

if test -z $runyoshi; then
    cat 'radio=option2'>$settingsfile
    java -cp . org.judo.JUDOIDE &
    exit 0
fi

$runyoshi ./judo.yoshi>$tmpfile

#we only need the first line for this one so no need for   while IFS ...
read response < $tmpfile

if test $response = "cancel=1"; then echo "Exiting";exit 1; fi

cat $response>$settingsfile

java -cp . org.judo.JUDOIDE &
exit 0

Naturally, I inform the user in the .PackageInfo that to get the additional languages, install yoshi from the FatElk repo. I considered asking Jim if I could host a copy of Joshi, but then we end up with different versions on different repos and I think that is a bad idea.

The next version of Judo may have an alert in the post-install script telling the user to install Yoshi.
Reply


Messages In This Thread
New on the FatElk repo - by bbjimmy - 04-19-2016, 09:51 PM
RE: New on the FatElk repo - by clasqm - 04-20-2016, 03:05 AM
RE: New on the FatElk repo - by bbjimmy - 04-20-2016, 08:20 AM
RE: New on the FatElk repo - by clasqm - 04-20-2016, 11:59 AM
RE: New on the FatElk repo - by bbjimmy - 04-20-2016, 12:35 PM
RE: New on the FatElk repo - by clasqm - 04-20-2016, 01:27 PM
RE: New on the FatElk repo - by bbjimmy - 04-20-2016, 02:44 PM
RE: New on the FatElk repo - by clasqm - 04-22-2016, 06:44 AM
RE: New on the FatElk repo - by clasqm - 04-23-2016, 02:48 AM
RE: New on the FatElk repo - by bbjimmy - 04-24-2016, 08:46 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)
Free Web Hosting