#!/bin/sh
. /etc/init.d/tc-functions
TCEDIR=/etc/sysconfig/tcedir
ONDEMAND=/home/"$USER"/.jwmrc-ondemand
if [ ! -s "$ONDEMAND" ]; then
echo "" > "$ONDEMAND"
echo "" >> "$ONDEMAND"
echo "" >> "$ONDEMAND"
sync
fi
process() {
TMP="/tmp/jwm.$$" && TMP2="/tmp/jwm2.$$"
echo "exec $TCEDIR/ondemand/${1}" >> "$TMP"
merge "$TMP" "$ONDEMAND" "" > "$TMP2"
mv "$TMP2" "$ONDEMAND"
rm "$TMP"
}
if [ -n "$1" ]; then
process "$1"
else
> /home/"$USER"/.jwmrc-ondemand
[ -d "$TCEDIR"/ondemand ] && for O in `ls "$TCEDIR"/ondemand|grep -v ".img$"`; do jwm_ondemand ${O}; done
fi