- yweb: rework, localize and enable backup/restore

This commit is contained in:
svenhoefer
2012-07-21 23:31:59 +02:00
parent 48dea3faf0
commit 17fd189410
7 changed files with 54 additions and 40 deletions

View File

@@ -24,4 +24,4 @@ TOBACKUP=$(echo $RES)
echo Backup to $1/settings_$DATE.tar
tar -cf $1/settings_$DATE.tar $TOBACKUP
tar -cf $1/settings_$DATE.tar $TOBACKUP 2>&1 >/dev/null

View File

@@ -36,27 +36,28 @@ function do_backup2()
{=var-set:wait_text=Settings=}{=include-block:Y_Blocks.txt;snip_wait=}
<div class="work_box">
<div class="work_box_head"><div class="work_box_head_h2">
{=var-set:help_url=Help-Settings-Backup_Restore=}{=var-set:menu=Backup &amp; Restore=}{=include-block:Y_Blocks.txt;work_menu=}</div></div>
{=var-set:help_url=Help-Settings-Backup_Restore=}{=var-set:menu={=L:set.menue.backup_restore=}=}{=include-block:Y_Blocks.txt;work_menu=}</div></div>
<div class="work_box_body">
<p><div style="border: 1px solid #cccccc;margin-top:20px">
<img src="/images/cross.png">&nbsp;<span><font size="2" color="Red"><b>Achtung</b>&nbsp;</font>Backup &amp; Restore ist nur bei einem gleichen Image mit gleichem Stand sinnvoll.
</span></div></p>
<br />
<p><div style="border: 1px solid #cccccc; margin-top:20px; padding: 10px;">
<img src="/images/cross.png">
<span><font size="2" color="Red"><b>{=L:attention=}</b></font> {=L:set.settings.warning=}</span>
</div></p>
<table class="y_invisible_table" cellspacing="0" width="100%">
<tr><td class="y_form_header">Backup</td></tr>
<tr><td class="y_form_header">{=L:set.settings.backup=}</td></tr>
<tr>
<td><input id="btBackup" type="button" value ="Backup" title="backup settings" onclick="do_backup()"/>
<div id="down_box" style="visibility : hidden;">
<br/><a id="down" href="" type="application/octet-stream"><u>Download settings</u></a>
</div>
<td>
<input id="btBackup" type="button" value ="{=L:set.settings.backup=}" title="{=L:set.settings.backup_desc=}" onclick="do_backup()"/>
<div id="down_box" style="visibility: hidden;">
<br/><a id="down" href="" type="application/octet-stream"><u>Download</u></a>
</div>
</td>
</tr>
<tr><td class="y_form_header">Restore</td></tr>
<tr><td class="y_form_header">{=L:set.settings.restore=}</td></tr>
<tr>
<td>
<form name="f" method="post" enctype="multipart/form-data" action="/control/exec?Y_Tools&amp;settings_backup_restore&amp;restore">
tar-File:&nbsp;<input type="file" name="filename" size="70"/>&nbsp;<br/>
<input type="button" name="su" value="Restore" title="upload and restore settings" onclick="do_submit()"/>
<input type="button" name="su" value="{=L:set.settings.restore=}" title="{=L:set.settings.restore_desc=}" onclick="do_submit()"/>
<br/><br/>
</form>
</td>

View File

@@ -53,6 +53,7 @@ function init(){
{=if-not-equal:{=global-var-get:boxtype=}~coolstream~
<li class="disabled" title="{=L:restriced_by_management_ip=}">{=L:set.menue.boot_logo=}</li>
~=}
<li class="disabled" title="{=L:restriced_by_management_ip=}">{=L:set.menue.backup_restore=}</a></li>
<li class="disabled" title="{=L:restriced_by_management_ip=}">{=L:set.menue.timer_settings=}</a></li>
~
<li><a target="work" href="Y_Settings_yWeb.yhtm">yWeb</a></li>
@@ -61,9 +62,7 @@ function init(){
{=if-not-equal:{=global-var-get:boxtype=}~coolstream~
<li><a target="work" href="Y_Tools_Bootlogo.yhtm">{=L:set.menue.boot_logo=}</a></li>
~=}
{=if-not-equal:{=global-var-get:boxtype=}~coolstream~
<li><a target="work" href="Y_Settings_Backup.yhtm">{=L:set.menue.backup_restore=}</a></li>
~=}
<li><a target="work" href="Y_Settings_Timer.yhtm">{=L:set.menue.timer_settings=}</a></li>
=}
<!--<li><a title="change layout skin" target="work" href="Y_Settings_Skin.yhtm">Skins</a></li>-->

View File

@@ -49,7 +49,8 @@ tag=Bezeichnung
empty=leer
check=prüfen
help=Hilfe
restriced_by_management_ip=Zugriff verwert wg. ManagementIP
attention=Achtung!
restriced_by_management_ip=Zugriff verwehrt wg. ManagementIP
# ==========Main Menue
main.boxcontrol=Boxsteuerung
@@ -373,6 +374,13 @@ set.timer.klack.security_code_desc=Klack Sicherheits Code
set.timer.klack.security_code=Sicherheits Code
set.timer.channel_name_replacelist=Sendernamen-Ersetzungsliste
========Settings Backup/Restore
set.settings.backup=Sichern
set.settings.backup_desc=Sichern Ihrer Einstellungen
set.settings.restore=Wiederherstellen
set.settings.restore_desc=Hochladen und wiederherstellen einer vorher erstellten Sicherung. Ihre Box startet danach neu.
set.settings.warning=Sichern &amp; Wiederherstellen ist nur bei einem gleichen Image mit gleichem Entwicklungsstand sinnvoll.
============ Tools Info
tools.info.show_messages=Kernel Meldungen
tools.info.processes=Prozesse

View File

@@ -49,6 +49,7 @@ tag=Tag
empty=empty
check=check
help=Help
attention=Attention!
restriced_by_management_ip=restricted by ManagementIP
#========= MAIN Menue
@@ -376,6 +377,13 @@ set.timer.klack.security_code_desc=your klack security code to get your data wit
set.timer.klack.security_code=Security Code
set.timer.channel_name_replacelist=Channel name replace list
========Settings Backup/Restore
set.settings.backup=Backup
set.settings.backup_desc=Backup your settings
set.settings.restore=Restore
set.settings.restore_desc=Upload and restore your settings. Your STB will reboot.
set.settings.warning=Backup & Restore is only useful for the same image with the same level of development.
============ Tools Info
tools.info.show_messages=Kernel Messages
tools.info.processes=Processes

View File

@@ -49,6 +49,7 @@ tag=Tag
empty=vazio
check=verificar
help=Ajuda
attention=Attention!
restriced_by_management_ip=restringido pela Gestão de IP
#========= Menu Principal
@@ -371,6 +372,13 @@ set.ap.decode_priority=Prioridade de decodificação
set.ap.start_dir=Diretório de Início
set.ap.parse_shoutcast=Shoutcast Meta-Data
========Settings Backup/Restore
set.settings.backup=Backup
set.settings.backup_desc=Backup your settings
set.settings.restore=Restore
set.settings.restore_desc=Upload and restore your settings. Your STB will reboot.
set.settings.warning=Backup & Restore is only useful for the same image with the same level of development.
============ Ferramentas de Informação
tools.info.show_messages=Mensagens do Kernel
tools.info.processes=Processos

View File

@@ -486,35 +486,25 @@ do_fbshot_clear()
# -----------------------------------------------------------
do_settings_backup_restore()
{
workdir="$y_path_tmp/y_save_settings"
yI_Version="0.1"
now=$(date +%Y-%m-%d_%H-%M-%S)
workdir="$y_path_tmp/y_save_settings/$now"
case "$1" in
backup)
mkdir $workdir >/dev/null
cp -r $y_path_config $workdir >/dev/null
t=`date +%y%m%d_%H%M%S`
filename="$y_path_tmp/y_Save_Settings_$t.tar"
cd $workdir
tar -cvf $filename ./* >/dev/null
rm -r $workdir >/dev/null
echo "$filename"
rm -rf $workdir
mkdir -p $workdir
/bin/backup.sh $workdir >/dev/null
filename=$(ls -1 -tr $workdir/settings_* | tail -1)
echo "$filename"
;;
restore)
msg="restore settings"
if [ -s "$y_upload_file" ]
then
# unpack /tmp/upload.tmp
cd $y_path_tmp
tar -xf "$y_upload_file"
rm $y_upload_file
cp -rf ./config /var/tuxbox/
rm -r ./config
msg="$msg ok"
else
msg="$msg error: no upload file"
fi
y_format_message_html
if [ -s "$y_upload_file" ]
then
msg=$(/bin/restore.sh "$y_upload_file")
else
msg="error: no upload file"
fi
y_format_message_html
;;
esac
}