all: ${SOLIB} ${LIB} conftest discotest notifytest locatetest pndnotifyd
clean:
- ${RM} -f ${ALLOBJ} ${XMLOBJ} ${LIB} ${SOLIB1} locatetest.o bin/locatetest conftest.o bin/conftest discotest.o bin/discotest bin/notifytest notifytest.o bin/pndnotifyd pndnotifyd.o ${SOLIB} testdata/dotdesktop/*.desktop
+ ${RM} -f ${ALLOBJ} ${XMLOBJ} ${LIB} ${SOLIB1} locatetest.o bin/locatetest conftest.o bin/conftest discotest.o bin/discotest bin/notifytest notifytest.o bin/pndnotifyd pndnotifyd.o ${SOLIB} testdata/dotdesktop/*.desktop testdata/apps/*.pnd
find . -name "*~*" -exec rm {} \; -print
+# component targets
+#
+
libpnd.a: ${ALLOBJ} ${XMLOBJ}
${AR} r ${LIB} ${ALLOBJ} ${XMLOBJ}
${RANLIB} ${LIB}
${CC} -shared -Wl,-soname,${SOLIB} -o ${SOLIB1} ${ALLOBJ} ${XMLOBJ}
ln -f -s ${SOLIB1} ${SOLIB}
+pndnotifyd: pndnotifyd.o ${SOLIB1}
+ ${CC} -lstdc++ -o bin/pndnotifyd pndnotifyd.o ${SOLIB1}
+
+# deployment and assembly components
+#
+
+pnd:
+ # build x86_ls with icon
+ cd testdata/pndsample; ../scripts/pnd_make.sh x86_ls.pnd x86_ls/PXML.xml x86_ls
+ cd testdata/pndsample; cat x86_ls/zeldaicon.png >> x86_ls.pnd
+ # build x86_echo with no icon
+ cd testdata/pndsample; ../scripts/pnd_make.sh x86_echo.pnd x86_echo/PXML.xml x86_echo
+
+deploy:
+ # populate deployment directory for copying into image bakes
+ # make dirs
+ mkdir -p deployment/etc/pandora/conf
+ mkdir -p deployment/usr/lib
+ mkdir -p deployment/usr/bin
+ mkdir -p deployment/usr/pandora/apps
+ mkdir -p deployment/usr/pandora/scripts
+ # copy in goodies
+ cp libpnd* deployment/usr/lib
+ cp bin/pndnotifyd deployment/usr/bin
+ cp testdata/scripts/* deployment/usr/pandora/scripts
+ # copy in freebee .pnd apps to /usr/pandora/apps
+
+# test tool targets
+#
+
conftest: conftest.o ${LIB}
${CC} -lstdc++ -o bin/conftest conftest.o libpnd.a
locatetest: locatetest.o ${SOLIB1}
${CC} -lstdc++ -o bin/locatetest locatetest.o ${SOLIB1}
-
-pndnotifyd: pndnotifyd.o ${SOLIB1}
- ${CC} -lstdc++ -o bin/pndnotifyd pndnotifyd.o ${SOLIB1}
--- /dev/null
+
+# Open Pandora
+# Application configuration
+
+[autodiscovery]
+searchpath /mnt/sd1/pandora/apps:/mnt/sd2/pandora/apps:/usr/pandora/apps # path to depth-search for PXMLs
+
+# PXMLs may be overridden .. ie: overrides are a subset of PXML, where the values are copied over the full PXML
+[overrides]
+searchpath ~/pxml-overrides
+
+# [pnd] defines where to locate the pnd support scripts, so the user may override pnd_run.sh without clobbering built in
+[pnd]
+searchpath /mnt/sd1/pandora/scripts:/mnt/sd2/pandora/scripts:/usr/pandora/scripts
+runscript pnd_run.sh
--- /dev/null
+
+# Open Pandora
+# Desktop configuration
+
+[dotfiles]
+dotdesktoppath /usr/share/applications/ # path for pndnotifyd to spit .desktop files into
--- /dev/null
+
+Overview
+--------
+
+libpnd is a basic collection of functions and tools to make working Pandora-specific
+operations easier; to wit, it is hoped multiple applications will make use of this
+library rather than re-implement similar functionality and lead to problems down the
+road. (Instead we can run into problems together and thus clobberize them.)
+
+The library is broken into parts:
+
+include - include these files to make use of the lib
+lib - the code that produces the lib
+test - mini tools to test various pieces of the lib in isolation
+bin - test tools
+testdata/ - for testing /etc/pandora; will contain 'conf' dir, for example
+
+Revisions
+---------
+
+The initial version of this code will be very limited and meant to kick-start further
+work, yet provide basic functionaliy.
+
+TODO
+----
+
+o We need an actual matchbox plugin that uses this lib to obtain app list
+
+o PND-file handling, so iso/cram/zip app bundles actually work when pnd_apps_exec()'d
+
+o PXML parser has to actually be an XML parser
+
+o UNICODE support? ie: paths and filenames and app-names..
+
+Nice to do:
+
+o Handle regexp's or globbing in searchpaths, so can do tricks like /mnt/*/app etc
+
+jeff
+
+PS: Yes, I know, the entire thing could be done in 20 lines of perl, but we wanted C to
+maximize availability.
--- /dev/null
+#!/bin/bash
+pkgname=$1
+folder=$3
+xml=$2
+mkisofs -o $pkgname.iso -R $folder
+cat $pkgname.iso $xml > $pkgname
+rm $pkgname.iso
--- /dev/null
+#!/bin/bash
+
+#input pnd_run.sh -p "/path/to/foobar.pnd" -e "exe" --a "arguments for exe"
+# -u to skip union mount
+# -s startdir
+# arguments can be inside -e, -a is optional
+
+############################# dont forget to remove the echos! ############################
+
+# parse arguments
+TEMP=`getopt -o p:e:a:b:u::s: --long p-long,e-long:,a-long: -- "$@"`
+
+if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+
+# Note the quotes around `$TEMP': they are essential!
+eval set -- "$TEMP"
+
+while true ; do
+ case "$1" in
+ -p|--p-long) echo "pnd set to \`$2'" ;PND=$2;shift 2;;
+ -e|--e-long) echo "exec set to \`$2'" ;EXENAME=$2;shift 2 ;;
+ -u) echo "u set, no union pls!";UNION=1;shift 2 ;;
+ -b) echo "BASENAME set to $2";BASENAME=$2;shift 2;;
+ -s) echo "startdir set to $2";STARTDIR=$2;shift 2;;
+ -a|--a-long)
+ case "$2" in
+ "") echo "no arguments"; shift 2 ;;
+ *) echo "args set to \`$2'" ;ARGUMENTS=$2;shift 2 ;;
+ esac ;;
+ --) shift ; break ;;
+ *) echo "Error while parsing arguments!" ; exit 1 ;;
+ esac
+done
+
+# add sanity check
+
+#vars
+DFS=$(file -b $PND | awk '{ print $1 }') # is -p a zip iso or folder?
+MOUNTPOINT=$(df $PND | grep -vE '^Filesystem' | awk '{ print $6 }') #find out which mountpoint the pnd/folder is on
+
+#if -b is set use that as basename, else generate it from PND
+#get basename (strip extension if file) for union mountpoints etc, maybe this should be changed to something specified inside the xml
+if [ ! $BASENAME ]; then BASENAME=$(basename "$PND" | cut -d'.' -f1) ; fi
+
+oCWD=$(pwd)
+# add sanity check
+
+#detect fs
+if [ $DFS = ISO ]; then
+ mntline="mount -o loop,fmask=000 $PND /mnt/pnd/$BASENAME"
+ echo "Filetype is $DFS"
+elif [ $DFS = Zip ]; then
+ mntline="fuse-zip $PND /mnt/pnd/$BASENAME -o ro,fmask=000"
+ echo "Filetype is $DFS"
+elif [ $DFS = directory ]; then
+ mntline="mount --bind -o ro,fmask=000 $PND /mnt/pnd/$BASENAME"
+#we bind the folder, now it can be treated in a unified way ATENTION: -o ro doesnt work for --bind at least on 25, on 26 its possible using remount, may have changed on 27
+ echo "Filetype is $DFS"
+else
+ echo "error"
+ exit 1;
+fi
+
+#create mountpoints
+
+if [ ! -d /mnt/pnd/$BASENAME ]; then echo "mkdir -p /mnt/pnd/$BASENAME "; fi
+if [ ! -d $MOUNTPOINT/appdata/$BASENAME ]; then echo "mkdir -p $MOUNTPOINT/appdata/$BASENAME "; fi
+if [ ! -d /mnt/utmp/$BASENAME ]; then echo "mkdir -p /mnt/utmp/$BASENAME "; fi
+
+#mount
+if [ ! $UNION ] ; then
+ #is the union already mounted? if not mount evrything, else launch the stuff
+ mount | grep "on /mnt/utmp/$BASENAME type" > /dev/null
+ if [ ! $? -eq 0 ]; then
+
+ $mntline #mount the pnd/folder
+ #mount -t unionfs -o exec,dirs\=$MOUNTPOINT/appdata/$BASENAME=rw:/mnt/pnd/$BASENAME=ro unionfs /mnt/utmp/$BASENAME #union mount
+ #aufs, one of those should work, bit unsure.
+ mount -t aufs -o exec,fmask=000,dirs\=$MOUNTPOINT/appdata/$BASENAME=rw:/mnt/pnd/$BASENAME=ro none /mnt/utmp/$BASENAME #aufs?
+ #mount -t aufs -o exec,dirs\=$MOUNTPOINT/appdata/$BASENAME=rw:/mnt/pnd/$BASENAME=ro aufs /mnt/utmp/$BASENAME #aufs?
+
+ else
+ echo "doh!"
+ fi
+
+
+ #start app
+ cd /mnt/utmp/$BASENAME
+ if [ $STARTDIR ]; then cd $STARTDIR; fi
+ $EXENAME $ARGUMENTS
+ #app exited
+
+else
+
+ $mntline
+ cd /mnt/pnd/$BASENAME
+ if [ $STARTDIR ]; then cd $STARTDIR; fi
+ $EXENAME $ARGUMENTS
+fi
+
+#clean up
+umount /mnt/utmp/$BASENAME
+if [ $? -eq 0 ]; then
+
+ umount /mnt/pnd/$BASENAME
+ rmdir /mnt/pnd/$BASENAME
+ rmdir /mnt/utmp/$BASENAME
+
+fi
--- /dev/null
+<?xml version="1.0"?>
+<PXML>
+<title>
+ <en>x86 echo</en>
+ <de>Program Title in German Language</de>
+ <fr>Program Title in French Language</fr>
+ <it>Program Title in Italian Language</it>
+</title>
+
+<unique_id>123456x86echo</unique_id>
+
+<standalone>Yes</standalone>
+
+<exec>my_echo</exec>
+
+<category>
+ <main>Main category</main>
+ <subcategory1>Subcategory 1</subcategory1>
+ <subcategory2>Subcategory 2</subcategory2>
+</category>
+
+<clockspeed>200</clockspeed>
+
+</PXML>
<standalone>Yes</standalone>
-<icon>program.png</icon>
+<icon>zeldaicon.png</icon>
<description>
<en>This is the [b]English Description[/b] of the file.