#!/bin/sh
#----------------------------------------------------------------------------
# control_recover.cgi
#
# Creation: 2007-02-24 lanspezi
# Last Update: $Id$
#----------------------------------------------------------------------------
get_one_var()
{
var=$1
name=$2
file=$3
eval $var=`sed -n -e "s/^FLI4L_$name='\(.*\)'/\1/p" $file`
}
show_version_info ()
{
get_one_var var_version VERSION $2
get_one_var var_date BUILDDATE $2
get_one_var var_time BUILDTIME $2
var_active=""
if [ "$2" = "/boot/rc.cfg" ]
then
grep -q rootfs.img /proc/cmdline
if [ $? = 0 ]
then
var_active="active"
fi
fi
if [ "$2" = "/boot/rc2.cfg" ]
then
grep -q rootfs2.img /proc/cmdline
if [ $? = 0 ]
then
var_active="active"
fi
fi
echo "
$1 | $var_version | $var_date | $var_time | $var_active |
"
}
show_versions ()
{
show_tab_header "$_RECOVER_version_info" no
cat <
| $_RECOVER_version | $_RECOVER_date | $_RECOVER_time | |
EOF
show_version_info "$_RECOVER_current_version" /boot/rc.cfg
if [ -f /boot/kernel2 ]; then
show_version_info "$_RECOVER_recover_version" /boot/rc2.cfg
value=ask
fi
echo ""
show_tab_footer
}
. /srv/www/include/cgi-helper
: ${FORM_action:=view}
check_rights "recover" "$FORM_action"
case $FORM_action in
mkrecoverask)
show_html_header "$_RECOVER_title"
show_tab_header "$_RECOVER_titledo" no
echo '
'
show_error "" "$_RECOVER_msg1ask"
show_versions
cat <
$_RECOVER_msg2ask
EOF
show_tab_footer
show_html_footer
;;
mkrecover|$_RECOVER_yes)
show_html_header "$_RECOVER_title" "refresh=5;url=control_recover.cgi"
show_tab_header "$_RECOVER_titledo" no
echo '
'
echo "$_RECOVER_output"
show_info "" "`/usr/sbin/mkrecover.sh -webgui`
"
echo '
'
show_tab_footer
show_html_footer
;;
view|$_RECOVER_no)
show_html_header "$_RECOVER_title"
show_tab_header "$_RECOVER_titleshow" no
echo "
$_RECOVER_desc1
"
show_versions
cat <
EOF
show_tab_footer
show_html_footer
;;
esac