37 lines
743 B
Plaintext
37 lines
743 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
CWD=$(cd $(dirname $0) && pwd -P)
|
||
|
|
||
|
if [ -t 0 ]
|
||
|
then
|
||
|
if [ "$#" -eq 0 ]
|
||
|
then
|
||
|
>&2 echo "Usage: panel_update.sh [LEMON_TO_UPDATE]"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
case "$1" in
|
||
|
:*) LEMON="$CWD/lemons/${1#?}"
|
||
|
if [ ! -f "$LEMON" ]
|
||
|
then
|
||
|
>&2 echo "Couldn't find that lemon ($1)"
|
||
|
exit 2
|
||
|
fi
|
||
|
|
||
|
. $CWD/panel-config
|
||
|
pkill -f "bash \./lemons/${1#?}"
|
||
|
pushd "$CWD" >/dev/null
|
||
|
$LEMON > "$PANEL_FIFO" &
|
||
|
popd >/dev/null
|
||
|
;;
|
||
|
*) echo "$@" | $0
|
||
|
;;
|
||
|
esac
|
||
|
else
|
||
|
. $CWD/panel-config
|
||
|
while read -r line
|
||
|
do
|
||
|
echo "$line" > "$PANEL_FIFO" &
|
||
|
done
|
||
|
fi
|