outpaddling / desktop-installer

Quickly configure a FreeBSD or NetBSD desktop system
BSD 2-Clause "Simplified" License
54 stars 7 forks source link

Default to update & reboot even after rebooting #17

Closed yzgyyang closed 3 years ago

yzgyyang commented 3 years ago

The script defaults to update the system and reboot, however, after rebooting and rerunning sudo desktop-installer, the selection for the same prompt stayed at Y instead of N (I was expecting it to have some "memory" of previous selections/completed steps and default to N since we already rebooted).

It would be a bonus to check if the system is already the latest and skip this prompt.

Additionally, it would be a nice if the script could "continue where it left off" unless explicitly started from the beginning.

outpaddling commented 3 years ago

The problem here is that the previous run of desktop-installer might have been 6 months ago. Now the user wants to reconfigure the system so they just run desktop-installer again. If they haven't kept everything up-to-date, package installs will fail due to holes in dependency specs that don't cover ancient port versions. Hence, I want to encourage users to update everything at once before proceeding. To implement something like this, I would record a time-stamp of the last known update. Then change the default response if an update has been run in, say, the past few days. That wouldn't be able to detect updates done outside desktop-installer (or better, auto-update-system).

yzgyyang commented 3 years ago

@outpaddling I haven't really dug into this, but can we just check e.g. the return value of freebsd-update or similar to determine if there is no update to perform whatsoever? ;)

outpaddling commented 3 years ago

Unfortunately, neither pkg nor freebsd-update has a "check for available updates" command. I think anything I could implement now would be a kludge, so if people desire this functionality, they should work on adding it to the appropriate tools.

linimon commented 3 years ago

Hmm. Well here is the code snippet I have in my test script to deal with one set of packages:

for pkg in $common_pkgs; do
    if ! auto-package-installed $pkg && [ -d $PORTSDIR/$pkg ]; then
        rdescr=$(pkg rquery %e $pkg 2> /dev/null || true)
        if [ -z "${rdescr}" ]; then
            printf "Unfortunately, recommended package $pkg is not available for your system.\n"
        else

etc.

outpaddling commented 3 years ago

Hmm. Well here is the code snippet I have in my test script to deal with one set of packages:

for pkg in $common_pkgs; do
    if ! auto-package-installed $pkg && [ -d $PORTSDIR/$pkg ]; then
        rdescr=$(pkg rquery %e $pkg 2> /dev/null || true)
        if [ -z "${rdescr}" ]; then
            printf "Unfortunately, recommended package $pkg is not available for your system.\n"
        else

etc.

Rather than kill the option entirely, I used similar logic to ask the user if they want to attempt an install from source. The fact that there is no binary package does not mean that the port won't build. This will help on platforms with lagging package collections, like aarch64 and powerpc64.

BTW, this comment really belongs here:

https://github.com/outpaddling/desktop-installer/issues/13

outpaddling commented 3 years ago

Committed a change to WIP port to default NO if an update was run in the past 24 hours. I think should should pretty well eliminate nuisance reboots.