mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
- yWeb: cleanup
Conflicts: data/y-web/Y_Blocks.txt data/y-web/Y_Live_Menue.yhtm data/y-web/Y_Tools_Flash_Upload.yhtm data/y-web/Y_Version.txt data/y-web/extentions/boxinfo/files/httpd/scripts/Y_Ext_BoxInfo.sh data/y-web/languages/Czech data/y-web/languages/Deutsch data/y-web/languages/English data/y-web/languages/Makefile.am data/y-web/languages/Polski data/y-web/languages/Portuguese data/y-web/languages/Slovak data/y-web/scripts/Y_NI_Tools.sh data/y-web/scripts/Y_Tools.sh data/y-web/scripts/api.sh data/y-web/ywidget.css Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#!/bin/sh
|
||||
# -----------------------------------------------------------
|
||||
# Tools (yjogol)
|
||||
# $Date$
|
||||
# $Revision$
|
||||
# -----------------------------------------------------------
|
||||
|
||||
. ./_Y_Globals.sh
|
||||
. ./_Y_Library.sh
|
||||
|
||||
# ===========================================================
|
||||
# Settings : Styles
|
||||
# ===========================================================
|
||||
@@ -46,6 +46,7 @@ style_get()
|
||||
done
|
||||
echo "$html_option_list"
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Set Style: override Y_Main.css $1=Style-Name
|
||||
# -----------------------------------------------------------
|
||||
@@ -69,6 +70,7 @@ style_set()
|
||||
config_set_value_direct $y_config_Y_Web 'style'
|
||||
fi
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Image Backup - build form
|
||||
# -----------------------------------------------------------
|
||||
@@ -84,93 +86,7 @@ image_upload()
|
||||
fi
|
||||
y_format_message_html
|
||||
}
|
||||
# ===========================================================
|
||||
# Flashimage
|
||||
# ===========================================================
|
||||
# -----------------------------------
|
||||
# Flash-Backup ($1=mtd Nummer)
|
||||
# -----------------------------------
|
||||
image_backup_mtd()
|
||||
{
|
||||
rm /tmp/*.img
|
||||
cat /dev/mtd/$1 > /tmp/flash_mtd$1.img
|
||||
}
|
||||
# -----------------------------------
|
||||
# Sende Download-Page ($1=mtd Nummer)
|
||||
# -----------------------------------
|
||||
# -----------------------------------
|
||||
image_delete_download_page()
|
||||
{
|
||||
rm -r /tmp/*.img
|
||||
# msg="<div class='y_work_box'><b>The image file in tmp was extinguished.</b></div>"
|
||||
# y_format_message_html
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# Flash ($1=mtd Nummer) Upload-File $2=true/false =simulate
|
||||
# -----------------------------------------------------------
|
||||
flash_mtd()
|
||||
{
|
||||
simulate="true"
|
||||
if [ "$2" = "false" ]
|
||||
then
|
||||
simulate="false"
|
||||
fi
|
||||
rm /tmp/*.img
|
||||
if [ -s "$y_upload_file" ]
|
||||
then
|
||||
echo "" >/tmp/e.txt
|
||||
msg_nmsg "Image%20%20flashing!"
|
||||
if [ "$simulate" = "false" ]
|
||||
then
|
||||
umount /hdd #yet: fixed setting
|
||||
fcp -v "$y_upload_file" /dev/mtd/$1 >/tmp/e.txt
|
||||
else #simulation/DEMO
|
||||
i="0"
|
||||
while test $i -le 10
|
||||
do
|
||||
p=`expr $i \* 10`
|
||||
b=`expr $i \* 63`
|
||||
b=`expr $b / 10`
|
||||
echo -e "\rDEMO: Erasing blocks: $b/63 ($p%)" >>/tmp/e.txt
|
||||
i=`expr $i + 1`
|
||||
sleep 1
|
||||
done
|
||||
i="0"
|
||||
while test $i -le 20
|
||||
do
|
||||
p=`expr $i \* 5`
|
||||
b=`expr $i \* 8064`
|
||||
b=`expr $b / 20`
|
||||
echo -e "\rDEMO: Writing data: $b k/8064k ($p%)" >>/tmp/e.txt
|
||||
i=`expr $i + 1`
|
||||
sleep 2
|
||||
done
|
||||
i="0"
|
||||
while test $i -le 5
|
||||
do
|
||||
p=`expr $i \* 20`
|
||||
b=`expr $i \* 8064`
|
||||
b=`expr $b / 5`
|
||||
echo -e "\rDEMO: Verifying data: $b k/8064k ($p%)" >>/tmp/e.txt
|
||||
i=`expr $i + 1`
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
msg_nmsg "flashing%20ready.%20Reboot..."
|
||||
msg="flashing done ... please reboot box now ..."
|
||||
msg="$msg <script language='JavaScript' type='text/javascript'>window.setTimeout('parent.do_image_flash_ready()',1000)</script>"
|
||||
y_format_message_html
|
||||
|
||||
if [ "$simulate" = "false" ]
|
||||
then
|
||||
busybox reboot -d10
|
||||
fi
|
||||
else
|
||||
msg="Upload-Problem.<br>Try again, please."
|
||||
msg="$msg <script language='JavaScript' type='text/javascript'>window.setTimeout('parent.do_image_flash_ready()',1000)</script>"
|
||||
y_format_message_html
|
||||
fi
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# copies Uploadfile to $1
|
||||
# -----------------------------------------------------------
|
||||
@@ -183,20 +99,7 @@ upload_copy()
|
||||
msg="Upload-Problem.<br>Try again, please."
|
||||
fi
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
bootlogo_upload()
|
||||
{
|
||||
msg="Boot-Logo installed"
|
||||
upload_copy "$y_boot_logo"
|
||||
y_format_message_html
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
bootlogo_lcd_upload()
|
||||
{
|
||||
msg="Boot-Logo-LCD installed"
|
||||
upload_copy "$y_boot_logo_lcd"
|
||||
y_format_message_html
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
zapit_upload()
|
||||
{
|
||||
@@ -204,6 +107,7 @@ zapit_upload()
|
||||
upload_copy "$y_path_zapit/$1"
|
||||
y_format_message_html
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Mount from Neutrino-Settings $1=nr
|
||||
# -----------------------------------------------------------
|
||||
@@ -248,13 +152,13 @@ do_mount()
|
||||
case "$fstype" in
|
||||
0) # nfs
|
||||
cmd="mount -t nfs $ip:$dir $local_dir"
|
||||
;;
|
||||
;;
|
||||
1) # cifs
|
||||
cmd="mount -t cifs //$ip/$dir $local_dir -o username=$username,password=$password";
|
||||
;;
|
||||
;;
|
||||
2) # lufs
|
||||
cmd="lufsd none $local_dir -o fs=ftpfs,username=$username,password=$password,host=$ip,root=/$dir";
|
||||
;;
|
||||
;;
|
||||
default)
|
||||
echo "mount type not supported"
|
||||
esac
|
||||
@@ -283,6 +187,7 @@ do_mount()
|
||||
msg="mount cmd:$cmd<br><br>res=$res<br>view Mounts;<br>$m"
|
||||
y_format_message_html
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# unmount $1=local_dir
|
||||
# -----------------------------------------------------------
|
||||
@@ -290,6 +195,7 @@ do_unmount()
|
||||
{
|
||||
umount $1
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# AutoMount
|
||||
# deactivate mount "#" replaces "---" and "=" replaced ",,"
|
||||
@@ -307,12 +213,14 @@ do_automount_list()
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
do_automount_getline()
|
||||
{
|
||||
mountname=`echo "$2"|sed -e "s/---/#/g"`
|
||||
cat $1|sed -n "/^[#]*$mountname[^a-zA-Z0-9]/p"
|
||||
cat $1 | sed -n "/^[#]*$mountname[^a-zA-Z0-9]/p"
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# $1:filename, $2:mountname, $3-*:mountstring
|
||||
# -----------------------------------------------------------
|
||||
@@ -337,6 +245,7 @@ do_automount_setline()
|
||||
|
||||
kill -HUP `cat /var/run/automount.pid`
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Execute shell command
|
||||
# 1: directory 2: append [true|false] 3+: cmd
|
||||
@@ -371,6 +280,7 @@ do_cmd()
|
||||
echo 'parent.document.f.cmd.focus();'
|
||||
echo '</script></body></html>'
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# yInstaller
|
||||
# un-tar uploaded file to /tmp. Execute included install.sh
|
||||
@@ -404,7 +314,7 @@ do_installer()
|
||||
echo '</head>'
|
||||
echo "<body><a href='$y_out_html'>If automatic forwarding does not go.</a>"
|
||||
echo '</body></html>'
|
||||
# cat $y_out_html
|
||||
#cat $y_out_html
|
||||
else
|
||||
echo '<html><head>'
|
||||
echo '<link rel="stylesheet" type="text/css" href="/Y_Main.css">'
|
||||
@@ -450,6 +360,7 @@ do_ext_installer()
|
||||
echo "error: $y_install not found. wget=$wgetlog $e"
|
||||
fi
|
||||
}
|
||||
|
||||
do_ext_uninstaller()
|
||||
{
|
||||
uinst="%(CONFIGDIR)/ext/uninstall.sh"
|
||||
@@ -458,6 +369,7 @@ do_ext_uninstaller()
|
||||
`$uinst $1_uninstall.inc`
|
||||
fi
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# view /proc/$1 Informations
|
||||
# -----------------------------------------------------------
|
||||
@@ -467,6 +379,7 @@ proc()
|
||||
msg="<b>proc: $1</b><br><br>$msg"
|
||||
y_format_message_html
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# wake up $1=MAC
|
||||
# -----------------------------------------------------------
|
||||
@@ -478,6 +391,7 @@ wol()
|
||||
msg="<b>Wake on LAN $1</b><br><br>$msg"
|
||||
y_format_message_html
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# lcd shot
|
||||
# $1= optionen | leer
|
||||
@@ -490,6 +404,7 @@ do_lcshot()
|
||||
$y_path_bin/lcshot $*
|
||||
fi
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# osd shot
|
||||
# $1= fbshot | grab
|
||||
@@ -512,6 +427,7 @@ do_fbshot()
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# delete fbshot created graphics
|
||||
# -----------------------------------------------------------
|
||||
@@ -520,6 +436,7 @@ do_fbshot_clear()
|
||||
rm /tmp/*.bmp
|
||||
rm /tmp/*.png
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# delete screenshots
|
||||
# -----------------------------------------------------------
|
||||
@@ -527,6 +444,7 @@ do_screenshot_clear()
|
||||
{
|
||||
rm -f /tmp/*.png
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Settings Backup/Restore
|
||||
# -----------------------------------------------------------
|
||||
@@ -542,7 +460,6 @@ do_settings_backup_restore()
|
||||
filename=$(ls -1 -tr $workdir/settings_* | tail -1)
|
||||
echo "$filename"
|
||||
;;
|
||||
|
||||
restore)
|
||||
if [ -s "$y_upload_file" ]
|
||||
then
|
||||
@@ -554,81 +471,57 @@ do_settings_backup_restore()
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
restart_neutrino()
|
||||
{
|
||||
echo "fixme"
|
||||
# kill -HUP `pidof neutrino`
|
||||
#kill -HUP `pidof neutrino`
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Main
|
||||
# -----------------------------------------------------------
|
||||
#debug
|
||||
# echo "call:$*" >> "/tmp/debug.txt"
|
||||
# debug
|
||||
#echo "call:$*" >> "/tmp/debug.txt"
|
||||
case "$1" in
|
||||
style_set) style_set $2 ;;
|
||||
style_get) style_get ;;
|
||||
image_upload) image_upload ;;
|
||||
image_backup) image_backup_mtd $2; echo "/tmp/flash_mtd$2.img" ;;
|
||||
image_flash) shift 1; flash_mtd $* ;;
|
||||
image_flash_free_tmp) rm -r /tmp/*.img ;;
|
||||
image_delete) image_delete_download_page ;;
|
||||
bootlogo_upload) bootlogo_upload ;;
|
||||
bootlogo_lcd_upload) bootlogo_lcd_upload ;;
|
||||
zapit_upload) zapit_upload $2 ;;
|
||||
kernel-stack) msg=`dmesg`; y_format_message_html ;;
|
||||
ps) msg=`ps aux`; y_format_message_html ;;
|
||||
free) f=`free`; p=`df -h`; msg="RAM Memory use\n-------------------\n$f\n\nPartitions\n-------------------\n$p"
|
||||
y_format_message_html ;;
|
||||
yreboot) reboot; echo "Reboot..." ;;
|
||||
ps) msg=`ps aux`; y_format_message_html ;;
|
||||
free) f=`free`; p=`df -h`; msg="RAM Memory use\n-------------------\n$f\n\nPartitions\n-------------------\n$p"; y_format_message_html ;;
|
||||
yreboot) reboot; echo "Reboot..." ;;
|
||||
check_yWeb_conf) check_Y_Web_conf ;;
|
||||
rcsim) rcsim $2 >/dev/null ;;
|
||||
domount) shift 1; do_mount $* ;;
|
||||
dounmount) shift 1; do_unmount $* ;;
|
||||
cmd) shift 1; do_cmd $* ;;
|
||||
installer) shift 1; do_installer $* 2>&1 ;;
|
||||
rcsim) rcsim $2 >/dev/null ;;
|
||||
domount) shift 1; do_mount $* ;;
|
||||
dounmount) shift 1; do_unmount $* ;;
|
||||
cmd) shift 1; do_cmd $* ;;
|
||||
installer) shift 1; do_installer $* 2>&1 ;;
|
||||
ext_uninstaller) shift 1; do_ext_uninstaller $* 2>&1 ;;
|
||||
ext_installer) shift 1; do_ext_installer $* 2>&1 ;;
|
||||
proc) shift 1; proc $* ;;
|
||||
wol) shift 1; wol $* ;;
|
||||
lcshot) shift 1; do_lcshot $* ;;
|
||||
fbshot) shift 1; do_fbshot $* ;;
|
||||
proc) shift 1; proc $* ;;
|
||||
wol) shift 1; wol $* ;;
|
||||
lcshot) shift 1; do_lcshot $* ;;
|
||||
fbshot) shift 1; do_fbshot $* ;;
|
||||
fbshot_clear) do_fbshot_clear ;;
|
||||
screenshot_clear) do_screenshot_clear ;;
|
||||
get_update_version) wget -q -O /tmp/version.txt "https://raw.githubusercontent.com/tuxbox-neutrino/gui-neutrino/master/data/y-web/Y_Version.txt" ;;
|
||||
settings_backup_restore) shift 1; do_settings_backup_restore $* ;;
|
||||
exec_cmd) shift 1; $* ;;
|
||||
exec_cmd) shift 1; $* ;;
|
||||
automount_list) shift 1; do_automount_list $* ;;
|
||||
automount_getline) shift 1; do_automount_getline $* ;;
|
||||
automount_setline) shift 1; do_automount_setline $* ;;
|
||||
restart_neutrino) restart_neutrino ;;
|
||||
have_plugin_scripts) find %(PLUGINDIR_VAR) -name '*.sh' ;;
|
||||
|
||||
timer_get_tvinfo)
|
||||
shift 1
|
||||
rm -r /tmp/tvinfo.xml
|
||||
res=$(curl -o /tmp/tvinfo.xml -vs "https://www.tvinfo.de/share/openepg/schedule.php?username=$1&password=$2" 2>&1)
|
||||
if ! [ -s /tmp/tvinfo.xml ]
|
||||
then
|
||||
res="$res File empty!"
|
||||
fi
|
||||
echo "$res"
|
||||
;;
|
||||
|
||||
timer_get_klack)
|
||||
config_open $y_config_Y_Web
|
||||
url=`config_get_value "klack_url"`
|
||||
klack_url=`echo "$url"|sed -e 's/;/\&/g'`
|
||||
securitycode=`config_get_value "klack_securitycode"`
|
||||
klack_url=`echo "$klack_url&secCode=$securitycode"`
|
||||
wget -O /tmp/klack.xml "$klack_url" 2>&1 ;;
|
||||
have_plugin_scripts) find %(PLUGINDIR_VAR) -name '*.sh' ;;
|
||||
|
||||
restart_sectionsd)
|
||||
killall sectionsd
|
||||
sectionsd >/dev/null 2>&1
|
||||
msg="sectionsd reboot. ok."
|
||||
y_format_message_html
|
||||
;;
|
||||
|
||||
;;
|
||||
get_synctimer_channels)
|
||||
if [ -e "$y_path_config/channels.txt" ]
|
||||
then
|
||||
@@ -636,8 +529,7 @@ case "$1" in
|
||||
else
|
||||
cat $y_path_httpd/channels.txt
|
||||
fi
|
||||
;;
|
||||
|
||||
;;
|
||||
get_extension_list)
|
||||
if [ -e "$y_path_config/extentions.txt" ]
|
||||
then
|
||||
@@ -645,19 +537,16 @@ case "$1" in
|
||||
else
|
||||
cat $y_path_httpd/extentions.txt
|
||||
fi
|
||||
;;
|
||||
|
||||
;;
|
||||
write_extension_list)
|
||||
shift 1
|
||||
echo "$*" >$y_path_config/extentions.txt
|
||||
;;
|
||||
|
||||
;;
|
||||
url_get)
|
||||
shift 1
|
||||
res=`wget -O /tmp/$2 "$1" >/tmp/url.log 2>&1`
|
||||
cat /tmp/$2
|
||||
;;
|
||||
|
||||
;;
|
||||
mtd_space|var_space)
|
||||
df | while read fs rest; do
|
||||
case ${fs:0:3} in
|
||||
@@ -667,13 +556,13 @@ case "$1" in
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
;;
|
||||
tmp_space)
|
||||
df /tmp|grep /tmp
|
||||
;;
|
||||
;;
|
||||
get_hostname)
|
||||
echo -n $(hostname)
|
||||
;;
|
||||
*)
|
||||
echo "[Y_Tools.sh] Parameter wrong: $*" ;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user