mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
- yWeb: add hddtools extention source
This commit is contained in:
45
src/nhttpd/web/extentions/hddtools/files/httpd/Y_Ext_hddtools.yhtm
Executable file
45
src/nhttpd/web/extentions/hddtools/files/httpd/Y_Ext_hddtools.yhtm
Executable file
@@ -0,0 +1,45 @@
|
||||
{=include-block:Y_Blocks.txt;head=}
|
||||
<script type="text/javascript" src="/Y_Baselib.js"></script>
|
||||
<script type="text/javascript" src="/prototype.js"></script>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function goUrl(_cmd){
|
||||
$('out').update(dbox_exec_hdd(_cmd));
|
||||
}
|
||||
function dbox_exec_hdd(_cmd){
|
||||
var __cmd = _cmd.replace(/ /g, "&");
|
||||
return loadSyncURL("/control/exec?Y_Ext_hddtools&"+__cmd);
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="work_box">
|
||||
<div class="work_box_head">
|
||||
<div class="work_box_head_h2">{=var-set:help_url=Help-Extensions-hddtools=}{=var-set:menu=HDD Tools [1.0.1]=}{=include-block:Y_Blocks.txt;work_menu=}</div></div>
|
||||
<div class="work_box_body">
|
||||
<form action="">
|
||||
<table class="y_invisible_table" cellpadding="5">
|
||||
<tr><td class="y_form_header">IDE Information</td></tr>
|
||||
<tr><td>
|
||||
<input type="button" value="Info Boot" title="show drive info from boot" onclick='goUrl("hdd_hdparm&-i&Info boot time");'/>
|
||||
<input type="button" value="Info Drive" title="show drive info" onclick='goUrl("hdd_hdparm&-I&Info Drive");'/>
|
||||
<input type="button" value="Identity" title="show hdd model name" onclick='goUrl("hdd_proc&model&Model");'/>
|
||||
<input type="button" value="Settings" title="show ide settings" onclick='goUrl("hdd_proc&settings&IDE Settings");'/>
|
||||
<input type="button" value="Driver" title="show ide settings" onclick='goUrl("hdd_proc&driver&IDE Driver");'/>
|
||||
<input type="button" value="Settings" title="show ide settings" onclick='goUrl("hdd_proc&cache&IDE Cache");'/>
|
||||
<input type="button" value="Geometrie" title="show ide settings" onclick='goUrl("hdd_proc&geometry&Disk Geometrie");'/>
|
||||
</td></tr>
|
||||
<tr><td class="y_form_header">Commands</td></tr>
|
||||
<tr><td>
|
||||
<input type="button" value="hdd sleep" title="put drive to sleep mode" onclick='goUrl("hdd_sleep");'/>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="out"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
50
src/nhttpd/web/extentions/hddtools/files/httpd/scripts/Y_Ext_hddtools.sh
Executable file
50
src/nhttpd/web/extentions/hddtools/files/httpd/scripts/Y_Ext_hddtools.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
# -----------------------------------------------------------
|
||||
# HDD (yjogol)
|
||||
# $Date: 2007-12-29 10:11:37 $
|
||||
# $Revision: 1.1 $
|
||||
# -----------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------
|
||||
hdd_proc1="/proc/ide/ide0/hda"
|
||||
hdd_model1="$hdd_proc1/model"
|
||||
hdd_settings1="$hdd_proc1/settings"
|
||||
disc1="/dev/ide/host0/bus0/target0/lun0/disc"
|
||||
# -----------------------------------------------------------
|
||||
y_format_message_html()
|
||||
{
|
||||
tmp="<html><head><meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>"
|
||||
tmp="$tmp <link rel='stylesheet' type='text/css' href='/Y_Main.css'></head>"
|
||||
tmp="$tmp <body><div class='work_box'><div class='work_box_head'><div class='work_box_head_h2'>Results</div></div><div class='work_box_body' style='overflow:auto'>"
|
||||
tmp="$tmp <pre>\n$msg\n</pre></div></div></body></html>"
|
||||
|
||||
# tmp="$tmp <body><div class='y_work_box'><pre>\n$msg\n</pre></div></body></html>"
|
||||
echo -e "$tmp"
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# Main
|
||||
# -----------------------------------------------------------
|
||||
case "$1" in
|
||||
hdd_proc)
|
||||
msg=`cat $hdd_proc1/$2`
|
||||
msg="<b>$3</b><br><br>$msg"
|
||||
y_format_message_html
|
||||
;;
|
||||
|
||||
hdd_sleep)
|
||||
msg=`hdparm -Y $disc1`
|
||||
msg="<b>Sleep</b><br><br>$msg"
|
||||
y_format_message_html
|
||||
;;
|
||||
|
||||
hdd_hdparm)
|
||||
msg=`hdparm $2 $disc1`
|
||||
msg="<b>$3</b><br><br>$msg"
|
||||
y_format_message_html
|
||||
;;
|
||||
*)
|
||||
echo "[Y_HDD.sh] Parameter falsch: $*" ;;
|
||||
esac
|
||||
|
||||
|
||||
|
20
src/nhttpd/web/extentions/hddtools/hddtools_uninstall.inc
Normal file
20
src/nhttpd/web/extentions/hddtools/hddtools_uninstall.inc
Normal file
@@ -0,0 +1,20 @@
|
||||
# ===========================================================
|
||||
# yWeb SDK: Extention Unnstaller Include
|
||||
# Extention Name: hddtools
|
||||
# by yjogol
|
||||
# -----------------------------------------------------------
|
||||
# $Date: 2007-12-29 10:11:37 $
|
||||
# $Revision: 1.1 $
|
||||
# ===========================================================
|
||||
|
||||
yI_updatename="yWeb-Extension hddtools (08.01.2008)"
|
||||
yI_Ext_Tag="hddtools"
|
||||
yI_Ext_Version="1-0-1"
|
||||
yI_uninstall_log="$y_path_tmp/uninstall_hddtools.log"
|
||||
yI_uninstaller="hddtools_uninstall.inc"
|
||||
|
||||
uninstall()
|
||||
{
|
||||
rm $y_ywebover_dir/Y_Ext_hddtools.yhtm
|
||||
rm $y_ywebover_dir/scripts/Y_Ext_hddtools.sh
|
||||
}
|
20
src/nhttpd/web/extentions/hddtools/install.inc
Normal file
20
src/nhttpd/web/extentions/hddtools/install.inc
Normal file
@@ -0,0 +1,20 @@
|
||||
# ===========================================================
|
||||
# yWeb SDK: Extention Installer Include
|
||||
# Extention Name: boxinfo
|
||||
# by yjogol
|
||||
# -----------------------------------------------------------
|
||||
# $Date: 2007-12-29 10:11:37 $
|
||||
# $Revision: 1.1 $
|
||||
# ===========================================================
|
||||
|
||||
yI_updatename="yWeb-Extension hddtools (08.01.2008)"
|
||||
yI_Ext_Tag="hddtools"
|
||||
yI_Ext_Version="1-0-1"
|
||||
yI_install_log="$y_path_tmp/install_hddtools.log"
|
||||
yI_uninstaller="hddtools_uninstall.sh"
|
||||
|
||||
install()
|
||||
{
|
||||
cp -r /tmp/files/httpd/* $y_ywebover_dir
|
||||
chmod 755 $y_ywebover_dir/scripts/*.sh
|
||||
}
|
143
src/nhttpd/web/extentions/hddtools/install.sh
Executable file
143
src/nhttpd/web/extentions/hddtools/install.sh
Executable file
@@ -0,0 +1,143 @@
|
||||
# ===========================================================
|
||||
# yWeb Extension: Install an Extension
|
||||
# by yjogol
|
||||
# -----------------------------------------------------------
|
||||
# $Date: 2007-12-29 10:11:37 $
|
||||
# $Revision: 1.3 $
|
||||
# -----------------------------------------------------------
|
||||
# Script starts in /tmp
|
||||
# ===========================================================
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Installer Configs
|
||||
# -----------------------------------------------------------
|
||||
yI_Version="$Revision: 1.3 $"
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Dirs
|
||||
# -----------------------------------------------------------
|
||||
y_path_usrbin="/var/bin"
|
||||
y_path_config="/var/tuxbox/config"
|
||||
y_path_tmp="/tmp"
|
||||
y_ywebover_dir="/var/httpd"
|
||||
y_ext_conf_dir="$y_path_config/ext"
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Files
|
||||
# -----------------------------------------------------------
|
||||
y_config_Y_Web="$y_path_config/Y-Web.conf"
|
||||
y_config_nhttpd="$y_path_config/nhttpd.conf"
|
||||
y_config_neutrino="$y_path_config/neutrino.conf"
|
||||
y_upload_file="$y_path_tmp/upload.tmp"
|
||||
|
||||
# ===========================================================
|
||||
# config-Dateien - lesen / schreiben
|
||||
# (Zeilenformat: VarName=VarValue)
|
||||
# ===========================================================
|
||||
cfg=""
|
||||
# -----------------------------------------------------------
|
||||
# config-Datei lesen/cachen (Inhalt in $cfg)
|
||||
# $1=config-Filename
|
||||
# -----------------------------------------------------------
|
||||
config_open()
|
||||
{
|
||||
cfg=""
|
||||
cfg=`cat $1`
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# config-Datei schreiben (Inhalt in $cfg)
|
||||
# $1=config-Filename
|
||||
# -----------------------------------------------------------
|
||||
config_write()
|
||||
{
|
||||
echo "$cfg" >$1
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# Variablenwert zurueckgeben (vorher open)
|
||||
# $1=VarName
|
||||
# -----------------------------------------------------------
|
||||
config_get_value()
|
||||
{
|
||||
cmd="sed -n /^$1=/p"
|
||||
tmp=`echo "$cfg" | $cmd`
|
||||
cmd="sed -e s/^$1=//1"
|
||||
tmp=`echo "$tmp" | $cmd`
|
||||
echo $tmp
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# Variablenwert zurueckgeben (ohne open)
|
||||
# $1=config-Filename
|
||||
# $2=VarName
|
||||
# -----------------------------------------------------------
|
||||
config_get_value_direct()
|
||||
{
|
||||
config_open $1
|
||||
config_get_value $2
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# Variablenwert setzen (vorher open)
|
||||
# $1=VarName)
|
||||
# $2=VarValue
|
||||
# -----------------------------------------------------------
|
||||
config_set_value()
|
||||
{
|
||||
tmp=`echo "$cfg" | sed -n "/^$1=.*/p"`
|
||||
if [ "$tmp" = "" ]
|
||||
then
|
||||
cfg=`echo -e "$cfg\n$1=$2"`
|
||||
else
|
||||
cmd="sed -e s/^$1=.*/$1=$2/g"
|
||||
cfg=`echo "$cfg" | $cmd`
|
||||
fi
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# Variablenwert zurueckgeben (ohne open)
|
||||
# $1=config-Filename
|
||||
# $2=VarName)
|
||||
# $3=VarValue
|
||||
# -----------------------------------------------------------
|
||||
config_set_value_direct()
|
||||
{
|
||||
config_open $1
|
||||
config_set_value $2 $3
|
||||
config_write $1
|
||||
}
|
||||
|
||||
# ===========================================================
|
||||
# Initialization
|
||||
# ===========================================================
|
||||
. ./install.inc
|
||||
hp=`config_get_value_direct "$y_config_nhttpd" "WebsiteMain.override_directory"`
|
||||
if [ "$hp" != "" ]; then
|
||||
y_ywebover_dir=`echo "$hp"`
|
||||
fi
|
||||
mkdir -p $y_ywebover_dir
|
||||
chmod -R oug+rw $y_ywebover_dir
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# prepare log
|
||||
# -----------------------------------------------------------
|
||||
date +%y%m%d_%H%M%S >"$yI_install_log"
|
||||
echo "" >>yI_install_log
|
||||
echo "installing $yI_updatename [$yI_Ext_Tag/$yI_Ext_Version]" >>"yI_install_log"
|
||||
echo "installdir: $y_ywebover_dir"
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Install (from install.inc)
|
||||
# -----------------------------------------------------------
|
||||
install
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# finishing
|
||||
# -----------------------------------------------------------
|
||||
mkdir -p $y_ext_conf_dir
|
||||
chmod oug+rw $y_ext_conf_dir
|
||||
chmod 755 ./uninstall*
|
||||
cp ./uninstall.sh "$y_ext_conf_dir/"
|
||||
cp ./*uninstall.inc "$y_ext_conf_dir/"
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Clean Up
|
||||
# -----------------------------------------------------------
|
||||
cd /tmp
|
||||
rm -r /tmp/files
|
136
src/nhttpd/web/extentions/hddtools/uninstall.sh
Executable file
136
src/nhttpd/web/extentions/hddtools/uninstall.sh
Executable file
@@ -0,0 +1,136 @@
|
||||
# ===========================================================
|
||||
# yWeb Extension: Unnstall an Extension
|
||||
# by yjogol
|
||||
# -----------------------------------------------------------
|
||||
# $Date: 2007-12-29 17:08:16 $
|
||||
# $Revision: 1.4 $
|
||||
# -----------------------------------------------------------
|
||||
# Script starts in /tmp
|
||||
# ===========================================================
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Installer Configs
|
||||
# -----------------------------------------------------------
|
||||
yI_Version="$Revision: 1.4 $"
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Dirs
|
||||
# -----------------------------------------------------------
|
||||
y_path_usrbin="/var/bin"
|
||||
y_path_config="/var/tuxbox/config"
|
||||
y_path_tmp="/tmp"
|
||||
y_ywebover_dir="/var/httpd"
|
||||
y_ext_conf_dir="$y_path_config/ext"
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Files
|
||||
# -----------------------------------------------------------
|
||||
y_config_Y_Web="$y_path_config/Y-Web.conf"
|
||||
y_config_nhttpd="$y_path_config/nhttpd.conf"
|
||||
y_config_neutrino="$y_path_config/neutrino.conf"
|
||||
y_upload_file="$y_path_tmp/upload.tmp"
|
||||
|
||||
# ===========================================================
|
||||
# config-Dateien - lesen / schreiben
|
||||
# (Zeilenformat: VarName=VarValue)
|
||||
# ===========================================================
|
||||
cfg=""
|
||||
# -----------------------------------------------------------
|
||||
# config-Datei lesen/cachen (Inhalt in $cfg)
|
||||
# $1=config-Filename
|
||||
# -----------------------------------------------------------
|
||||
config_open()
|
||||
{
|
||||
cfg=""
|
||||
cfg=`cat $1`
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# config-Datei schreiben (Inhalt in $cfg)
|
||||
# $1=config-Filename
|
||||
# -----------------------------------------------------------
|
||||
config_write()
|
||||
{
|
||||
echo "$cfg" >$1
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# Variablenwert zurueckgeben (vorher open)
|
||||
# $1=VarName
|
||||
# -----------------------------------------------------------
|
||||
config_get_value()
|
||||
{
|
||||
cmd="sed -n /^$1=/p"
|
||||
tmp=`echo "$cfg" | $cmd`
|
||||
cmd="sed -e s/^$1=//1"
|
||||
tmp=`echo "$tmp" | $cmd`
|
||||
echo $tmp
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# Variablenwert zurueckgeben (ohne open)
|
||||
# $1=config-Filename
|
||||
# $2=VarName
|
||||
# -----------------------------------------------------------
|
||||
config_get_value_direct()
|
||||
{
|
||||
config_open $1
|
||||
config_get_value $2
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# Variablenwert setzen (vorher open)
|
||||
# $1=VarName)
|
||||
# $2=VarValue
|
||||
# -----------------------------------------------------------
|
||||
config_set_value()
|
||||
{
|
||||
tmp=`echo "$cfg" | sed -n "/^$1=.*/p"`
|
||||
if [ "$tmp" = "" ]
|
||||
then
|
||||
cfg=`echo -e "$cfg\n$1=$2"`
|
||||
else
|
||||
cmd="sed -e s/^$1=.*/$1=$2/g"
|
||||
cfg=`echo "$cfg" | $cmd`
|
||||
fi
|
||||
}
|
||||
# -----------------------------------------------------------
|
||||
# Variablenwert zurueckgeben (ohne open)
|
||||
# $1=config-Filename
|
||||
# $2=VarName)
|
||||
# $3=VarValue
|
||||
# -----------------------------------------------------------
|
||||
config_set_value_direct()
|
||||
{
|
||||
config_open $1
|
||||
config_set_value $2 $3
|
||||
config_write $1
|
||||
}
|
||||
|
||||
# ===========================================================
|
||||
# Initialization
|
||||
# ===========================================================
|
||||
. $y_ext_conf_dir/$1
|
||||
hp=`config_get_value_direct "$y_config_nhttpd" "WebsiteMain.override_directory"`
|
||||
if [ "$hp" != "" ]; then
|
||||
y_ywebover_dir=`echo "$hp"`
|
||||
fi
|
||||
mkdir -p $y_ywebover_dir
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# prepare log
|
||||
# -----------------------------------------------------------
|
||||
date +%y%m%d_%H%M%S >"$yI_uninstall_log"
|
||||
echo "" >>"$yI_uninstall_log"
|
||||
echo "uninstalling $yI_updatename [$yI_Ext_Tag/$yI_Ext_Version]" >>"$yI_uninstall_log"
|
||||
#echo "installdir: $y_ywebover_dir"
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Uninstall (from uninstal_<tag>.inc)
|
||||
# -----------------------------------------------------------
|
||||
uninstall
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# finishing
|
||||
# -----------------------------------------------------------
|
||||
rm $y_ext_conf_dir/$1
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Clean Up
|
||||
# -----------------------------------------------------------
|
Reference in New Issue
Block a user