mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-19 17:11:15 +02:00
2024-11-05 Fred Gleason <fredg@paravelsystems.com>
* Added code to display the metadata of the proposed backup to restore in the warning message in rdautorest(8). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -24935,3 +24935,6 @@
|
||||
2024-11-05 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Modified rdautoback(8) so as to be able to take multiple mount
|
||||
point arguments.
|
||||
2024-11-05 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added code to display the metadata of the proposed backup
|
||||
to restore in the warning message in rdautorest(8).
|
||||
|
@@ -48,16 +48,6 @@ else:
|
||||
print(USAGE)
|
||||
exit(1)
|
||||
|
||||
if(not yes):
|
||||
print('WARNING: This operation will COMPLETELY OVERWRITE the existing')
|
||||
print(' Rivendell data on this system, replacing it with the')
|
||||
print(' contents of the specified data backup. This operation')
|
||||
print(' cannot be undone!')
|
||||
print('')
|
||||
resp=input(' Are you sure you want to proceed (y/N)?')
|
||||
if((resp.upper()!='Y')and(resp.upper()!='YES')):
|
||||
exit(0)
|
||||
|
||||
#
|
||||
# Load rd.conf(5)
|
||||
#
|
||||
@@ -68,21 +58,46 @@ rd_config.read_file(open('/etc/rd.conf'))
|
||||
# Open the syslog
|
||||
#
|
||||
syslog.openlog('rdautorest.py',logoption=syslog.LOG_PID|syslog.LOG_PERROR,facility=int(rd_config.get('Identity','SyslogFacility',fallback=syslog.LOG_USER)))
|
||||
syslog.syslog(syslog.LOG_INFO,'Starting Rivendell restore from "'+mountpoint+'"')
|
||||
|
||||
|
||||
#
|
||||
# Mount backup device
|
||||
#
|
||||
result=os.system(command='findmnt '+mountpoint)
|
||||
if(os.WEXITSTATUS(result)!=0):
|
||||
Path(mountpoint).mkdir(parents=True,exist_ok=True)
|
||||
result=os.system(command='mount '+mountpoint)
|
||||
if(os.WEXITSTATUS(result)!=0):
|
||||
result=os.WEXITSTATUS(os.system(command='mount '+mountpoint+" 2> /dev/null"))
|
||||
if((result!=0)and(result!=64)):
|
||||
syslog.syslog(syslog.LOG_ERR,'unable to mount backup drive')
|
||||
exit(1)
|
||||
os.system(command='sleep 5')
|
||||
|
||||
#
|
||||
# Print warning message
|
||||
#
|
||||
if(not yes):
|
||||
try:
|
||||
with open(mountpoint+'/INFO.txt','r') as f:
|
||||
print('WARNING!')
|
||||
print('This operation will COMPLETELY OVERWRITE the existing')
|
||||
print('Rivendell data on this system, replacing it with the')
|
||||
print('contents of the following data backup:')
|
||||
print()
|
||||
print(f.read())
|
||||
f.close()
|
||||
print('This operation cannot be undone!')
|
||||
except FileNotFoundError:
|
||||
print('WARNING!')
|
||||
print('This operation will COMPLETELY OVERWRITE the existing')
|
||||
print('Rivendell data on this system, replacing it with the')
|
||||
print('contents of the specified data backup. This operation')
|
||||
print('cannot be undone!')
|
||||
print('')
|
||||
resp=input('Are you sure you want to proceed (y/N)?')
|
||||
if((resp.upper()!='Y')and(resp.upper()!='YES')):
|
||||
os.system(command='umount '+mountpoint)
|
||||
os.rmdir(mountpoint)
|
||||
exit(0)
|
||||
|
||||
syslog.syslog(syslog.LOG_INFO,'Starting Rivendell restore from "'+mountpoint+'"')
|
||||
|
||||
#
|
||||
# Stop Rivendell service
|
||||
#
|
||||
|
Reference in New Issue
Block a user