Page 37 of 39 FirstFirst ... 273536373839 LastLast
Results 361 to 370 of 388

Thread: Inspired

  1. #361
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Inspired

    @sudodus

    In the above added prompts noted Post #356... Do you not think that those added comments and the ones already there, further on in the script, in the Paster() function, that those are not enough?

    Or do you think I should add another additional, comments to the initial seen in the 'Missing Program' comments on just those 4 utilities used later in that paste function? That way it is stated upfront?

    If 'stated' in both places... Then the correct way would be to declare that message text in variable to display at multiple times... or move it out into it's own function to control it's display, at multiple times.

    Or... move those four out into it's own 'condition filter' just like mokutil within the Check Prereqs... But if I do it there, it would repeats that message for each of the 4 progs, each time one of them is missing. That could get messy quickly.

    *** As I started working on this improvement, I declared a variable to hold any missing programs, instead of just displaying them to screen, so that I can evaluate and process that variable to include in the report. If I add another function to evaluate if any of those utilities used later in the Paster() function are missing (in that $missing_programs variable), set a Boolean flag, If flag changed, then I insert added message about it 'once' But really, I would need to eval if 'all four are missing... It still has the ability to upload the Report, as long as it has one of those four are present... Hmmm. So maybe not type Boolean, but rather type Integer, and incremented for each of those four missing...

    Thinking out loud...
    Last edited by MAFoElffen; December 2nd, 2021 at 10:52 PM.

    Concurrent coexistance of Windows, Linux and UNIX...
    Ubuntu user # 33563, Linux user # 533637
    Sticky: [all variants] Graphics Resolution- Upgrade /Blank Screen after reboot
    UbuntuForums system-info Script

  2. #362
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Inspired

    Here is the test protoype script for the changes:
    Code:
    #!/bin/bash
    ## mafoelffen, 2021.12.02
    
    missing_programs=""
    check_paster=0
    missing_paster_progs=""
    
    function nl() 
    {
        echo -e ""
    }
    
    function CheckPrerequisites()   
    {
        ## Check if all necessary programs are available. Called once by Main().
        # Programs that are in /bin or /usr/bin.
        Programs='
            sudo
            cat
            grep
            egrep
            awk
            free
            gsettings
            gzip
            md5sum
            mokutil
            curl
            pastebinit
            ubuntu-drivers
            dpkg
            nc
            wget
            ls
            rm
            sed
            ping
            id
            ip
            hostname
            lsblk
            lsusb
            sleep
            sort
            whoami
            test_dummy1
            test_dummy2
            who'
    
        # Programs that are in /usr/sbin or /sbin.
        Programs_SBIN='fdisk
            test_dummy3
            test_dummy4
            lshw'
    
        check_prog=1;
        check_mokutil=1;
    
        for Program in ${Programs} ${Programs_SBIN} 
        do
            if [ $(type ${Program} > /dev/null 2>&1 ; echo $?) -ne 0 ]
            then
                echo -e " --- Some Programs This Script Uses Were Missing --- "
                if [[ "$Program" == "mokutil" ]]
                then    # If not 'Here' condition
                    # If this missing, it is a variant for UEFI systems only. It does work on 18.04 where it was not default yet, and is 
                    # a useful option to see if there "is" a SecureBoot option in the BIOS, besides just what it is set at. This, during 
                    # tests, is safe to install on Legacy Only BIOS systems and can be used to tell if the BIOS is such.
                    echo -e "$faintvid \"${Program}\" Could not be found. This program is suggested.$resetvid" 
                    echo -e "$faintvid If this is older hardware that is 'Legacy Only BIOS', then this can be ignored.$resetvid"
                    echo -e "$faintvid The report will still run without it. It will just not be able to answer one question. $resetvid"
                    check_mokutil=0;    # Set Flag to false and recheck in GetSb()
                    check_prog=0;
                    missing_programs="$missing_programs\n$Program"
                    debug "'$Program' is not installed" 1
                elif [[ "$Program" == "pastebinit" ]] || [[ "$Program" == "wget" ]] || [[ "$Program" == "curl" ]] || [[ "$Program" == "nc" ]]
                    then
                    check_prog=0;
                    check_paster=$check_paster+1;
                    missing_paster_progs="$missing_paster_progs$Programs, "
                    missing_programs="$missing_programs\n$Program"
                else
                    echo -e "'$Program' is not installed."
                    check_prog=0;
                    missing_programs="$missing_programs\n$Program"
                fi
                echo -e " -------------------------------- "
            fi
        done
        
        if [ "$check_prog" == 0 ]
        then
            nl
            echo -e "The Script 'system-info' uses some very basic Linux utilities. "
            echo -e "Some of these utilities were not found."
            nl
            echo -e "The report will still run without them. It will just not answer related questions."
            echo -e "Some of that information may be related to the diagnosis of your installed system."
            echo -e "If missing utilities may have answered your specified problem, you may "
            echo -e "be asked by a 'Ubuntu Forums Member' supporting you if a program was missing, and "
            echo -e "if you could install it to answer that related question."
            nl
            CheckPaster
            echo -e "Some of these utilities are not default installed utilities to all Editions, "
            echo -e "versions, and flavors of Ubuntu... So may be considered as optional. "
           
            ans=
            while [ "$ans" != "e" ] && [ "$ans" != "c" ]
            do
                read -p "<E>xit and install the program(s) or <C>ontinue anyway? <E/C> " ans 
                ans="${ans,}" 
                debug "User answered $ans" 1
                if [[ $ans =~ ^[Ee]$ ]]
                then
                    echo -e "Please install the missing programs listed above before rerunning script." 
                    exit
                elif [[ ${ans,} =~ ^[Cc]$ ]]
                then
                    echo -e "Some task(s) will not work, but I'll do the best possible, continuing ..." 
                    sleep 1
                fi
            done
        else
            echo -e "All required programs installed..."
            sleep 1
        fi
    }
    
    function CheckPaster() {
        if [ $check_paster -eq 4 ]
        then
            echo -e "Programs 'pastebinit', 'curl', 'wget', and 'nc' are missing. "
            echo -e "All 4 utilities used to upload this report to a PasteBin are missing."
            echo -e "The report will still run. If not installed, you would just need to "
            echo -e "paste the report into a post, contained within 'CODE' Tags."
            nl
        fi
        if [ $check_paster -le 3 -a $check_paster -ge 1 ]
        then
            echo -e "Programs $missing_paster_progs are missing, "
            echo -e "but can be ignored as there still are installed utilities present to "
            echo -e "to be able to upload the report to an online PasteBin."
            nl
        fi  
    }
    
    function ProcessMissingPrograms() {
        echo -e "---- Required Programs For Report."
        if [[ "$missing_programs" == "" ]]
        then
            echo -e "    All required programs installed for report. "
            nl
        else
            echo -e "    --- Some Programs This Script Uses Were Missing --- "
            echo -e "$missing_programs" | awk 'NF && !/^(start|#)/ {print "    " $0}'
            nl
        fi
    }
    
    ## MAIN
    CheckPrerequisites
    #echo -e "---- Test the script output ----"
    ProcessMissingPrograms
    exit
    Last edited by MAFoElffen; December 3rd, 2021 at 12:41 AM.

    Concurrent coexistance of Windows, Linux and UNIX...
    Ubuntu user # 33563, Linux user # 533637
    Sticky: [all variants] Graphics Resolution- Upgrade /Blank Screen after reboot
    UbuntuForums system-info Script

  3. #363
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Inspired

    @MAFoElffen,

    This looks good.

    There are some minor edits that I am sending to you via email (and an attached tarball).

  4. #364
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Inspired

    Updated the script and pushed the changes to www.github.com/MAFoElffen1/system-info DEV/TEST... Note that I did not push to STABLE at UbuntuForums yet. In this commit: "Fixed HWE routines. Added xrandr info. Updated/Changed GetPrequisites()."

    I would like it to be tested and verified before I push it to STABLE, Please.
    Last edited by MAFoElffen; December 5th, 2021 at 12:49 AM.

    Concurrent coexistance of Windows, Linux and UNIX...
    Ubuntu user # 33563, Linux user # 533637
    Sticky: [all variants] Graphics Resolution- Upgrade /Blank Screen after reboot
    UbuntuForums system-info Script

  5. #365
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,101
    Distro
    Ubuntu Development Release

    Re: Inspired

    O.K. I still keep both repositories. So looking at this:

    Code:
    10089f3 (HEAD -> main, origin/main, origin/HEAD) Fixed HWE routines. Added xrandr info. Updated/Changed GetPrequisites().
    Which oddly, doesn't have the executable bit set anymore:

    Code:
    doug@s19:~/tmp/system-info$ ls -l system-info
    -rw-rw-r-- 1 doug doug 40490 Dec  4 16:44 system-info
    So, I'll set them myself.

    Code:
    doug@s19:~/tmp/system-info$ git diff
    diff --git a/system-info b/system-info
    old mode 100644
    new mode 100755
    I might try to trace the permissions history later, as it would be a fast git bisection to figure out.

    Anyway, I have some missing programs and my run is here: https://paste.ubuntu.com/p/6pbyqCfz3s/

    It seems O.K., but part way through I don't understand this:

    Code:
    groups=1000(doug),4(adm),24(cdrom),27(sudo),29(audio),30(dip),
    46(plugdev),111(lxd),117(lpadmin),118(sambashare),124(libvirt)
    
    *** End Of Report ***
     ---------- INSTRUCTIONS FOR THE VIEWER 'LESS' ----------
    You are using the viewer 'less'.
    Advance to a next page with the <SpaceBar> key.
    Navigate what has been displayed with the
    :
    With the??? The missing information is on the next page, but I do not realize it at the time.

    The commit "Changing file permissions" is in the forums version, but not in the working version.
    Last edited by Doug S; December 5th, 2021 at 02:13 AM.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  6. #366
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Inspired

    OK, MAFoElffen,

    I'll add to the feedback by DougS via a new tarball, that I am sending to you via email.

    There are a few I think new bugs,
    - should be: check_paster=$((check_paster+1))
    - should be: xmode=$(xrandr -q | egrep --color=never -e 'Screen' -e ' connected ')

    and an old set of bugs that was not discovered until now (taking care of error output from ping when no internet).

  7. #367
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Inspired

    @Doug S
    My fault. I edited it on my laptop while on break from work, then transferred it to the .git my Desktop when I got home... It didn't transfer the executable bit on that transfer. Dang. I'll correct that (again).

    Quote Originally Posted by sudodus View Post
    OK, MAFoElffen,

    I'll add to the feedback by DougS via a new tarball, that I am sending to you via email.

    There are a few I think new bugs,
    - should be: check_paster=$((check_paster+1))
    - should be: xmode=$(xrandr -q | egrep --color=never -e 'Screen' -e ' connected ')

    and an old set of bugs that was not discovered until now (taking care of error output from ping when no internet).
    I don't get it... This is where to discuss this. I could have just said no to your suggested change
    Code:
    check_paster=$check_paster+1;       ## original longhand
    check_paster+=1;                              ## just increment whatever by one, now
    ++check_paster;                                ## increment before
    check_paster++;                                ## increment after
    check_paster=$((check_paster+1));    ## your suggestion
    check_paster=$($check_paster+1);  ## another longhand version
    # ...
    ((check_paster=$check_paster+1)); 
    ((check_paster+=1));
    ((++check_paster));
    ((check_paster++));  
    let "check_paster=$check_paster+1";
    let "check_paster+=1";
    let "++check_paster;"
    let "check_paster++";
    check_paster=$((check_paster++));
    check_paster=$((++check_paster));
    check_paster=((check_paster+=1));
    ..as BASH goes, syntax wise all increment by one. I am counting the missing utilities used by Paster(), which doesn't matter, except if all 4 are missing.

    I saw what you suggested, though none of the above variants in syntax is a Bug, as long as it increments the count of those missing programs. Not all of those work on all platforms. They 'all' work and increment by one. Right?

    I added
    Code:
    xmode=$(xrandr -q | egrep --color=never -e 'Screen' -e 'connected primary')
    As an addition, because in diagnostics of answering the question of what the resolution of the primary display used fr the desktop. This is not a Bug, as it answers that question. If multiple displays it would show more, but if the primary display is not working, none of the others matter, right? Are you suggesting that you want to open that filter up, by removing the filter on "primary" to show more? That is a change, not a Bug... Just being objective.

    an old set of bugs that was not discovered until now (taking care of error output from ping when no internet)
    Are you aware of a 'newly known' Bug that was not found from the previous testing? If you did, do not keep it a secret... otherwise it is not 'known', right? LOL It sounds like you just prefer that I redirect the stderr of that, right? Tell me and I will fix it.

    That is what this Thread is for, to discuss these...

    I am being told by others, that this thread is not how it 'should work'. They tell me that all Bugs should be reported as Issues to the GitHub Repo as Issues, that any proposed changes should be pushed to the Repo, divided up into a single Push for each individual change... To track that individual change, and that I should approve or deny each as such...

    I see that kind of micro-managed process as a pain in the behind, and more work than it needs to be. I think the way we have been doing this is great. I think what we have been doing and how we have been doing it works. And discussing it, the way we do, keeps thinking open-minded, and opens up things to be heard and... there are hundreds of ways to do the same thing. I am open to learn other ways of doing things, and am not aware of all ways. I am teachable to new things and ways of doing something... I respect how you all feel and the great ideas about things brought up here. I think going to that, those new or alternate ideas would not be heard.
    Last edited by MAFoElffen; December 6th, 2021 at 01:25 AM.

    Concurrent coexistance of Windows, Linux and UNIX...
    Ubuntu user # 33563, Linux user # 533637
    Sticky: [all variants] Graphics Resolution- Upgrade /Blank Screen after reboot
    UbuntuForums system-info Script

  8. #368
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Inspired

    @MAFoElffen,

    I am really sorry.

    There is a reason for sending the detailed feedback via mail: Sending a longer patch file here within code tags will cause problems with a filter, so that posting will fail.
    Last edited by sudodus; December 6th, 2021 at 09:47 AM.

  9. #369
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Inspired

    To all...

    As I explained to sudodus in private, he misunderstood. I was and am not upset. I/we need the reasons "why", the feedback and background that says "why" there is a problem why... this is what it does if written this way... Not just "change it to this". That way we can all learn what works, what doesn't, and how to learn from that, to write smarter code from that. I don't know if that makes sense as I wrote that... But we need to know what the problem is, so that we can learn from that, and know what works and doesn't.

    He did find that in those expressions, even though they could be written 100 of ways, and I know that some ways have problems on some hardware, and on some platforms, he found that hardware he had, fell into that pool (but hadn't let me know that yet). That information is invaluable for us to know.

    Never feel hesitant about bringing something up here. If we know the information, facts and background, then we can learn and make informed decisions based on what 'can work'.

    My last post here was begging for that feedback on this. That is now understood. Now I can make changes based on that... And we have a few more things to test for, to see if there are other problems to steer clear of.
    Last edited by MAFoElffen; December 6th, 2021 at 10:48 PM.

    Concurrent coexistance of Windows, Linux and UNIX...
    Ubuntu user # 33563, Linux user # 533637
    Sticky: [all variants] Graphics Resolution- Upgrade /Blank Screen after reboot
    UbuntuForums system-info Script

  10. #370
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Inspired

    I have an idea...

    Since this script is not going to get formally announced by the Admin Council in a Sticky, as it was with the wireless-info script in the past... Yes, I was told that they would not post an announcement as was with the wireless-info script Sticky, as there was already so many Sticky's in the Hardware Section already... And it didn't seem that they (The Admin Council) could decide what to do after that.

    it is up to us to spread and make people know it is available and what it does. I was told we could make announcement posts about it... But I do not know were that would be appropriate, nor where it would be seen by who we want it to, or where it would not get berried quickly by other threads. Any ideas on that?

    Do people read the Ubuntu UWN? Should I write an Article on our script to submit to the Ubuntu UWN?
    Last edited by MAFoElffen; December 6th, 2021 at 11:04 PM.

    Concurrent coexistance of Windows, Linux and UNIX...
    Ubuntu user # 33563, Linux user # 533637
    Sticky: [all variants] Graphics Resolution- Upgrade /Blank Screen after reboot
    UbuntuForums system-info Script

Page 37 of 39 FirstFirst ... 273536373839 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •