summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-system')
-rwxr-xr-xabs/core/LinHES-system/PKGBUILD11
-rwxr-xr-xabs/core/LinHES-system/add_storage.py72
-rw-r--r--abs/core/LinHES-system/create_media_dirs.sh3
-rw-r--r--abs/core/LinHES-system/lh_system_backup_job30
4 files changed, 80 insertions, 36 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 2479cab..7a02894 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-system
pkgver=8.4
-pkgrel=12
+pkgrel=16
arch=('i686' 'x86_64')
install=system.install
pkgdesc="Everything that makes LinHES an automated system"
@@ -15,7 +15,7 @@ binfiles="LinHES-start optimize_mythdb.py myth_mtc.py
load-modules-mythvantage.sh unclutter-toggle.sh tvterm.sh
mythfrontend-start set_windowmanager.sh myth_status.py myth_status.sh
install_supplemental_service.sh get_airplay_key importfiles.sh
- lh_system_backup lh_system_backup_job lh_system_restore_job
+ lh_system_backup lh_system_backup_job lh_system_restore lh_system_restore_job
lh_system_host_update lh_system_all_host_update
add_storage.py balance_storage_groups.py empty_storage_groups.py
diskspace.sh cacheclean lh_backend_control.sh
@@ -96,17 +96,18 @@ md5sums=('c6e6b83a1f4c35ef4501e277657ab2ac'
'33fbebbd546672cedd3c5e7350ab414e'
'c773d8caacba8fbd4968e8afe5137bc6'
'3edef50a49a47694bf8add39cc160add'
- 'a730185e0d5d8bd0b6d06938d841c8c0'
+ '01cbbf411d2a585feb71f2881755e5d8'
+ 'f421f670a9c74724037f70d1dabcad00'
'bc69a520add58ede9b060c73e67ace13'
'74e17d6f7453c52d56fecaed5c3f6ad5'
'47e093e8cfe4b5b96602358e1f540832'
- '9d1ad3c698296a1f8790c5cdc85483e3'
+ 'df3d5af03954168852b7e5c66fd174c6'
'0c81e5cad656f6260e39cd7585b1421a'
'e5bb027c54a2727d0bcf8d6fb357ba32'
'2c005d95312018bef80092136f80f254'
'c8db6a83ecc089ea37ab7fcb0f7a01cf'
'ca63946920ba33de1f15abda83e74e40'
- '84c0ea62550b0bf9d84ab48eddc08276'
+ 'bc9a01dfed47d3f9d7599cf9c08b1066'
'3e60b17892e5b8214d47dcfddf5215a4'
'57ec994cc3964a10c00580e89ebcae35'
'00330dab3979f34b07b23b20ea06d37e'
diff --git a/abs/core/LinHES-system/add_storage.py b/abs/core/LinHES-system/add_storage.py
index 853c39e..82de56e 100755
--- a/abs/core/LinHES-system/add_storage.py
+++ b/abs/core/LinHES-system/add_storage.py
@@ -25,19 +25,19 @@ pickle_file = "%s/storage.pkl" %storage_dir
SG_MAP={
- 'Default' :'media/tv',
- 'LiveTV' :'media/tv/live',
+ 'Default' :'media/tv/',
+ 'LiveTV' :'media/tv/live/',
'DB Backups' :'backup/mythtv_backups/',
- 'Music' :'media/music',
- 'Streaming' :'media/streaming',
- 'Videos' :'media/video',
- 'Photographs':'media/photos',
- 'Banners' :'media/artwork/banners',
- 'Coverart' :'media/artwork/coverart',
- 'Fanart' :'media/artwork/fanart',
- 'MusicArt' :'media/artwork/musicart',
- 'Screenshots':'media/artwork/screenshots',
- 'Trailers' :'media/artwork/trailers',
+ 'Music' :'media/music/',
+ 'Streaming' :'media/streaming/',
+ 'Videos' :'media/video/',
+ 'Photographs':'media/photos/',
+ 'Banners' :'media/artwork/banners/',
+ 'Coverart' :'media/artwork/coverart/',
+ 'Fanart' :'media/artwork/fanart/',
+ 'MusicArt' :'media/artwork/musicart/',
+ 'Screenshots':'media/artwork/screenshots/',
+ 'Trailers' :'media/artwork/trailers/',
}
FS_LIST=[]
@@ -248,7 +248,7 @@ class disk_device:
def add_fstab(self,bind=False):
new_fstab_list=['UUID=', 'mount_point', 'auto', 'defaults', '0', '1']
fstab=self.read_fstab()
-
+ new_fstab=[]
#determine mount_path
self.new_mount_point="%s/%s_%s" %(self.top_mount_dir,self.model.replace(' ',''),self.serial_number.replace(' ',''))
@@ -257,8 +257,16 @@ class disk_device:
new_fstab_list=["/data/storage/disk0" , self.new_mount_point , "none" , "rw,bind", '0', '0']
uuid=self.find_uuid(self.block_partition)
else:
- #determine options
-
+ #check for old mount point and comment out
+ for line in fstab:
+ if not line.startswith("#"):
+ if line.find(self.new_mount_point) > -1:
+ print " Found old mount %s in fstab, commenting out" %self.new_mount_point
+ line = "#"+line
+ new_fstab.append(line)
+ fstab=new_fstab
+
+ #determine options
new_options = self.find_options_type(fstab)[0]
#find blkid
@@ -328,6 +336,9 @@ class disk_device:
print "Will write SG for stuff after the fact"
else:
with DB as c:
+ #delete old dir without trailing slash
+ c.execute("""delete from storagegroup where groupname = %s and hostname = %s and dirname = %s""", (gn,hn,dn.rstrip('/')))
+
try:
c.execute("""insert into storagegroup (groupname,hostname,dirname) values (%s,%s,%s)""",(gn,hn,dn))
print " Adding location: %s to storagegroup %s" %(dn,gn)
@@ -342,6 +353,9 @@ class disk_device:
#print sgweight
#print hn
+ #delete old dir without trailing slash
+ c.execute("""delete from settings where value = %s and data = %s and hostname = %s""", (sgw.rstrip('/'),sgweight,hn))
+
c.execute("""insert into settings (value,data,hostname) values (%s,%s,%s)""",(sgw,sgweight,hn))
print " Adding storage group weight of %s for %s\n" %(sgweight,gn)
except:
@@ -481,7 +495,6 @@ def prompt_to_add(current_drive,destruction = True):
def prompt_to_continue(process_list):
loop = True
- #while loop:
print "\n\n\n Ready to add additional storage!\n"
if destruction:
print "** WARNING: These disk(s) WILL be partitioned and formatted. **\n ** All content on these disk(s) will be erased. **"
@@ -491,10 +504,6 @@ def prompt_to_continue(process_list):
print " %s" %(i.get_name())
str1 = raw_input("\n Press Y to add disk(s), any other key to cancel:")
- #if str1 in ['Y','N','y','n']:
- # loop = False
- # break
- #print "\n"
if str1 == 'Y' or str1 == 'y':
rc = True
else:
@@ -673,6 +682,7 @@ def main(scan_only, destruction, no_mount, install_call, dir_sg):
i.mkdirs(FS_LIST)
i.set_disk_num(disk_num)
+ i.set_dir_sg(dir_sg)
i.write_config()
system_drive_list.append(i)
write_known_drive_list(system_drive_list)
@@ -807,6 +817,9 @@ def reconstruct_storagegroups():
hn=host
dn="%s/%s" %(mount_point,SG_MAP[key])
with DB as c:
+ #delete old dir without trailing slash
+ c.execute("""delete from storagegroup where groupname = %s and hostname = %s and dirname = %s""", (gn,hn,dn.rstrip('/')))
+
try:
c.execute("""insert into storagegroup (groupname,hostname,dirname) values (%s,%s,%s)""",(gn,hn,dn))
print " Added: %s to storagegroup %s" %(dn,gn)
@@ -815,6 +828,10 @@ def reconstruct_storagegroups():
if sgweight > 0:
try:
sgw="SGweightPerDir:%s:%s" %(hn,dn)
+
+ #delete old dir without trailing slash
+ c.execute("""delete from settings where value = %s and data = %s and hostname = %s""", (sgw.rstrip('/'),sgweight,hn))
+
if DB.settings[hn][sgw] == u'99':
print " Skipping: storage group weight DB entry exists"
else:
@@ -901,7 +918,6 @@ class reconstruct_path:
return fstab
def check_in_fstab(self,fstab,check_path):
-
for line in fstab:
if line.find(check_path) > -1:
return True
@@ -914,7 +930,7 @@ class reconstruct_path:
f = open('/etc/fstab', 'a')
#f = open('/tmp/fstab', 'a')
f.write(new_fstab_line)
- f.write("\n")
+ #f.write("\n")
f.close()
def symlink(self):
@@ -940,7 +956,7 @@ class reconstruct_path:
self.symlink()
if self.check_in_fstab(fstab,self.uuid) == True:
- print " Found disk in fstab, will not add it"
+ print " Found UUID of disk in fstab, will not add it"
else:
print " Adding storage to fstab"
if self.bind == "True" :
@@ -952,6 +968,16 @@ class reconstruct_path:
print " Found bind storage in fstab, will not add it"
else:
+ #check for old mount point and comment out
+ f = open('/etc/fstab', 'w')
+ for line in fstab:
+ if not line.startswith("#"):
+ if line.find(self.mount_point) > -1:
+ print " Found old mount %s in fstab, commenting out" %self.mount_point
+ line = "#"+line
+ f.write(line)
+ f.close()
+
#construct new line
new_options = self.find_options_type(fstab)[0]
new_fstab_list[0]="UUID=%s" %self.uuid
diff --git a/abs/core/LinHES-system/create_media_dirs.sh b/abs/core/LinHES-system/create_media_dirs.sh
index f56377b..7c4ff2f 100644
--- a/abs/core/LinHES-system/create_media_dirs.sh
+++ b/abs/core/LinHES-system/create_media_dirs.sh
@@ -1,5 +1,6 @@
#!/bin/bash
#script to create the media directories
+#used for building ISO (go.sh) and LiveCD (pre_install.sh)
#call it like so
#create_media_dirs.sh /top_level_path
@@ -30,6 +31,7 @@ done <<EOF
media/tv
media/tv/live
media/gallery
+media/photos
media/music
media/games/nes/roms
media/games/nes/screens
@@ -55,6 +57,7 @@ media/streaming
media/artwork/trailers
media/artwork/coverart
media/artwork/fanart
+media/artwork/musicart
media/artwork/screenshots
media/artwork/banners
media/games/screenshots
diff --git a/abs/core/LinHES-system/lh_system_backup_job b/abs/core/LinHES-system/lh_system_backup_job
index 00ab5f6..8539ff2 100644
--- a/abs/core/LinHES-system/lh_system_backup_job
+++ b/abs/core/LinHES-system/lh_system_backup_job
@@ -8,7 +8,7 @@ MYTH_RUN_STATUS="1"
. /etc/systemconfig
BACKUPDIR=/data/storage/disk0/backup/system_backups
SECBACKUPLINK=/data/storage/disk1
-KeepBackups=13
+KeepBackups=14
DATE=`date +%F_%H-%M`
backup_status=0
#
@@ -20,7 +20,7 @@ function lock_myth(){
}
function unlock_myth(){
- $MYTHSHUTDOWN --unlock
+ $MYTHSHUTDOWN --unlock
}
function backup_status_check(){
@@ -131,10 +131,20 @@ function backup(){
cd $BACKUPDIR
tar -zcf $BACKUPDIR/backup.$DATE.tgz $DATE
backup_status_check $?
- if [ -d $BACKUPDIR/$DATE ]
- then
- rm -rf $BACKUPDIR/$DATE
- fi
+ if [ -d $BACKUPDIR/$DATE ]
+ then
+ rm -rf $BACKUPDIR/$DATE
+ fi
+
+ if [ $backup_status -eq 0 ]
+ then
+ BACKUPPATH=$BACKUPDIR/backup.$DATE.tgz
+ else
+ echo "Backup had an error"
+ mkdir $BACKUPDIR/errored_backups
+ mv $BACKUPDIR/backup.$DATE.tgz $BACKUPDIR/errored_backups/backup.$DATE.tgz
+ BACKUPPATH=$BACKUPDIR/errored_backups/backup.$DATE.tgz
+ fi
if [ -f /home/xymon/server/ext/hbnotes.py ]
then
@@ -143,7 +153,7 @@ function backup(){
fi
echo
echo "Created backup file:"
- echo " $BACKUPDIR/backup.$DATE.tgz"
+ echo " $BACKUPPATH"
}
function update_backup_status(){
@@ -292,9 +302,13 @@ function remove_link(){
lock_myth
if [ "x$1" = "x" ]
then
- remove_old_backups
backup
update_backup_status
+ #only remove old backups if there was no problems
+ if [ $backup_status -eq 0 ]
+ then
+ remove_old_backups
+ fi
remote_backup
add_link
else