Skip to content

Commit

Permalink
"Once" download scan only scans one package, not all of them
Browse files Browse the repository at this point in the history
  • Loading branch information
kwindrem committed Apr 15, 2024
1 parent bce8491 commit c8f43c6
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 70 deletions.
127 changes: 60 additions & 67 deletions PackageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3698,88 +3698,79 @@ def mainLoop ():
DbusIf.UpdateStatus ( "uninstalling SetupHelper ...", where='Editor' )
mainloop.quit()
return False
idleMessage = ""

actionMessage = ""
statusMessage = ""
bootReinstallFile="/etc/venus/REINSTALL_PACKAGES"


# hold off all package processing if package list is empty
emptyPackageList = False
reinstallModsRunning = False
if len (PackageClass.PackageList) == 0:
emptyPackageList = True
holdOffScan = True
# hold off processing if reinstallMods is running to prevent conflicts
# probalby never happen but just in case
elif os.path.exists ("/etc/venus/REINSTALL_MODS_RUNNING"):
reinstallModsRunning = True
holdOffScan = True

# if boot-time reinstall has been requiested by reinstallMods
# override modes and initiate auto install of all packages
bootReinstallFile="/etc/venus/REINSTALL_PACKAGES"
if os.path.exists (bootReinstallFile):
elif os.path.exists (bootReinstallFile):
# beginning of boot install - reset package index to insure a complete scan
if not bootInstall:
packageIndex = 0
logging.warning ("starting boot-time reinstall")
bootInstall = True
currentDownloadMode = AUTO_DOWNLOADS_OFF
lastDownloadMode = AUTO_DOWNLOADS_OFF
autoInstall = False
autoInstall = True
holdOffScan = False
elif WaitForGitHubVersions:
holdOffScan = True
# not doing boot install - use dbus values
else:
holdOffScan = False
autoInstall = DbusIf.GetAutoInstall ()
# save mode before chaning so changes can be detected below
lastDownloadMode = currentDownloadMode
currentDownloadMode = DbusIf.GetAutoDownloadMode ()
autoInstall = DbusIf.GetAutoInstall ()

# hold off processing if reinstallMods is running to prevent conflicts
# probalby never happen but just in case
if os.path.exists ("/etc/venus/REINSTALL_MODS_RUNNING"):
reinstallModsRunning = True
else:
reinstallModsRunning = False


# hold off all package processing if package list is empty
# or until the GitHub versions have been updated
# and reinstallMods has finished reinstalling packages after Venus OS update
if len (PackageClass.PackageList) == 0:
holdOffScan = True
emptyPackageList = True
else:
emptyPackageList = False
holdOffScan = reinstallModsRunning or ( WaitForGitHubVersions and not bootInstall )

# setup idle messages
if emptyPackageList:
idleMessage = "no active packages"
# no updates has highest prioroity
elif bootInstall:
idleMessage = "reinstalling packages after firmware update"
elif currentDownloadMode == AUTO_DOWNLOADS_OFF and not autoInstall:
idleMessage = ""
# hold-off of processing has next highest priority
elif WaitForGitHubVersions:
idleMessage = "refreshing GitHub version information"
elif reinstallModsRunning:
idleMessage = "waiting for boot reinstall to complete"
# finally, set idleMessage based on download and install states
elif currentDownloadMode != AUTO_DOWNLOADS_OFF and autoInstall:
idleMessage = "checking for downloads and installs"
elif currentDownloadMode == AUTO_DOWNLOADS_OFF and autoInstall:
idleMessage = "checking for installs"
elif currentDownloadMode != AUTO_DOWNLOADS_OFF and not autoInstall:
idleMessage = "checking for downloads"

# don't do anything yet but make sure new scan starts at beginning
# download mode changed
# restart at beginning of list and signal mode change to the GitHub version thread
if currentDownloadMode != lastDownloadMode \
and ( currentDownloadMode == ONE_DOWNLOAD or lastDownloadMode == AUTO_DOWNLOADS_OFF ):
print ("#### starting new download scan")
holdOffScan = True
WaitForGitHubVersions = True
UpdateGitHubVersion.SetPriorityGitHubVersion ('REFRESH')

# make sure a new scan starts at beginning of list
if holdOffScan:
packageIndex = 0
# process one package per pass of mainloop
else:
DbusIf.LOCK ("mainLoop 1")
packageListLength = len (PackageClass.PackageList)
# reached end of list - start over
if packageIndex >= packageListLength:
packageIndex = 0
# end of ONCE download - switch auto downloads off
if currentDownloadMode == ONE_DOWNLOAD:
print ("#### ONCE download finished")
DbusIf.SetAutoDownload (AUTO_DOWNLOADS_OFF)
currentDownloadMode = AUTO_DOWNLOADS_OFF
# end of boot install
if bootInstall:
logging.warning ("boot-time reinstall complete")
bootInstall = False
if os.path.exists (bootReinstallFile):
os.remove (bootReinstallFile)

package = PackageClass.PackageList [packageIndex]
packageName = package.PackageName
packageIndex += 1
if currentDownloadMode != lastDownloadMode:
# signal mode change to the GitHub threads
if currentDownloadMode == ONE_DOWNLOAD or lastDownloadMode == AUTO_DOWNLOADS_OFF:
# reset index to start of package list when mode changes
packageIndex = 0
WaitForGitHubVersions = True
UpdateGitHubVersion.SetPriorityGitHubVersion ('REFRESH')

package.UpdateVersionsAndFlags (doConflictChecks=True)

Expand All @@ -3800,8 +3791,6 @@ def mainLoop ():
if os.path.exists (oneTimeInstallFile):
os.remove (oneTimeInstallFile)
oneTimeInstall = True
elif bootInstall:
installOk = True
elif autoInstall:
installOk = True
else:
Expand Down Expand Up @@ -3861,18 +3850,6 @@ def mainLoop ():
# wait for two complete passes with nothing happening
# before triggering reboot, GUI restart or initializing PackageManager Settings
if noActionCount >= 2:
# if no actions are pending, switch download modes if appropriate
# and flag boot-time reinstall is complete
if not holdOffScan:
if currentDownloadMode == ONE_DOWNLOAD:
DbusIf.SetAutoDownload (AUTO_DOWNLOADS_OFF)
# end of boot install
if bootInstall:
logging.warning ("boot-time reinstall complete")
bootInstall = False
if os.path.exists (bootReinstallFile):
os.remove (bootReinstallFile)

if SystemReboot:
statusMessage = "rebooting ..."
# exit the main loop
Expand Down Expand Up @@ -3914,6 +3891,22 @@ def mainLoop ():
elif actionMessage != "":
DbusIf.UpdateStatus ( actionMessage, where='PmStatus' )
else:
if emptyPackageList:
idleMessage = "no active packages"
elif reinstallModsRunning:
idleMessage = "waiting for boot reinstall to complete"
elif bootInstall:
idleMessage = "reinstalling packages after firmware update"
elif WaitForGitHubVersions:
idleMessage = "refreshing GitHub version information"
elif currentDownloadMode != AUTO_DOWNLOADS_OFF and autoInstall:
idleMessage = "checking for downloads and installs"
elif currentDownloadMode == AUTO_DOWNLOADS_OFF and autoInstall:
idleMessage = "checking for installs"
elif currentDownloadMode != AUTO_DOWNLOADS_OFF and not autoInstall:
idleMessage = "checking for downloads"
else:
idleMessage = ""
DbusIf.UpdateStatus ( idleMessage, where='PmStatus' )

# enable the following lines to report execution time of main loop
Expand Down
2 changes: 1 addition & 1 deletion blindInstall/SetupHelperVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.0~20
v8.0~21
3 changes: 2 additions & 1 deletion changes
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ v8.0: (beta)
add TailscaleGX to default package list
fixed: PackageManager hangs if there is no setup script in package directory
fixed: package conflict message disappears
basd conflict checking mechanisms on file modificaiton times
fixed: "Once" download scan only scans one package, not all of them
based conflict checking mechanisms on file modificaiton times
to eliminate unnecessary work

v7.18:
Expand Down
Binary file modified venus-data-UninstallPackages.tgz
Binary file not shown.
Binary file modified venus-data.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.0~20
v8.0~21

0 comments on commit c8f43c6

Please sign in to comment.