Merge branch 'handle_spaces'
This commit is contained in:
		
						commit
						372a2076f4
					
				@ -31,7 +31,7 @@ method view(button: AppMenuButtonState): Widget =
 | 
				
			|||||||
                    programName = "EZ-Bkup"
 | 
					                    programName = "EZ-Bkup"
 | 
				
			||||||
                    logo = "ez_bkup"
 | 
					                    logo = "ez_bkup"
 | 
				
			||||||
                    style = [StyleClass("about-dialog")]
 | 
					                    style = [StyleClass("about-dialog")]
 | 
				
			||||||
                    version = "0.9.9"
 | 
					                    version = "0.9.10"
 | 
				
			||||||
                    credits = @{
 | 
					                    credits = @{
 | 
				
			||||||
                      "Created By": @["https://ITwrx.org"],
 | 
					                      "Created By": @["https://ITwrx.org"],
 | 
				
			||||||
                      "License": @["GPLv3"]
 | 
					                      "License": @["GPLv3"]
 | 
				
			||||||
 | 
				
			|||||||
@ -51,14 +51,17 @@ proc rsyncThread(list: RoutineListState) {.thread.} =
 | 
				
			|||||||
        for source in routine.sources:
 | 
					        for source in routine.sources:
 | 
				
			||||||
          for destination in routine.destinations:
 | 
					          for destination in routine.destinations:
 | 
				
			||||||
            #try without requiring superuser privs by default.
 | 
					            #try without requiring superuser privs by default.
 | 
				
			||||||
            rsyncRunCmd = "rsync -aq " & source & " " & destination
 | 
					            #rsyncRunCmd = "rsync -aq " & source & " " & destination
 | 
				
			||||||
 | 
					            #quote sources and destinations to handle possible spaces.
 | 
				
			||||||
 | 
					            rsyncRunCmd = "rsync -aq " & "'" & source & "'" & " " & "'" & destination & "'"
 | 
				
			||||||
            rsyncRun = execCmdEx(rsyncRunCmd)
 | 
					            rsyncRun = execCmdEx(rsyncRunCmd)
 | 
				
			||||||
            if rsyncRun.exitCode != 0:
 | 
					            if rsyncRun.exitCode != 0:
 | 
				
			||||||
              #handle permission denied error.
 | 
					              #handle permission denied error.
 | 
				
			||||||
              if rsyncRun.exitCode == 23:
 | 
					              if rsyncRun.exitCode == 23:
 | 
				
			||||||
                rsyncRun.exitCode = 0                 
 | 
					                rsyncRun.exitCode = 0                 
 | 
				
			||||||
                #rsyncRunCmd = "SUDO_ASKPASS=" & getAskPassPath() & " sudo -A rsync -aq " & source & " " & destination 
 | 
					                #rsyncRunCmd = "pkexec rsync -aq " & source & " " & destination 
 | 
				
			||||||
                rsyncRunCmd = "pkexec rsync -aq " & source & " " & destination                 
 | 
					                #quote sources and destinations to handle possible spaces. 
 | 
				
			||||||
 | 
					                rsyncRunCmd = "pkexec rsync -aq " & "'" & source & "'" & " " & "'" & destination & "'"            
 | 
				
			||||||
                rsyncRun = execCmdEx(rsyncRunCmd)
 | 
					                rsyncRun = execCmdEx(rsyncRunCmd)
 | 
				
			||||||
                if rsyncRun.exitCode != 0:
 | 
					                if rsyncRun.exitCode != 0:
 | 
				
			||||||
                  rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination)
 | 
					                  rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination)
 | 
				
			||||||
@ -67,14 +70,17 @@ proc rsyncThread(list: RoutineListState) {.thread.} =
 | 
				
			|||||||
                rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination)
 | 
					                rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination)
 | 
				
			||||||
            #explicitly check that sources were copied to destinations.
 | 
					            #explicitly check that sources were copied to destinations.
 | 
				
			||||||
            #just using file names, mod times, and size (same as bkup run itself). 
 | 
					            #just using file names, mod times, and size (same as bkup run itself). 
 | 
				
			||||||
            rsyncCheckCmd = "rsync -rn " & source & " " & destination
 | 
					            #quote sources and destinations to handle possible spaces.   
 | 
				
			||||||
 | 
					            #rsyncCheckCmd = "rsync -rn " & source & " " & destination
 | 
				
			||||||
 | 
					            rsyncCheckCmd = "rsync -rn " & "'" & source & "'" & " " & "'" & destination & "'"
 | 
				
			||||||
            rsyncCheckRun = execCmdEx(rsyncCheckCmd)
 | 
					            rsyncCheckRun = execCmdEx(rsyncCheckCmd)
 | 
				
			||||||
            if rsyncCheckRun.exitCode != 0:
 | 
					            if rsyncCheckRun.exitCode != 0:
 | 
				
			||||||
              #handle permission denied error.
 | 
					              #handle permission denied error.
 | 
				
			||||||
              if rsyncCheckRun.exitCode == 23:
 | 
					              if rsyncCheckRun.exitCode == 23:
 | 
				
			||||||
                rsyncCheckRun.exitCode = 0               
 | 
					                rsyncCheckRun.exitCode = 0               
 | 
				
			||||||
                #rsyncCheckCmd = "SUDO_ASKPASS=" & getAskPassPath() & " sudo -A rsync -rn " & source & " " & destination  
 | 
					                #quote sources and destinations to handle possible spaces.
 | 
				
			||||||
                rsyncCheckCmd = "pkexec rsync -rn " & source & " " & destination                 
 | 
					                #rsyncCheckCmd = "pkexec rsync -rn " & source & " " & destination 
 | 
				
			||||||
 | 
					                rsyncCheckCmd = "pkexec rsync -rn " & "'" & source & "'" & " " & "'" & destination & "'"               
 | 
				
			||||||
                rsyncCheckRun = execCmdEx(rsyncCheckCmd)
 | 
					                rsyncCheckRun = execCmdEx(rsyncCheckCmd)
 | 
				
			||||||
                if rsyncCheckRun.exitCode != 0:
 | 
					                if rsyncCheckRun.exitCode != 0:
 | 
				
			||||||
                  rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to verify that " & source & " got backed up to " & destination)
 | 
					                  rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to verify that " & source & " got backed up to " & destination)
 | 
				
			||||||
@ -87,7 +93,7 @@ proc rsyncThread(list: RoutineListState) {.thread.} =
 | 
				
			|||||||
    for err in rsyncErrors:
 | 
					    for err in rsyncErrors:
 | 
				
			||||||
      logger.log(lvlError, err)
 | 
					      logger.log(lvlError, err)
 | 
				
			||||||
  elif routineRunCount == 0:
 | 
					  elif routineRunCount == 0:
 | 
				
			||||||
    list.runStatus = "<span color=\"#FFA651\" size=\"large\">Meh. No Bkup Routines were run.</span>"
 | 
					    list.runStatus = "<span color=\"#FFA651\" size=\"large\">No Bkup Routines were enabled. None were run.</span>"
 | 
				
			||||||
  else:
 | 
					  else:
 | 
				
			||||||
    list.runStatus = "<span color=\"#6fffa3\" size=\"large\">Bkup Complete!</span>"             
 | 
					    list.runStatus = "<span color=\"#6fffa3\" size=\"large\">Bkup Complete!</span>"             
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user