From 82fbaf24ecc0374bd5dd457c118e1a0affffaa83 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Thu, 20 Sep 2012 16:11:14 -0500 Subject: supplemental-web: add ability to list all known exported file systems --- abs/core/supplemental-web/PKGBUILD | 4 +- abs/core/supplemental-web/contents/exports.shtml | 20 ++++++ abs/core/supplemental-web/contents/links.html | 1 + abs/core/supplemental-web/contents/list_exports.py | 82 ++++++++++++++++++++++ abs/core/supplemental-web/lighttpd-supplement.conf | 2 +- abs/core/supplemental-web/supplemental-web.install | 2 +- 6 files changed, 107 insertions(+), 4 deletions(-) create mode 100755 abs/core/supplemental-web/contents/exports.shtml create mode 100755 abs/core/supplemental-web/contents/list_exports.py diff --git a/abs/core/supplemental-web/PKGBUILD b/abs/core/supplemental-web/PKGBUILD index c9671de..311292f 100644 --- a/abs/core/supplemental-web/PKGBUILD +++ b/abs/core/supplemental-web/PKGBUILD @@ -1,6 +1,6 @@ pkgname=supplemental-web pkgver=1.0 -pkgrel=19 +pkgrel=25 arch=('i686' 'x86_64') MVDIR=$startdir/pkg/usr/MythVantage install=supplemental-web.install @@ -32,6 +32,6 @@ build() { } -md5sums=('30aa4235aff78c77d544f930f3d92b62' +md5sums=('400abe98c97848f8b12c5eb111ac47e4' '3d8c7b430c1319d706ca420825918d2a' '81cdb6ee6804fa36366c6e259a80e7b4') diff --git a/abs/core/supplemental-web/contents/exports.shtml b/abs/core/supplemental-web/contents/exports.shtml new file mode 100755 index 0000000..9a26dc9 --- /dev/null +++ b/abs/core/supplemental-web/contents/exports.shtml @@ -0,0 +1,20 @@ + + + + + + +
+ + + + + +
+
+ + + + diff --git a/abs/core/supplemental-web/contents/links.html b/abs/core/supplemental-web/contents/links.html index cfc7311..883c273 100644 --- a/abs/core/supplemental-web/contents/links.html +++ b/abs/core/supplemental-web/contents/links.html @@ -24,6 +24,7 @@ Other Links
  • Online User Forums
  • mythtv.org
  • mythtv smolt server
  • +
  • List file shares
  • diff --git a/abs/core/supplemental-web/contents/list_exports.py b/abs/core/supplemental-web/contents/list_exports.py new file mode 100755 index 0000000..13ec690 --- /dev/null +++ b/abs/core/supplemental-web/contents/list_exports.py @@ -0,0 +1,82 @@ +#!/usr/bin/python2 +import subprocess + +def nfs_export_list(): + nfslist = [] + exportfile = "/etc/exports" + proc = subprocess.Popen(["showmount", "-a"] , stdout=subprocess.PIPE,stderr=subprocess.PIPE) + stdout,stderr = proc.communicate() + rc = proc.returncode + if rc == 0: + try: + f = open(exportfile,"r") + for line in f.readlines(): + if line.startswith("#"): + continue + item = line.split() + if len(item) <= 1 : + continue + nfslist.append(item) + except : + pass + else: + nfslist.append(["NFS server is not running",'NFS server is not running']) + return nfslist + + +def smb_share_list(): + smblist=[] + + proc = subprocess.Popen(["smbclient", "-L", "\\localhost" , "-N"], stdout=subprocess.PIPE,stderr=subprocess.PIPE) + stdout,stderr = proc.communicate() + outstuff = stderr.split("\n") + for line in outstuff: + try: + heading1 = line.split()[0] + except: + continue + #print heading1 + #print heading1.find("Domain") + if heading1.find("Domain") > -1 : + #smblist.append('') + smblist.append(heading1) + break + + outstuff = stdout.split("\n") + for line in outstuff: + try: + heading1,heading2 = line.split() + except: + continue + if heading1 == "Server" and heading2 == "Comment": + break + smblist.append(line) + + return smblist + + +nfslist = nfs_export_list() +smblist = smb_share_list() + + +print "---------NFS SHARES-----------\n" +print "
    " +for sharename in nfslist: + if sharename[1].find("noaccess") > -1 : + print "%s \t no access" %sharename[0] + print "
    " + else: + print sharename[0] + print "
    " + +print "\n---------SMB SHARES----------\n" +print "
    " + +if len(smblist) == 0: + print "Samba is not running or no shares listed" + print "
    " +else: + for sharename in smblist: + print "%s" %(sharename.split()[0]) + print "
    " + diff --git a/abs/core/supplemental-web/lighttpd-supplement.conf b/abs/core/supplemental-web/lighttpd-supplement.conf index 24e1b4a..a07564a 100644 --- a/abs/core/supplemental-web/lighttpd-supplement.conf +++ b/abs/core/supplemental-web/lighttpd-supplement.conf @@ -41,7 +41,7 @@ dir-listing.external-css = "/frame.css" $SERVER["socket"] == ":1337" { server.document-root = "/data/srv/httpd/cgi/" - alias.url = ( "/templates/" => "/data/home/mythtv/templates/" ) + alias.url = ( "/templates/" => "/home/mythtv/templates/" ) } diff --git a/abs/core/supplemental-web/supplemental-web.install b/abs/core/supplemental-web/supplemental-web.install index 7dc0214..eec33fd 100644 --- a/abs/core/supplemental-web/supplemental-web.install +++ b/abs/core/supplemental-web/supplemental-web.install @@ -8,7 +8,7 @@ pre_install() { # arg 1: the new package version post_install() { - /bin/true + setfacl -m u:http:rx /home/mythtv/ COUNT=`grep -c "lighttpd-supplement.conf" /etc/lighttpd/conf.include` if [ $COUNT == 0 ] -- cgit v0.12