summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-10-08 01:47:55 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-10-08 01:47:55 (GMT)
commit6a71275027db683cc2d6b6df1d7558adc47ff156 (patch)
treefc3772fb214d84b4d745be4c674e72fb47677a64
parent5711508ebf21a62cabc3c682ec8d65108452dcfe (diff)
downloadlinhes_pkgbuild-6a71275027db683cc2d6b6df1d7558adc47ff156.zip
linhes_pkgbuild-6a71275027db683cc2d6b6df1d7558adc47ff156.tar.gz
linhes_pkgbuild-6a71275027db683cc2d6b6df1d7558adc47ff156.tar.bz2
LinHES-config: fixed central NFS
new feature, if central NFS is selected the entry is added to nfsmap_auto
-rwxr-xr-xabs/core/LinHES-config/PKGBUILD8
-rwxr-xr-xabs/core/LinHES-config/mv_common.py5
-rwxr-xr-xabs/core/LinHES-config/mv_config.py2
-rwxr-xr-xabs/core/LinHES-config/mv_fileshare.py83
4 files changed, 73 insertions, 25 deletions
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 7471335..df69f79 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-config
pkgver=2.3
-pkgrel=168
+pkgrel=169
conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
pkgdesc="Install and configure your system"
depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
@@ -127,7 +127,7 @@ build() {
}
md5sums=('59e18e35359bebcd9d639c5e5b5d290d'
'f33e1a6f7985091b8d47cbaf7433f90f'
- '1afacd0337d95f140b2a1777c27f041a'
+ 'cb1f9d7a3438219048a679be87217f46'
'2596460462cf6c889cf8f95485537b20'
'985891a43f7c4c983eb2a362162f1a0f'
'fda01259a4bc74d83c9092d338bd247a'
@@ -148,7 +148,7 @@ md5sums=('59e18e35359bebcd9d639c5e5b5d290d'
'3d1e4a119f38cff0498bf8a67e94e4b3'
'71fd2d0d448fc2fcd15415a1beed7109'
'af6b3c5ec0d974b3e19ff1ed50662ee5'
- '5f60c90ae0f48d71224d4dd6afad61ff'
+ 'cbc7cb10bde9a133e16fb63df6242f29'
'b845de3e05c1734cce4b9ac5e8f1baaf'
'e869e2c72212881db1e4fa40b116efe5'
'8b7dce4a3a0a281fa6656aa8781a648e'
@@ -160,7 +160,7 @@ md5sums=('59e18e35359bebcd9d639c5e5b5d290d'
'67b651a8cd0dcccb368fe7d2402f05f3'
'b4900090d841d3e390cb840cf16afd85'
'6dd202ec664ede468e42edf600f7913d'
- '923197a517cb83d77263e8cea8b8c16a'
+ 'c9c9390ac12145169dfe9a76896db328'
'f49d9ff1e6c3e484c9679079c74ad048'
'2596460462cf6c889cf8f95485537b20'
'4cba2bb55c6b8e27c57a6171f42d0455'
diff --git a/abs/core/LinHES-config/mv_common.py b/abs/core/LinHES-config/mv_common.py
index f1210ba..c2138dc 100755
--- a/abs/core/LinHES-config/mv_common.py
+++ b/abs/core/LinHES-config/mv_common.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import logging, os, time
import commands
+import subprocess
import ConfigParser
import urllib2
config_file = "mv_config"
@@ -62,6 +63,10 @@ def read_config(module_config,data):
return rvalue
+
+def runcmd_bg(cmd):
+ subprocess.Popen(cmd)
+
def runcmd(cmd):
if data_config.NOOPDEBUG=="FALSE":
pass
diff --git a/abs/core/LinHES-config/mv_config.py b/abs/core/LinHES-config/mv_config.py
index 381f424..6c0744d 100755
--- a/abs/core/LinHES-config/mv_config.py
+++ b/abs/core/LinHES-config/mv_config.py
@@ -16,7 +16,7 @@ share_exclude_dir=['mysql','srv']
SG_MAP_AUTONFS_SKIP=['media/tv','media/video','media/video_stuff']
MAP_AUTONFS_SKIP=['lost+found','media','backup']
-
+nfs_options="rsize=16384,wsize=16384,intr"
diff --git a/abs/core/LinHES-config/mv_fileshare.py b/abs/core/LinHES-config/mv_fileshare.py
index ebb53c7..96e9a28 100755
--- a/abs/core/LinHES-config/mv_fileshare.py
+++ b/abs/core/LinHES-config/mv_fileshare.py
@@ -4,6 +4,7 @@ import mv_common
import glob
from urllib2 import Request, urlopen, URLError, HTTPError
#client side
+#CentralNFSallhosts=
def setup_nfs_client(systemconfig,data_config):
nfslist=[]
@@ -13,6 +14,7 @@ def setup_nfs_client(systemconfig,data_config):
if systemconfig.get("HaveCentralNFS") == "yes":
logging.debug(" Using a Central NFS server")
+ logging.debug(" NFSserver:%s" %systemconfig.get("NFSserver"))
if systemconfig.get("NFSserver") == "file:nfsmap":
#if it's a file check for it, failure results in downloading attempt from MBE
nfsmap_file=data_config.MYTHHOME+"/templates/nfsmap"
@@ -22,8 +24,15 @@ def setup_nfs_client(systemconfig,data_config):
nfsmap_file = download_nfsmap(systemconfig.get("dbhost"),nfsmap_serverfile)
nfslist = process_nfsmap_file(nfsmap_file)
+ #check for other filesname:
+
+ elif re.search("^file:",systemconfig.get("NFSserver")):
+ filename=systemconfig.get("NFSserver").split(":")[1]
+ nfsmap_file=data_config.MYTHHOME+"/templates/"+filename
+ nfslist = process_nfsmap_file(nfsmap_file)
+
# if it's an ip parse ip and download file
- elif re.search(systemconfig.get("NFSserver"),":nfsmap"):
+ elif re.search(":nfsmap$",systemconfig.get("NFSserver")):
ip=systemconfig.get("NFSserver").split(":")[0]
nfsmap_file = download_nfsmap(ip,nfsmap_serverfile)
nfslist = process_nfsmap_file(nfsmap_file)
@@ -41,8 +50,9 @@ def setup_nfs_client(systemconfig,data_config):
nfslist = process_nfsmap_file(nfsmap_file)
- setup_nfs_fstab(nfslist)
+ setup_nfs_fstab(nfslist,data_config)
logging.info("__End of nfs\n")
+ return nfslist
def process_nfsmap_file(mapfile):
@@ -102,20 +112,30 @@ def setup_nfs_mkdir(nfs_dirname):
-def setup_nfs_fstab(nfslist):
+
+
+def setup_nfs_fstab(nfslist,data_config):
logging.info(" Adding nfs paths to fstab")
+ nfs_options = mythhome = data_config.nfs_options
try:
f = open('/etc/fstab', 'a')
line = "#STARTSCRUB --------------anything in this block will be scrubbed\n"
f.write(line)
for s, m in nfslist:
- line = "%s %s nfs \n" %(s,m)
+ line = "%s %s nfs %s \n" %(s,m,nfs_options)
setup_nfs_mkdir(m)
logging.debug(" %s",line)
f.write(line)
line = "#ENDSCRUB\n"
f.write(line)
f.close()
+
+ for s, m in nfslist:
+ logging.info(" nfs mounting %s",m)
+ cmd = ['mount',m]
+ mv_common.runcmd_bg(cmd)
+
+
except:
logging.critical(" *Couldn't open /etc/fstab for writing")
logging.debug(" Done adding nfs paths to fstab")
@@ -257,7 +277,7 @@ create mask = 0755 ''' %(data_config.MYTHHOME,shreadonly)
mv_common.restart_service("smbd")
else:
- logging.info(" Removing windows file sharing")
+ logging.info(" Removing windows file sharing")
mv_common.remove_service("smbd")
mv_common.remove_service("nmbd")
mv_common.pacremove("samba")
@@ -284,7 +304,7 @@ def scan_for_shares():
return share_list
-def setup_etc_exports(shares,data_config,servername):
+def setup_etc_exports(shares,data_config,servername,nfslist):
#read in /etc/ exports
conf_file="/etc/exports"
excludes = data_config.share_exclude_dir
@@ -293,12 +313,18 @@ def setup_etc_exports(shares,data_config,servername):
#print nfsmap_auto_skip
nfs_auto_line ="%s:%s %s"
-
-
nfs_map_auto = []
-
share_list = []
+ #populate nfs_map_auto with nfs_list. nfs_list is populated from the
+ #central nfs options
+ #nfslist looks like [('silverraid:/raid0/data/media', '/data/storage/nfs/silverraid')]
+ for i in nfslist:
+ sharename = i[0]
+ mountpoint = i[1]
+ templine = "%s %s" %(sharename,mountpoint)
+ nfs_map_auto.append(templine)
+
#create the lists for both /etc/exports and nfs_map_auto
for share in shares:
@@ -326,9 +352,6 @@ def setup_etc_exports(shares,data_config,servername):
templine = nfs_auto_line %(servername,tempname,tempname)
nfs_map_auto.append(templine)
-
-
-
new_exports=[]
new_exports.append("#This file was generated by systemconfig.py -m fileshare")
new_exports.append("#Use exportfs -arv to reread. \n\n")
@@ -348,7 +371,19 @@ def setup_etc_exports(shares,data_config,servername):
logging.info(" writing nfsmap_auto")
try:
- os.makedirs("%s/templates/" %data_config.MYTHHOME)
+ dirname ="%s/templates/" %data_config.MYTHHOME
+ os.makedirs(dirname)
+ cmd = "chmod 755 %s" %dirname
+ mv_common.runcmd(cmd)
+ cmd = "chown mythtv:users %s" %dirname
+ mv_common.runcmd(cmd)
+ except:
+ pass
+ try:
+ cmd = "chmod 755 %s" %dirname
+ mv_common.runcmd(cmd)
+ cmd = "chown mythtv:users %s" %dirname
+ mv_common.runcmd(cmd)
except:
pass
conf_file_nfs = "%s/templates/nfsmap_auto" %(data_config.MYTHHOME)
@@ -359,7 +394,7 @@ def setup_etc_exports(shares,data_config,servername):
logging.debug("%s" %line)
f.close()
except:
- logging.info("* error writing /data/srv/htdocs/nfsmap_auto")
+ logging.info("* error writing %s" %conf_file_nfs)
try:
logging.info(" writing /etc/exports")
@@ -374,14 +409,13 @@ def setup_etc_exports(shares,data_config,servername):
-def setup_NFSshares(UseNFS,templatefile,data_config,servername):
+def setup_NFSshares(UseNFS,templatefile,data_config,servername,nfslist):
if UseNFS == "1":
logging.info(" Activating NFS server")
mv_common.pacinstall("nfs-utils")
mv_common.pacinstall("rpcbind")
shares = scan_for_shares()
- setup_etc_exports(shares,data_config,servername)
-
+ setup_etc_exports(shares,data_config,servername,nfslist)
mv_common.add_service("nfsd")
mv_common.add_service("nfs-common")
mv_common.add_service("rpcbind")
@@ -408,11 +442,20 @@ def setup_fileshare(systemconfig,data_config):
logging.info("____Skipping of fileshare, config disabled____")
return
logging.info("____Start of fileshare configuration____")
- #client
- setup_nfs_client(systemconfig,data_config)
+
+ #client, nfslist will be used in case the central NFS needs to also be addressed
+ nfslist = setup_nfs_client(systemconfig,data_config)
+
#server
+ if systemconfig.get("CentralNFSallhosts") == "0":
+ #reset nfslist to 0 so that central nfsshares do not get added to auto_nfs
+ nfslist = []
+
setup_NFSshares(systemconfig.get("UseNFS"),
- systemconfig.get("TEMPLATES")+"/exports.template",data_config,systemconfig.get("hostname"))
+ systemconfig.get("TEMPLATES")+"/exports.template",
+ data_config,systemconfig.get("hostname"),
+ nfslist)
+
setup_samba(systemconfig,data_config)
logging.info("__End of fileshare configuration\n")