2010-06-06 Raul Mateos <raulofpandora@gmail.com>

* pandora_console_upgrade: Cleaned code. Updated year.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2862 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
raulmateos 2010-06-06 22:00:52 +00:00
parent 2f8150feb1
commit aa8c412299
2 changed files with 32 additions and 31 deletions

View File

@ -1,6 +1,7 @@
2010-06-06 Raúl Mateos <raulofpandora@gmail.com> 2010-06-06 Raúl Mateos <raulofpandora@gmail.com>
* pandora_console_install: Cleaned code. Updated year. * pandora_console_install, pandora_console_upgrade: Cleaned code.
Updated year.
2010-06-06 Raúl Mateos <raulofpandora@gmail.com> 2010-06-06 Raúl Mateos <raulofpandora@gmail.com>

View File

@ -1,4 +1,4 @@
# Pandora FMS 2.0 Console Upgrade (c) 2009 Artica ST # Pandora FMS 3.1 Console Upgrade (c) 2009-2010 Artica ST
# Please see http://www.pandorafms.com # Please see http://www.pandorafms.com
# This code is licensed under GPL 2.0 license. # This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
@ -25,8 +25,8 @@ pandora_upgrade () {
echo "Installing new console code in $PANDORAPATH" echo "Installing new console code in $PANDORAPATH"
cp -R * $PANDORAPATH cp -R * $PANDORAPATH
# This makes the old-style config.php file usable with 3.0 # This makes the old-style config.php file usable with 3.x
line=$(grep "?>" -n $PANDORAPATH/include/config.php | head -1 | cut -f1 -d:) line=$(grep "?>" -n $PANDORAPATH/include/config.php | head -1 | cut -f1 -d:)
line=$(($line - 1)) line=$(($line - 1))
head -$line $PANDORAPATH/include/config.php > /tmp/asdf head -$line $PANDORAPATH/include/config.php > /tmp/asdf
@ -49,7 +49,7 @@ pandora_upgrade () {
WWWUSER=`ls -la $PANDORAPATH/index.php | awk '{ print $3 }'` WWWUSER=`ls -la $PANDORAPATH/index.php | awk '{ print $3 }'`
echo "Setting permissions for $WWWUSER in $PANDORAPATH" echo "Setting permissions for $WWWUSER in $PANDORAPATH"
chown -R $WWWUSER $PANDORAPATH chown -R $WWWUSER $PANDORAPATH
if [ "$?" -ne 0 ] if [ "$?" -ne 0 ]
then then
echo "ERROR (Cannot change $PANDORAPATH to $WWWUSER ownership)!" echo "ERROR (Cannot change $PANDORAPATH to $WWWUSER ownership)!"
return 1 return 1
@ -64,7 +64,7 @@ pandora_upgrade () {
return 1 return 1
fi fi
# Remove installer file # Remove installer file
[ -f $PANDORAPATH/install.php ] && rm -f $PANDORAPATH/install.php [ -f $PANDORAPATH/install.php ] && rm -f $PANDORAPATH/install.php
@ -77,7 +77,7 @@ pandora_upgrade () {
return 1 return 1
fi fi
# Remove unnecessary files (optional, set variable to activate) # Remove unnecessary files (optional, set variable to activate)
REMOVEFILES=0 REMOVEFILES=0
if [ "${REMOVEFILES}" -eq 1 ] if [ "${REMOVEFILES}" -eq 1 ]
@ -98,10 +98,10 @@ pandora_upgrade () {
} }
help () { help () {
echo " -p <path> Upgrade Pandora FMS Console in path (pe: /var/www/pandora_console)" echo " -p <path> Upgrade Pandora FMS Console in path (pe: /var/www/pandora_console)"
echo " -d Upgrade also Database (by default not upgrade Database) " echo " -d Upgrade also Database (by default not upgrade Database) "
echo " " echo " "
exit 0 exit 0
} }
# Script banner at start # Script banner at start
@ -121,26 +121,26 @@ fi
# Main parsing code # Main parsing code
while getopts ":hdp:" optname while getopts ":hdp:" optname
do do
case "$optname" in case "$optname" in
"h") "h")
help help
;; ;;
"d") "d")
UPGRADEDB=1 UPGRADEDB=1
;; ;;
"p") "p")
PANDORAPATH=$OPTARG PANDORAPATH=$OPTARG
UPGRADE=1 UPGRADE=1
;; ;;
?) ?)
help help
;; ;;
default) default)
help help
;; ;;
esac esac
done done
if [ "$UPGRADE" == "1" ] if [ "$UPGRADE" == "1" ]
then then