aboutsummaryrefslogtreecommitdiff
path: root/brweather/brweather
diff options
context:
space:
mode:
Diffstat (limited to 'brweather/brweather')
-rwxr-xr-xbrweather/brweather31
1 files changed, 17 insertions, 14 deletions
diff --git a/brweather/brweather b/brweather/brweather
index d2e6abf..467adae 100755
--- a/brweather/brweather
+++ b/brweather/brweather
@@ -6,6 +6,9 @@
# http://brweatherproject.blogspot.com/
# Distribuído sob licença GPLv3
+# Pasta base
+DIRNAME="$(dirname `dirname $0`)"
+
##Conferindo se o usuário não é root
if [ `whoami` = "root" ] ; then
echo "Erro: O BrWeather deve ser usado apenas como usuário normal."
@@ -16,11 +19,11 @@ fi
conf(){
mkdir ~/.brweather
mkdir ~/.brweather/cache
-cp /opt/brweather/doc/brweather.conf.default ~/.brweather.conf
+cp $DIRNAME/brweather/doc/brweather.conf.default ~/.brweather.conf
}
conf2(){
-cp /opt/brweather/doc/brweather.conf.default ~/.brweather.conf
+cp $DIRNAME/brweather/doc/brweather.conf.default ~/.brweather.conf
}
conf3(){
@@ -81,7 +84,7 @@ leandronkz@gmail.com"
##Versão do programa
-VERSION=`cat /opt/brweather/doc/version`
+VERSION=`cat $DIRNAME/brweather/doc/version`
##Ler arquivo de configuração
@@ -89,7 +92,7 @@ source ~/.brweather.conf
##Opções do programa que não precisam de Internet
case $1 in
- "--gerar-log") source /opt/brweather/bin/logs
+ "--gerar-log") source $DIRNAME/brweather/bin/logs
exit 0
;;
"--version") echo "BrWeather-$VERSION"
@@ -99,16 +102,16 @@ case $1 in
echo "http://brweatherproject.blogspot.com/"
exit 0
;;
- "--help") cat /opt/brweather/doc/help
+ "--help") cat $DIRNAME/brweather/doc/help
exit 0
;;
- "--help-default") cat /opt/brweather/doc/help-default
+ "--help-default") cat $DIRNAME/brweather/doc/help-default
exit 0
;;
- "--help-google") cat /opt/brweather/doc/help-google
+ "--help-google") cat $DIRNAME/brweather/doc/help-google
exit 0
;;
- "--man") man /opt/brweather/doc/man
+ "--man") man $DIRNAME/brweather/doc/man
exit 0
;;
"--clean-cache") rm ~/.brweather/log* 2>/dev/null & rm ~/.brweather/cache/* 2>/dev/null
@@ -118,13 +121,13 @@ case $1 in
"--total-images") echo -e "imagem1\nimagem2\nimagem3\nimagem4\nimagem5\nimagem6\nimagem7\nimagem8\nimagem9\nimagem10"
exit 0
;;
- "--changelog") cat /opt/brweather/doc/Changelog
+ "--changelog") cat $DIRNAME/brweather/doc/Changelog
exit 0
;;
- "--option=LUA"*) source /opt/brweather/bin/moon $*
+ "--option=LUA"*) source $DIRNAME/brweather/bin/moon $*
exit 0
;;
- "--season"*) source /opt/brweather/bin/seasons $*
+ "--season"*) source $DIRNAME/brweather/bin/seasons $*
exit 0
;;
esac
@@ -147,7 +150,7 @@ then
cat ~/.brweather/cache/previsaog | iconv -f iso-8859-1 -t $CODIGO -o ~/.brweather/cache/previsaog
fi
if [ $GOOGLE = "0" ] ; then
- if [ -f `grep -m1 -A1 '<div id="subcid">' ~/.brweather/cache/previsao | cut -f2 -d'>' | cut -f1 -d'<' | tail -n1` ] ; then
+ if [ -f "`grep -m1 -A1 '<div id="subcid">' ~/.brweather/cache/previsao | cut -f2 -d'>' | cut -f1 -d'<' | tail -n1`" ] ; then
echo "$ERRO1" > ~/.brweather/log
echo $(($TIME+10)) > ~/.brweather/cache/timer
else
@@ -423,9 +426,9 @@ esac
##Escolher entre modo Google ou INPE
if [ $GOOGLE = "0" ] ; then
- source /opt/brweather/bin/inpe $*
+ source $DIRNAME/brweather/bin/inpe $*
else
- source /opt/brweather/bin/google $*
+ source $DIRNAME/brweather/bin/google $*
fi
##Exterminador de logs ;)