Fixed backup/restore issues, uses correct data directory variable now.

This commit is contained in:
echel0n 2014-06-24 16:40:13 -07:00
parent cc6e9aa0f5
commit 10bea520a7
2 changed files with 10 additions and 10 deletions

View file

@ -270,14 +270,6 @@ def main():
sickbeard.CREATEPID = False sickbeard.CREATEPID = False
# Check if we need to perform a restore first
restoreDir = os.path.join(sickbeard.PROG_DIR, 'restore')
if os.path.exists(restoreDir):
if restore(restoreDir, sickbeard.PROG_DIR):
logger.log(u"Restore successful...")
else:
logger.log(u"Restore FAILED!", logger.ERROR)
# If they don't specify a config file then put it in the data dir # If they don't specify a config file then put it in the data dir
if not sickbeard.CONFIG_FILE: if not sickbeard.CONFIG_FILE:
sickbeard.CONFIG_FILE = os.path.join(sickbeard.DATA_DIR, "config.ini") sickbeard.CONFIG_FILE = os.path.join(sickbeard.DATA_DIR, "config.ini")
@ -300,6 +292,14 @@ def main():
elif not os.access(os.path.dirname(sickbeard.CONFIG_FILE), os.W_OK): elif not os.access(os.path.dirname(sickbeard.CONFIG_FILE), os.W_OK):
raise SystemExit("Config file root dir '" + os.path.dirname(sickbeard.CONFIG_FILE) + "' must be writeable.") raise SystemExit("Config file root dir '" + os.path.dirname(sickbeard.CONFIG_FILE) + "' must be writeable.")
# Check if we need to perform a restore first
restoreDir = os.path.join(sickbeard.DATA_DIR, 'restore')
if os.path.exists(restoreDir):
if restore(restoreDir, sickbeard.DATA_DIR):
logger.log(u"Restore successful...")
else:
logger.log(u"Restore FAILED!", logger.ERROR)
os.chdir(sickbeard.DATA_DIR) os.chdir(sickbeard.DATA_DIR)
if consoleLogging: if consoleLogging:

View file

@ -1483,7 +1483,7 @@ class ConfigBackupRestore(MainHandler):
finalResult = '' finalResult = ''
if backupDir: if backupDir:
source = [os.path.join(sickbeard.PROG_DIR, 'sickbeard.db'), os.path.join(sickbeard.PROG_DIR, 'config.ini')] source = [os.path.join(sickbeard.DATA_DIR, 'sickbeard.db'), os.path.join(sickbeard.DATA_DIR, 'config.ini')]
target = os.path.join(backupDir, 'sickrage-' + time.strftime('%Y%m%d%H%M%S') + '.zip') target = os.path.join(backupDir, 'sickrage-' + time.strftime('%Y%m%d%H%M%S') + '.zip')
if helpers.makeZip(source, target): if helpers.makeZip(source, target):
@ -1505,7 +1505,7 @@ class ConfigBackupRestore(MainHandler):
if backupFile: if backupFile:
source = backupFile source = backupFile
target_dir = os.path.join(sickbeard.PROG_DIR, 'restore') target_dir = os.path.join(sickbeard.DATA_DIR, 'restore')
if helpers.extractZip(source, target_dir): if helpers.extractZip(source, target_dir):
finalResult += "Successfully extracted restore files to " + target_dir finalResult += "Successfully extracted restore files to " + target_dir