refactor for pkexec
This commit is contained in:
parent
b183de6a93
commit
959bb7305f
|
@ -1,10 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
## 0.9.9 - 7-5-23
|
||||
## 0.9.9 - 7-14-23
|
||||
### Added
|
||||
- Added /usr/lib/ssh/x11-ssh-askpass path. (ITwrx)
|
||||
- Added org.itwrx.EZ-Bkup.png for window/workspace icon. (ITwrx)
|
||||
### Changed
|
||||
- remove path to non-functional gnome-ssh-askpass. (ITwrx)
|
||||
- refactored to use pkexec instead of ssh-askpass. (ITwrx)
|
||||
- Updated EZ-Bkup version in app_menu_button.nim. (ITwrx)
|
||||
|
||||
## 0.9.8 - 7-5-23
|
||||
### Added
|
||||
|
@ -12,7 +13,7 @@
|
|||
### Changed
|
||||
- Made some file names more uniform. (ITwrx)
|
||||
- Re-added selectedPreload proc accidentally removed from Routine.nim in last release. (ITwrx)
|
||||
- Updated EZ-Bkup version in app_menu_button.nim and ez_bkup.desktop (included with installer in the funded release). (ITwrx)
|
||||
- Updated EZ-Bkup version in app_menu_button.nim. (ITwrx)
|
||||
|
||||
## 0.9.7 - 7-1-23
|
||||
### Added
|
||||
|
|
|
@ -18,6 +18,7 @@ method view(app: AppState): Widget =
|
|||
Window:
|
||||
title = APP_NAME
|
||||
defaultSize = (1024, 768)
|
||||
iconName = "org.itwrx.EZ-Bkup"
|
||||
HeaderBar {.addTitlebar.}:
|
||||
Icon {.addLeft.}:
|
||||
name = "ez_bkup"
|
||||
|
|
22
shared.nim
22
shared.nim
|
@ -4,7 +4,6 @@ EZ-Bkup is released under the General Public License 3.0.
|
|||
See COPYING or <https://www.gnu.org/licenses/> for details.]#
|
||||
|
||||
import logging, times, os
|
||||
#import "models/routine"
|
||||
|
||||
let appPath* = getHomeDir() & ".ez-bkup"
|
||||
let databasePath* = appPath & "/ez-bkup.sqlite"
|
||||
|
@ -15,7 +14,6 @@ if not dirExists(appPath):
|
|||
var logger = newFileLogger(appPath & "/errors.log")
|
||||
let dt = now()
|
||||
let nowDT* = dt.format("M-d-YYYY h:mm:ss tt")
|
||||
#var logMsg: string
|
||||
|
||||
proc writeErrorToLog*(logMsg: string) =
|
||||
logger.log(lvlError, logMsg)
|
||||
|
@ -24,22 +22,4 @@ proc writeInfoToLog*(logMsg: string) =
|
|||
logger.log(lvlInfo, logMsg)
|
||||
|
||||
proc hasCommas*(filename: string):bool =
|
||||
',' in filename
|
||||
|
||||
proc getAskPassPath*(): string =
|
||||
var askPassPath: string
|
||||
|
||||
if fileExists("/usr/libexec/openssh/ssh-askpass"):
|
||||
askPassPath = "/usr/libexec/openssh/ssh-askpass"
|
||||
elif fileExists("/usr/lib/ssh/x11-ssh-askpass"):
|
||||
askPassPath = "/usr/lib/ssh/x11-ssh-askpass"
|
||||
elif fileExists("/usr/lib/ssh/gtk-ssh-askpass"):
|
||||
askPassPath = "/usr/lib/ssh/gtk-ssh-askpass"
|
||||
elif fileExists("/usr/lib/ssh/ssh-askpass"):
|
||||
askPassPath = "/usr/lib/ssh/ssh-askpass"
|
||||
else:
|
||||
askPassPath = ""
|
||||
|
||||
return askPassPath
|
||||
|
||||
|
||||
',' in filename
|
||||
|
|
|
@ -57,14 +57,11 @@ proc rsyncThread(list: RoutineListState) {.thread.} =
|
|||
#handle permission denied error.
|
||||
if rsyncRun.exitCode == 23:
|
||||
rsyncRun.exitCode = 0
|
||||
if getAskPassPath() == "":
|
||||
let err = "No ssh-askpass binary found. Please install an ssh-askpass package for your distro, and let us know if EZ-Bkup still can't detect it's location."
|
||||
rsyncErrors.add(err)
|
||||
else:
|
||||
rsyncRunCmd = "SUDO_ASKPASS=" & getAskPassPath() & " sudo -A rsync -aq " & source & " " & destination
|
||||
rsyncRun = execCmdEx(rsyncRunCmd)
|
||||
if rsyncRun.exitCode != 0:
|
||||
rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination)
|
||||
#rsyncRunCmd = "SUDO_ASKPASS=" & getAskPassPath() & " sudo -A rsync -aq " & source & " " & destination
|
||||
rsyncRunCmd = "pkexec rsync -aq " & source & " " & destination
|
||||
rsyncRun = execCmdEx(rsyncRunCmd)
|
||||
if rsyncRun.exitCode != 0:
|
||||
rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination)
|
||||
#handle non-perms related error.
|
||||
else:
|
||||
rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination)
|
||||
|
@ -75,15 +72,12 @@ proc rsyncThread(list: RoutineListState) {.thread.} =
|
|||
if rsyncCheckRun.exitCode != 0:
|
||||
#handle permission denied error.
|
||||
if rsyncCheckRun.exitCode == 23:
|
||||
rsyncCheckRun.exitCode = 0
|
||||
if getAskPassPath() == "":
|
||||
let err = "No ssh-askpass binary found. Please install an ssh-askpass package for your distro, and let us know if EZ-Bkup still can't detect it's location."
|
||||
rsyncErrors.add(err)
|
||||
else:
|
||||
rsyncCheckCmd = "SUDO_ASKPASS=" & getAskPassPath() & " sudo -A rsync -rn " & source & " " & destination
|
||||
rsyncCheckRun = execCmdEx(rsyncCheckCmd)
|
||||
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)
|
||||
rsyncCheckRun.exitCode = 0
|
||||
#rsyncCheckCmd = "SUDO_ASKPASS=" & getAskPassPath() & " sudo -A rsync -rn " & source & " " & destination
|
||||
rsyncCheckCmd = "pkexec rsync -rn " & source & " " & destination
|
||||
rsyncCheckRun = execCmdEx(rsyncCheckCmd)
|
||||
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)
|
||||
#handle non-perms related error.
|
||||
else:
|
||||
rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to verify that " & source & " got backed up to " & destination)
|
||||
|
@ -101,7 +95,7 @@ proc rsyncThread(list: RoutineListState) {.thread.} =
|
|||
|
||||
method view(list: RoutineListState): Widget =
|
||||
result = gui:
|
||||
ScrolledWindow:
|
||||
ScrolledWindow:
|
||||
Box:
|
||||
orient = OrientY
|
||||
if list.routineModel.routineSeq().len() > 0:
|
||||
|
|
Loading…
Reference in New Issue