Re: [App] More TV channels on E/F/H series
Posted: Sat Mar 18, 2017 11:58 pm
Hi @xmucio. Do have works on your TV the php server?
Code: Select all
#!/bin/sh
#
# © Copyright 1996-2011, ZsoltTech.Com
# by Ser Lev Arris <arris@ZsoltTech.Com>
#
# donated for the SamyGo Project
# http://samygo.sourceforge.net/
#
# Version: SamyGO svn $Id: 06_05_apache.init 1117 2011-03-29 22:36:22Z arris69 $
. /dtv/SGO.env
WEBROOT="/dtv/www"
CGIDIR="/dtv/cgi-bin"
PORT="1080"
# customize php.ini & httpd.conf?
PARAMS="-D PHP5CGI"
case $1 in
start)
# sample cgi, usage: http://192.168.1.51/cgi-bin/test.cgi
mkdir -p $CGIDIR $WEBROOT $SYSROOT/etc/php/apache2-php5
echo "#!/bin/sh
echo Content-type: text/html
echo \"\"
echo \"<head>
<title>Stop Start</title></head><body bgcolor=\'#FFFFFF\' text=\'#000000\' alink=\'#ff0000\' vlink=\'#00007f\' link=\'#0000ff\'>\"
if [ -z \$2 ] ; then
for i in $SYSROOT/etc/init.d/*.init ; do
echo \"<H3>\$i <a href=\\\"/cgi-bin/test.cgi?\$i+start\\\">start</a> <a href=\\\"/cgi-bin/test.cgi?\$i+stop\\\">stop</a></H3>\"
echo "Status:"
echo \"<H5>\"
\$i status 2>&1 | sed -e \"s,$,</br>,\"
echo \"</H5>\"
done
else
echo \"<center><form><textarea rows=10 cols=120 wrap=soft>\"
/bin/sh -x \$1 \$2 2>&1
echo \"</textarea></form></center>\"
echo \"\$1 with parameter \$2 <br/>\"
echo \" <a href=\\\"/cgi-bin/test.cgi\\\">Back</a><br/>\"
fi
echo \"</body>\"" > $CGIDIR/test.cgi
chmod a+x $CGIDIR/test.cgi
# sample php
echo '<? phpinfo(); ?>' > $WEBROOT/index.php
# generate config
echo "ServerRoot \"$DISTROOT/usr\"
LockFile \"/dtv/httpd.lock\"
PidFile \"/dtv/httpd.pid\"
Listen $PORT
User root
ServerAdmin arris@ZsoltTech.Com
ServerName 127.0.0.1:$PORT
MaxClients 3
MaxRequestsPerChild 2
DocumentRoot \"$WEBROOT\"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory \"$WEBROOT\">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
ErrorLog \"/dtv/apache_error_log\"
LogLevel warn
ScriptAlias /cgi-bin/ \"$CGIDIR/\"
<Directory \"$CGIDIR\">
AllowOverride None
Options None
Order allow,deny
Allow from 10.0.0.0/8
Allow from 192.168
Allow from 172.16.0.0/12
Allow from 127.0.0.0/8
Allow from 169.254.0.0/16
</Directory>
DefaultType text/plain
<IfModule mime_module>
TypesConfig $SYSROOT/etc/apache2/mime.types
</IfModule>
Include $SYSROOT/etc/apache2/modules.d/*.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>" > $SYSROOT/etc/apache2/httpd.conf
# for (non working?) mod_php, set -D PHP5 in PARAMS to enable
echo "<IfDefine PHP5>
SetEnv LD_LIBRARY_PATH \"$LD_LIBRARY_PATH\"
SetEnv PHPRC $SYSROOT/etc/php/apache2-php5/php.ini
# Load the module first
<IfModule !sapi_apache2.c>
LoadModule php5_module lib/apache2/modules/libphp5.so
</IfModule>
# Set it to handle the files
AddHandler php5-script .php .phtml .php3 .php4 .php5
AddType application/x-httpd-php-source .phps
DirectoryIndex index.html index.html.var index.php index.phtml
</IfDefine>" > $SYSROOT/etc/apache2/modules.d/70_mod_php5.conf
# for php-cgi (works), set -D PHP5CGI in PARAMS to enable
echo "<IfDefine PHP5CGI>
SetEnv LD_LIBRARY_PATH \"$LD_LIBRARY_PATH\"
SetEnv PHPRC $SYSROOT/etc/php/apache2-php5/php.ini
ScriptAlias /privateer-bin $DISTROOT/usr/bin
AddHandler application/x-httpd-php5 php
Action application/x-httpd-php5 /privateer-bin/php-cgi
DirectoryIndex index.html index.php
<Directory \"$DISTROOT/usr/bin\">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</IfDefine>" > $SYSROOT/etc/apache2/modules.d/70_mod_php5_cgi.conf
# fix php.ini
sed -i -e "s,/usr/lib/extensions,$DISTROOT/extensions," $SYSROOT/etc/php/apache2-php5/php.ini || \
echo "extension_dir = \"$DISTROOT/extensions\"" > $SYSROOT/etc/php/apache2-php5/php.ini
cp -af $SYSROOT/phpsysinfo $WEBROOT/
httpd -f $SYSROOT/etc/apache2/httpd.conf $PARAMS &
;;
stop)
httpd -k stop -f $SYSROOT/etc/apache2/httpd.conf
;;
status)
netstat -tanup | grep httpd | grep ":$PORT"
;;
*)
echo "Usage: $0 {start|stop|status}" 1>&2
exit 0
;;
esac
Code: Select all
VDLinux#> ls -l /dtv/www/phpsysinfo/
total 196
-rwxrwxrwx 1 root 0 4257 Nov 2 2011 config.php
-rwxrwxrwx 1 root 0 1490 Jan 3 2011 distros.ini
-rwxrwxrwx 1 root 0 144954 Nov 2 2011 file.php
drwxrwxrwx 2 root 0 40 Aug 19 2007 gfx
drwxrwxrwx 2 root 0 520 Jan 2 2011 images
drwxrwxrwx 6 root 0 280 Jan 2 2011 includes
-rwxrwxrwx 1 root 0 11674 Nov 2 2011 index.php
drwxr-xr-x 2 root 0 120 Jan 1 00:08 listCH
-rwxrwxrwx 1 root 0 2979 Aug 19 2007 phpsysinfo.dtd
-rwxrwxrwx 1 root 0 15858 Nov 10 2011 shell.php
drwxrwxrwx 14 root 0 300 Jan 2 2011 templates
Code: Select all
[Util] Existing /dtv/www/phpsysinfo/listCH/listCH.sh -> status: 0
Code: Select all
VDLinux#> ls -l /dtv/www/phpsysinfo/listCH/
total 16
-rwxr-xr-x 1 root 0 240 Jan 1 00:05 GetStreamInfo.sh
-rwxr-xr-x 1 root 0 1046 Jan 1 00:08 WeebTV.sh
-rwxr-xr-x 1 root 0 817 Jan 1 00:08 listCH.sh
-rw-r--r-- 1 root 0 787 Jan 1 00:08 oko.php