summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-config')
-rwxr-xr-xabs/core/LinHES-config/PKGBUILD6
-rwxr-xr-xabs/core/LinHES-config/mv_advanced.py103
-rwxr-xr-xabs/core/LinHES-config/mv_config.py1
3 files changed, 90 insertions, 20 deletions
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 24a6e16..9417079 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-config
pkgver=2.3
-pkgrel=86
+pkgrel=88
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'
@@ -125,7 +125,7 @@ build() {
}
md5sums=('fe57dd29e1479073f667a5168b479d7f'
'f33e1a6f7985091b8d47cbaf7433f90f'
- '9a942c95d2c5a4fb27713d6e2b633e89'
+ '3a20fb24a47e3a2afe49f1159551ebaa'
'2596460462cf6c889cf8f95485537b20'
'985891a43f7c4c983eb2a362162f1a0f'
'd1bb7a1449c44effe9ce7c621ea575a1'
@@ -145,7 +145,7 @@ md5sums=('fe57dd29e1479073f667a5168b479d7f'
'9151c74fcaf18ec4cf5e757cfdbc7017'
'3d1e4a119f38cff0498bf8a67e94e4b3'
'71fd2d0d448fc2fcd15415a1beed7109'
- 'e9e70a255b2e25e15f89229551c3fbac'
+ '58fe4ac269ca45a08028786fc0a5f5bc'
'65c2dad8748210c3c0098efab377c330'
'b845de3e05c1734cce4b9ac5e8f1baaf'
'e869e2c72212881db1e4fa40b116efe5'
diff --git a/abs/core/LinHES-config/mv_advanced.py b/abs/core/LinHES-config/mv_advanced.py
index 5ca42de..c90a1eb 100755
--- a/abs/core/LinHES-config/mv_advanced.py
+++ b/abs/core/LinHES-config/mv_advanced.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import logging, os, re
import mv_common
+import glob
def setup_pacman(create_link):
if create_link:
@@ -239,6 +240,7 @@ def setup_mythweb(UseMythWEB):
def setup_samba(systemconfig,data_config):
mythhome = data_config.MYTHHOME
+ excludes = data_config.share_exclude_dir
if systemconfig.get("UseSamba") == "1":
logging.info(" Activating windows file sharing")
usersamba=mythhome+"/templates/smb.conf"
@@ -294,6 +296,7 @@ def setup_samba(systemconfig,data_config):
outline="server string = %s\n" %servername
logging.debug(" %s",outline)
f.write(outline)
+
outline="include = %s/templates/user.shares \n" %mythhome
f.write(outline)
if Samba_media == "1":
@@ -303,25 +306,43 @@ def setup_samba(systemconfig,data_config):
outline="include = /etc/samba/smb.conf.home\n"
f.write(outline)
f.close()
+
logging.info(" Writing smb.conf.media")
try:
f = open("/etc/samba/smb.conf.media","w")
except:
- logging.info(" Couldn't open smb.conf.media")
+ logging.info("* Couldn't open smb.conf.media")
return
+
+ shares = scan_for_shares()
medialines='''
[%s]
-path = %s
-public = yes
-only guest = yes
-writeable = %s
-printable = no
-force user = mythtv
-force group = mythtv
-create mask = 0755''' %(data_config.SMEDIA,data_config.DATAMOUNT,smreadonly)
- f.write(medialines)
- f.close
- logging.debug(" %s",medialines)
+ path = %s
+ public = yes
+ only guest = yes
+ writeable = %s
+ printable = no
+ force user = mythtv
+ force group = mythtv
+ create mask = 0755\n'''
+ new_share=[]
+ excludes
+ for share in shares:
+ share_name = share.split("/")[-1]
+ share_path = share
+ #new_share.append(medialines %(share_name,share_patch,smreadonly)
+ f.write(medialines %(share_name,share_path,smreadonly) )
+ logging.debug(" %s",medialines %(share_name,share_path,smreadonly) )
+ excludeline = ' veto files = '
+ for exclude in excludes:
+ excludeline+= ''' "/%s/" ''' %exclude
+
+ if excludes != []:
+ f.write( excludeline)
+ logging.debug(excludeline)
+ f.write("\n")
+
+ f.close()
logging.info(" Writing smb.conf.home")
try:
f = open("/etc/samba/smb.conf.home","w")
@@ -339,7 +360,7 @@ force user = mythtv
force group = mythtv
create mask = 0755 ''' %(data_config.MYTHHOME,shreadonly)
f.write(homelines)
- f.close
+ f.close()
logging.debug(" %s",homelines)
@@ -356,13 +377,61 @@ create mask = 0755 ''' %(data_config.MYTHHOME,shreadonly)
mv_common.pacinstall("smbclient")
return
-def setup_NFSshares(UseNFS,templatefile):
+def scan_for_shares():
+ import ConfigParser
+ config = ConfigParser.RawConfigParser()
+ file_list=glob.glob("/etc/storage.d/*.conf")
+ share_list = []
+ for conf_file in file_list:
+ try:
+ logging.debug(" mv_advanced: reading in %s" %conf_file)
+ config.read(conf_file)
+ shareable = config.get('storage','shareable')
+ if shareable == "True" :
+ mp = config.get('storage','mountpoint')
+ share_list.append(mp)
+ if config.get('storage','mmount') == "True" :
+ share_list.append("/myth")
+ except:
+ logging.debug(" mv_advanced: Couldn't open %s for reading" %conf_file)
+
+ return share_list
+
+def setup_etc_exports(shares,data_config):
+ #read in /etc/ exports
+ conf_file="/etc/exports"
+ excludes = data_config.share_exclude_dir
+ new_exports=[]
+ new_exports.append("#This file was generated by systemconfig.py -m advanced")
+ new_exports.append("#Use exportfs -arv to reread. \n\n")
+
+ for share in shares:
+ share_line='''%s *(rw,all_squash,anonuid=1000,anongid=1000,no_subtree_check)''' %share
+ new_exports.append(share_line)
+ for exclude in excludes:
+ share_line='''/%s *(noaccess)''' %exclude
+ new_exports.append(share_line)
+ try:
+ logging.info(" writing /etc/exports")
+ f=open(conf_file,'w')
+ for line in new_exports:
+ f.write(line)
+ f.write("\n")
+ logging.debug("%s" %line)
+ f.close()
+ except:
+ logging.info("* error writing /etc/exports")
+
+
+
+def setup_NFSshares(UseNFS,templatefile,data_config):
if UseNFS == "1":
logging.info(" Activating NFS server")
mv_common.pacinstall("nfs-utils")
mv_common.pacinstall("rpcbind")
- cmd = '''sed -e "s/REPLACEME/*/g" %s >/etc/exports''' %templatefile
- mv_common.runcmd(cmd)
+ shares = scan_for_shares()
+ setup_etc_exports(shares,data_config)
+
mv_common.add_service("nfsd")
mv_common.add_service("nfs-common")
mv_common.add_service("rpcbind")
@@ -420,7 +489,7 @@ def setup_advanced(systemconfig,data_config):
setup_mythweb(systemconfig.get("UseMythWEB"))
setup_samba(systemconfig,data_config)
setup_NFSshares(systemconfig.get("UseNFS"),
- systemconfig.get("TEMPLATES")+"/exports.template")
+ systemconfig.get("TEMPLATES")+"/exports.template",data_config)
setup_dyndns(systemconfig.get("DDnsEnable"))
logging.info("__End of advanced configuration\n")
diff --git a/abs/core/LinHES-config/mv_config.py b/abs/core/LinHES-config/mv_config.py
index 2f17be2..4b9b2f3 100755
--- a/abs/core/LinHES-config/mv_config.py
+++ b/abs/core/LinHES-config/mv_config.py
@@ -12,6 +12,7 @@ BACKUPFILE="mythconverg.sql.gz"
BACKUPPATH="/myth/backup/"
TEMP_TEMPLATES="/tmp/templates"
SMEDIA="myth"
+share_exclude_dir=['mysql','srv']