2016-11-04 17:50:03 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2016-11-20 17:42:29 -08:00
|
|
|
CWD=$(dirname $0)
|
|
|
|
if [[ -t 0 ]]; then
|
|
|
|
if (( $# == 0 )); then
|
2016-11-04 17:50:03 -07:00
|
|
|
>&2 echo "Usage: panel_update.sh [LEMON_TO_UPDATE]"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-11-20 17:42:29 -08:00
|
|
|
case $1 in
|
2016-11-04 17:50:03 -07:00
|
|
|
:*) LEMON="$CWD/lemons/${1#?}"
|
2016-11-20 17:42:29 -08:00
|
|
|
if [[ ! -f $LEMON ]]; then
|
2016-11-04 17:50:03 -07:00
|
|
|
>&2 echo "Couldn't find that lemon ($1)"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2016-11-20 17:42:29 -08:00
|
|
|
. "$CWD/panel-config"
|
|
|
|
pkill -f "[bd]ash .+/lemons/${1#?}"
|
|
|
|
"$LEMON" > "$PANEL_FIFO" &
|
2016-11-04 17:50:03 -07:00
|
|
|
;;
|
|
|
|
*) echo "$@" | $0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
. $CWD/panel-config
|
2016-11-20 17:42:29 -08:00
|
|
|
while read -r line; do
|
2016-11-04 17:50:03 -07:00
|
|
|
echo "$line" > "$PANEL_FIFO" &
|
|
|
|
done
|
|
|
|
fi
|