Announcement

Collapse
No announcement yet.

Little update script

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Little update script

    [EDIT] See post #5 for new and improved :·) version.
    For those who like the CLI but don't really like the CLI,
    and for those who can't be bothered with aliases,
    and for anyone who might be vaguely interested in a kdialog+xterm script,
    and to relieve the boredom of a rainy confined day...

    I made a little script with a few (3) options to do the pesky updates.
    All it does is let you choose between:
    - Doing a full update.
    - Just update the database.
    - List upgradable packages.

    Just save the code below as update.sh (or whatever), make it executable, and check it out.
    Suggestions welcome.
    Code:
    #!/bin/bash
    choice=$(kdialog --title "Updates" --separate-output --checklist "Update options:" 1 "List upgradable packages" off 2  "Update database only" off 3 "Update database and install packages" off 4 "Exit" off);
    
    if [ "$choice" = 1 ]; then
    xterm -hold -fa 'Monospace' -fs 12 -geometry 120x44+40+40 -e apt list --upgradable;
    elif [ "$choice" = 2 ]; then
    xterm -hold -fa 'Monospace' -fs 12 -geometry 120x44+40+40 -e sudo apt update;
    elif [ "$choice" = 3 ]; then
    xterm -hold -fa 'Monospace' -fs 12 -geometry 120x44+40+40 -e 'sudo apt update && sudo apt full-upgrade';
    else exit
    fi;
    As with all bash scripts, if you run it and it does nothing, run it from a console and check for errors.
    Like if it says, "kdialog: command not found"... you may be on the wrong distro

    [EDIT] It looks like this:

    Click image for larger version

Name:	updcr.png
Views:	1
Size:	16.5 KB
ID:	649615
    Last edited by Don B. Cilly; Apr 28, 2020, 01:00 AM.

    #2
    Well,
    thing is, I tried it with konsole calls, it didn't work - obviously due to bad code - so I used xterm, which did.
    Except, xterm is cr... azily inadequate ;·), so I tried again with konsole, and got it to work.
    The new script is this:
    Code:
    #!/bin/bash
    choice=$(kdialog --title "Updates" --separate-output --checklist "Update options:" 1 "List upgradable packages" off 2  "Update database only" off 3 "Update database and install packages" off 4 "Exit" off);
    
    if [ "$choice" = 1 ]; then
    	konsole --hold -e /bin/bash -c "apt list --upgradable;echo $'\n\e[0;34m'Done";
    elif [ "$choice" = 2 ]; then
    	konsole --hold -e /bin/bash -c "sudo apt update;echo $'\n\e[0;34m'Done";
    elif [ "$choice" = 3 ]; then
    	konsole --hold -e /bin/bash -c "sudo apt update && sudo apt full-upgrade;echo $'\n\e[0;34m'Done";
    	else exit
    	fi;
    Which is also much better in little details.
    I would really appreciate it if someone tried it and confirmed it works on their system, and/or offer criticism/suggestions
    Last edited by Don B. Cilly; Apr 22, 2020, 02:02 AM.

    Comment


      #3
      I tried it and it works. (I have a sudoers file to let me run apt without a password). I don't know about the blue "Done"; my default konsole background is black, and dark blue on black...

      Suggestions...
      1. Use case/esac rather than repeated if testing.
        Code:
        case $choice in
        1) [i]the first thing[/i]      ;;
        2) [i]the second[/i]           ;;
        3) [i]the third [/i]           ;;
        *) [i]catchall  [/i]           ;;
        esac
      2. I'd layout the kdialog options so that they're readable. Shell script quoting rules and line continuation is tricky, but maybe
        Code:
        choice=$(kdialog \
             --title "Updates"  \
             --separate-output  \
             --checklist "Update options:" \
                1 "List upgradable packages"             off \
                2 "Update database only"                 off \
                3 "Update database and install packages" off \
                4 "Exit"                                 off);
      3. I'd factor that messy konsole command into a function:
        Code:
        run_kons () {
        konsole --hold \
               -e /bin/bash -c "$*; echo $'\n\e[0;24m'Done"
        }
      4. I get a default konsole of 24 rows by 80 columns, which wraps the apt list output into a mess. I think a good solution would be to make a konsole profile just for this purpose, and use that; but another way is to set konsole properties:
        Code:
               -p TerminalColumns=160 \
               -p TerminalRows=40     \

      So altogether I suggest
      Code:
      !/bin/bash
      
      run_kons() {
      konsole --hold \
              -p TerminalColumns=160 \
              -p TerminalRows=40     \
              -e /bin/bash -c "$*;echo $'\n\e[0;34m'Done"
      }
      
      choice=$(kdialog --title "Updates"  \
                   --separate-output  \
                   --checklist "Update options:" \
                       1 "List upgradable packages"             off \
                       2 "Update database only"                 off \
                       3 "Update database and install packages" off \
                       4 "Exit"                                 off)
      
      case $choice in 
      1) run_kons "apt list --upgradable"                   ;;
      2) run_kons "sudo apt update"                         ;;
      3) run_kons "sudo apt update && sudo apt full-upgrade";;
      esac
      When the apt list output goes over a page, I get annoyed by it's lack of readability, and the stupid warning if I pipe the list through a paginator (that is, less). I don't have a good solution. Your approach using a new konsole window is good because the konsole itself becomes the paginator, I just have to remember to hold shift when doing a page up. My best effort so far is
      Code:
      $ pipetty apt list --upgradable | sed 1d | sort | tr '/' ' ' | pcol2.py -a "<" | less
      git                     eoan-updates,eoan-security                            1:2.20.1-2ubuntu1.19.10.3 amd64 [upgradable from: 1:2.20.1-2ubuntu1.19.10.2]
      git-doc                 eoan-updates,eoan-updates,eoan-security,eoan-security 1:2.20.1-2ubuntu1.19.10.3 all   [upgradable from: 1:2.20.1-2ubuntu1.19.10.2]
      git-gui                 eoan-updates,eoan-updates,eoan-security,eoan-security 1:2.20.1-2ubuntu1.19.10.3 all   [upgradable from: 1:2.20.1-2ubuntu1.19.10.2]
      gitk                    eoan-updates,eoan-updates,eoan-security,eoan-security 1:2.20.1-2ubuntu1.19.10.3 all   [upgradable from: 1:2.20.1-2ubuntu1.19.10.2]
      git-man                 eoan-updates,eoan-updates,eoan-security,eoan-security 1:2.20.1-2ubuntu1.19.10.3 all   [upgradable from: 1:2.20.1-2ubuntu1.19.10.2]
      google-chrome-stable    stable                                                81.0.4044.122-1           amd64 [upgradable from: 81.0.4044.113-1]
      libjson-glib-1.0-0      eoan-updates                                          1.4.4-2ubuntu0.19.10.1    amd64 [upgradable from: 1.4.4-2]
      libjson-glib-1.0-common eoan-updates,eoan-updates                             1.4.4-2ubuntu0.19.10.1    all   [upgradable from: 1.4.4-2]
      libpython3.7            eoan-updates,eoan-security                            3.7.5-2~19.10ubuntu1      amd64 [upgradable from: 3.7.5-2~19.10]
      libpython3.7-dev        eoan-updates,eoan-security                            3.7.5-2~19.10ubuntu1      amd64 [upgradable from: 3.7.5-2~19.10]
      libpython3.7-minimal    eoan-updates,eoan-security                            3.7.5-2~19.10ubuntu1      amd64 [upgradable from: 3.7.5-2~19.10]
      libpython3.7-stdlib     eoan-updates,eoan-security                            3.7.5-2~19.10ubuntu1      amd64 [upgradable from: 3.7.5-2~19.10]
      python3.7               eoan-updates,eoan-security                            3.7.5-2~19.10ubuntu1      amd64 [upgradable from: 3.7.5-2~19.10]
      python3.7-dev           eoan-updates,eoan-security                            3.7.5-2~19.10ubuntu1      amd64 [upgradable from: 3.7.5-2~19.10]
      python3.7-minimal       eoan-updates,eoan-security                            3.7.5-2~19.10ubuntu1      amd64 [upgradable from: 3.7.5-2~19.10]
      pipetty suppresses the stupid warning, and pcol2.py is an automatic columnizer.
      Regards, John Little

      Comment


        #4
        Very nice
        Well, here, in practice it works pretty much the same - I do have konsole set to the default 80 by 24, but I must have some other setting that "adapts" it... or something.
        Look: on the left, a "normal" konsole window with no set properties - on the right the one opened by your script:

        Click image for larger version

Name:	ks.png
Views:	1
Size:	135.0 KB
ID:	644653

        I reduced it to not be too big (it's pretty much a whole screen), but you get the point.
        About the blue "Done", I quite like it. I put it there because otherwise one (maybe :·) wasn't sure when the command had completed, as it doesn't return to the cursor, it just "holds".
        I find blue quite readable:

        Click image for larger version

Name:	Screenshot_0422_171147.png
Views:	1
Size:	3.3 KB
ID:	644654

        or at least good enough, but it's just a matter of changing the ansi code.

        About when the apt list output goes over a page, well, I hardly ever get "many" pages", so the scroll wheel is good enough for me...

        Anyway, yours is certainly much better written and cleaner code, easier to understand and modify.
        Thanks. Click image for larger version

Name:	_abbraccio.gif
Views:	1
Size:	3.1 KB
ID:	644655

        Comment


          #5
          New and improved :·) version.

          Code:
          #!/bin/bash
          run_kons() {
          konsole --hold \
               -p TerminalColumns=160 \
               -p TerminalRows=40     \
               -e /bin/bash -c "$*;$SHELL"
          }
          choice=$(kdialog --title "Updates"  \
                    --separate-output  \
                    --checklist "Update options:" \
                        1 "List upgradable packages"             off \
                        2 "Update database only"                 off \
                        3 "Update database and install packages" off \
                        4 "Search for packages"                  off \
                        5 "Search for packages - with details"   off \
                        6 "Exit"                                 off)
          case $choice in 
          1) run_kons "apt list --upgradable"                   ;;
          2) run_kons "sudo apt update"                         ;;
          3) run_kons "sudo apt update && sudo apt full-upgrade";;
          4) term=$(kdialog --title "Package search" --inputbox "Package to search for:  (partial names allowed - may return long lists)");konsole --hold -e /bin/bash -c "apt-cache search $term;echo $'\n'Use sudo apt install [package name] to install it.;$SHELL";;
          5) term=$(kdialog --title "Package search" --inputbox "Package to search for:  (wildcards (*) allowed - retutns a lot of info)");konsole --hold -e /bin/bash -c "apt-cache policy $term;echo $'\n'Use sudo apt install [package name] to install it.;$SHELL";;
          esac
          It looks like this:

          Click image for larger version

Name:	updscr.png
Views:	1
Size:	17.7 KB
ID:	644668
          Last edited by Don B. Cilly; May 12, 2020, 11:42 AM. Reason: Now returns shell prompt on all choices

          Comment


            #6
            Dear Mr. Cilly,

            I have to say that I really like the idea of your "Micro Muon" (https://sourceforge.net/projects/micro-muon/) and as I promised you some days ago here are some first, unorganized thoughts about your little script:

            - At first: the name… I think that this script has no direct connection to Muon, so I would prefer another name like "Micro Updater" or even better: "Micro Updater Script". "Micro Muon" is kind of confusing, because I would expect a full implementation of Muon in form of e.g. a Plasmoid
            And name the script accordingly, not "update.sh" but e.g. "micro_updater_script.sh"

            - On sourceforge.net call it what it is (a script) and please tell the people on which versions of which operating systems you have tested it (e.g. Kubuntu 18.04) and that it would at least be wise to have a KDE Plasma installed…

            - Don't forget that there are a lot of people out there who are new to Linux systems or not very interested in learning Linux or especially the command line (and one thing that your script wants to do is to avoid is the terminal for updates, isn't it?).
            Tell them exactly what to do after they have downloaded it! ("I just downloded this little program from the internet, but if I want to start it with a double-click the text editor opens and I see a lot of code I don't understand. F**k Linux, Windows is so much easier, I'm going back!")

            - Desirable future implementations would be:
            1. a micro_updater_script.desktop file with a nice icon for the KDE-Menu that is automatically installed in $HOME (but: ask first, install later…) when the script is started for the first time
            2. a localisation of the options in KDialog - you can additionally do Spanish at least, I could provide you with German, of course.
            Shouldn't be too hard, because there is little text so far (easy to say for me - I don't have to code anything ;-D ).

            - It does not work, if you click on several different options (at least in K20 it doesn't) and any option you clicked on keeps being marked.

            - After the job is done, the KDialog window is gone… No chance for a second try or option.

            - It would be nicer to use Plasma for entering your sudo-password - the terminal window should be for output only.

            - You could get the screen size of the computer the script runs on and place the KDialog window and the terminal output window accordingly.

            Enough criticism for now. ;-)
            I still do have to work this week - the last one, afterwards the company goes bankrupt due to Corona… :-(

            Have fun coding!
            Last edited by Schwarzer Kater; May 25, 2020, 04:31 PM. Reason: typos, as usual
            Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
            Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

            get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
            install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

            Comment


              #7
              Dear Mr. Kater,
              thank you for your feedback.

              Originally posted by Schwarzer Kater View Post
              - At first: the name… I think that this script has no direct connection to Muon, so I would prefer another name like "Micro Updater" or even better: "Micro Updater Script". "Micro Muon" is kind of confusing, because I would expect a full implementation of Muon in form of e.g. a Plasmoid
              And name the script accordingly, not "update.sh" but e.g. "micro_updater_script.sh"
              I'll think about it. It's obviously a "tongue in cheek" name... thing is, it does most (well most of the important stuff) of what muon does, it's not even called "mini"...

              - On sourceforge.net call it what it is (a script) and please tell the people on which versions of which operating systems you have tested it (e.g. Kubuntu 18.04) and that it would at least be wise to have a KDE Plasma installed…
              OK, I called it a script. I haven't tested it on many, but it really should work on all distros that use apt as a package manager.
              It doesn't need KDE. Just KDialog and Konsole. I have it working on Ubuntu (gnome) just fine.
              I just had to install kdialog and konsole.
              But that I do anyway, along with Dolphin and Kate, first off, or Ubuntu isn't really even vaguely usable ;·)
              OK, I'll add that it uses konsole. :·)

              - Don't forget that there are a lot of people out there who are new to Linux systems or not very interested in learning Linux or especially the command line (and one thing that your script wants to do is to avoid is the terminal for updates, isn't it?).
              Well, you'll notice the first sentence of this thread: "For those who like the CLI but don't really like the CLI," :·)
              So... this isn't really for total noobs. They can use Discover just fine.
              It's for "intermediate" users like me. Real power users type "sudo apt update && sudo apt full-upgrade" with one hand while coding on the phone with the other. ;·)

              See, the idea came from this thread, where I explain how to make an alias to run "sudo apt update && sudo apt full-upgrade" without typing it every time.
              In another thread about it, someone said, "Yeah, but then I can't remember my aliases" Which was (I guess) a joke, but...
              So, it's not about "avoiding the terminal for updates", it's about using the terminal but not having to remember and type the actual commands.

              Tell them exactly what to do after they have downloaded it!
              It says so in the first post of the "Wiki". "It's really very simple. Just make the script executable and run it." Also, see above.
              And there's only one thing that can be downloaded, it's called "update.sh", it's obviously a shell script, there aren't really many things one can do with it.

              - Desirable future implementations would be:
              1. a micro_updater_script.desktop file with a nice icon for the KDE-Menu that is automatically installed in $HOME (but: ask first, install later…) when the script is started for the first time
              2. a localisation of the options in KDialog - you can additionally do Spanish at least, I could provide you with German, of course.
              Yeah, well :·) Just for fun, look at the download stats.
              60% are from France, and 53% are "Unknown" OSs. For a grand total of 15 :·)
              (Thing is, most downloads seem to be from France for anything on Sourceforge - they probably have sourceforge-bots or something)... :·/

              - It does not work, if you click on several different options (at least in K20 it doesn't) and any option you clicked on keeps being marked.
              No, but that really seems to be a limitation of KDialog.
              Not only that, but if you make one option "marked" by default (by changing "off" to "on" in it), what it does is, it crashes. :·)

              - After the job is done, the KDialog window is gone… No chance for a second try or option.
              Same as above. I have looked for an option to keep it open, I can't find it.

              - It would be nicer to use Plasma for entering your sudo-password - the terminal window should be for output only.
              Now, that is easily done. I don't quite see the advantage though. One could do it two ways:
              1) Bring up a little polkit window that asks for the pw and then opens konsole. But that would open a root terminal...
              2) open a normal konsole window and then have that pop up a password dialog.
              And in both case you open two windows instead of one...

              - You could get the screen size of the computer the script runs on and place the KDialog window and the terminal output window accordingly.
              Yeah well... it's just a little script...
              Last edited by Don B. Cilly; May 26, 2020, 12:18 AM.

              Comment


                #8
                I've made one that opens the kdialog window again after you close the konsole one.
                It also resizes the window properly.

                Please test it and see
                a) if it works there.
                b) how you like it.

                Code:
                #!/bin/bash
                BASEDIR=$(readlink -f $0 | xargs dirname)
                run_kons() {
                konsole --hold \
                       --geometry 1200x900+80+40 \
                       -e /bin/bash -c "$*;$SHELL"
                }
                choice=$(kdialog --title "Updates"  \
                            --separate-output  \
                            --checklist "Update options:" \
                                1 "List upgradable packages"             off \
                                2 "Update database only"                 off \
                                3 "Update database and install packages" off \
                                4 "Search for packages"                  off \
                                5 "Search for packages - with details"   off \
                                6 "Exit"                                 off)
                case $choice in 
                1) run_kons "apt list --upgradable -v" ; $BASEDIR/update.sh         ;;
                2) run_kons "sudo apt update" ; $BASEDIR/update.sh                         ;;
                3) run_kons "sudo apt update && sudo apt full-upgrade" ; $BASEDIR/update.sh ;;
                4) term=$(kdialog --title "Package search" --inputbox "Package to search for:  (partial names allowed - may return long lists)");run_kons "apt search $term;echo $'\n'Use sudo apt install [package name] to install it.;$SHELL" ; $BASEDIR/update.sh  ;;
                5) term=$(kdialog --title "Package search" --inputbox "Package to search for:  (wildcards (*) allowed - retutns a lot of info)");run_kons "apt-cache policy $term;echo $'\n'Use sudo apt install [package name] to install it.;$SHELL" ; $BASEDIR/update.sh  ;;
                esac
                Last edited by Don B. Cilly; May 27, 2020, 12:50 AM.

                Comment


                  #9
                  Dear Mr. Cilly,

                  Originally posted by Don B. Cilly View Post
                  […]
                  Yeah, well :·) Just for fun, look at the download stats.
                  60% are from France, and 53% are "Unknown" OSs. For a grand total of 15 :·)
                  (Thing is, most downloads seem to be from France for anything on Sourceforge - they probably have sourceforge-bots or something)... :·/
                  […]
                  This is a hidden outcry for a French localisation!
                  And don't give up your efforts! There will be thousands and thousands of downloads, when the little thing is published in major on- and offline Linux magazines and mentioned on CNN and BBC News! ;-)

                  Originally posted by Don B. Cilly View Post
                  […]
                  No, but that really seems to be a limitation of KDialog.
                  Not only that, but if you make one option "marked" by default (by changing "off" to "on" in it), what it does is, it crashes. :·)
                  […]
                  Hm… We will have to force the developers to fix this, somehow!

                  Originally posted by Don B. Cilly View Post
                  […]Now, that is easily done. I don't quite see the advantage though. One could do it two ways:
                  1) Bring up a little polkit window that asks for the pw and then opens konsole. But that would open a root terminal...
                  2) open a normal konsole window and then have that pop up a password dialog.
                  And in both case you open two windows instead of one...
                  […]
                  The first option is out of the question but I would prefer the second one as I consider it as a cleaner, more consistent UI, because the whole user-input communication is done by the GUI.
                  If you wanted to have one window only, you could get rid of KDialog entirely and do user communication within Konsole as zypper does in openSUSE (like: "enter 'a' for option 'a'").

                  So, I have just tested your new version briefly with Kubuntu 20.04:

                  z) KDialog is opened for the second time, when you close the Konsole window - it isn't opened the third time after choosing a third option, though.

                  y) Konsole window sizes are different the first and second time (my monitor is set to 1280 x 1024).

                  x) Shouldn't - for the sake of consistency - kdialog --title "Updates" be kdialog --title "Micro Muon" and update.sh be micro_muon.sh?

                  w) In general: isn't one supposed to use apt-cache and apt-get in scripts?

                  v) I would like to see a "Detailed informations about a package" in the options (apt-get show), and as I am at it: how about depends and rdepends? :-D

                  Have fun!

                  Yours sincerely,
                  Mr. Kater

                  PS: There is a typo in 5) - should be "returns" instead of "retutns".
                  Last edited by Schwarzer Kater; May 27, 2020, 05:21 AM. Reason: typos, as usual and PS
                  Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
                  Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

                  get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
                  install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

                  Comment


                    #10
                    About all the rest, it's just a simple script, I called it Micro-Muon as a bit of a joke, a poke, a provoke... just a little dab at unnecessarily bloated apps for simple tasks.
                    Just my cilly sense of cilliness ;·)
                    About the detalis - I appreciate the advice:

                    Originally posted by Schwarzer Kater View Post
                    I would prefer the second one as I consider it as a cleaner, more consistent UI, because the whole user-input communication is done by the GUI.
                    I don't know... try it yourself. Change line 18 from
                    1) run_kons "apt list --upgradable -v" ; $BASEDIR/update.sh
                    to
                    1) run_kons "pkexec apt list --upgradable -v" ; $BASEDIR/update.sh
                    (you don't need pkexec/sudo for that, but for testing... the ones that do are a bit... heavy.

                    It seems to me that opening another window is sort of... a waste of windows... but try it and see what you think.

                    If you wanted to have one window only, you could get rid of KDialog entirely and do user communication within Konsole as zypper does in openSUSE (like: "enter 'a' for option 'a'").
                    I really think it "strikes a good balance" as it is...

                    So, I have just tested your new version briefly with Kubuntu 20.04:

                    z) KDialog is opened for the second time, when you close the Konsole window - it isn't opened the third time after choosing a third option, though.
                    Well, that is a weird one. It doesn't do it on neon. I tried it in K20.04. It doesn't do it either. It keeps re-opening Kdialog forever.
                    Also, if you look at the "code"... it's so simple... there's no reason why it would do that, is there?
                    The command to re-open kdialog is $BASEDIR/update.sh (where $BASEDIR is the directory the script is in).
                    It's the same for all of them... anyway, I can't reproduce it, so...

                    y) Konsole window sizes are different the first and second time (my monitor is set to 1280 x 1024).

                    I don't know... there's only one place where I define the size of the window. And it also defines the position of it.
                    Now, I have 1920x1080... can you try and see what max resolution/position would avoid that there?
                    Maybe starting with --geometry 1200x900+0+0 which would put the window in the top left corner...

                    w) In general: isn't one supposed to use apt-cache and apt-get in scripts?
                    v) I would like to see a "Detailed informations about a package" in the options (apt-get show), and as I am at it: how about depends and rdepends? :-D
                    Any examples of what you would like? And why not try them yourself? It's a really simple script...

                    PS: There is a typo in 5) - should be "returns" instead of "retutns".
                    Click image for larger version

Name:	icon_smile_blush.gif
Views:	8
Size:	845 Bytes
ID:	644774

                    Comment


                      #11
                      Originally posted by Don B. Cilly View Post
                      […]
                      I don't know... try it yourself. Change line 18 from
                      […]
                      It seems to me that opening another window is sort of... a waste of windows... but try it and see what you think.

                      I really think it "strikes a good balance" as it is...
                      I am undecided now. :-)

                      Originally posted by Don B. Cilly View Post
                      […]
                      It keeps re-opening Kdialog forever.
                      Also, if you look at the "code"... it's so simple... there's no reason why it would do that, is there?
                      No, there isn't. Unless somebody changes the name of the file and doesn't take a look at the code at all… :-O

                      Originally posted by Don B. Cilly View Post
                      I don't know... there's only one place where I define the size of the window. And it also defines the position of it.
                      Now, I have 1920x1080... can you try and see what max resolution/position would avoid that there?
                      Maybe starting with --geometry 1200x900+0+0 which would put the window in the top left corner...
                      It is gone now - I think it had to do with me renaming the file. Still don't know why it opened even a second time then, but who cares.

                      Originally posted by Don B. Cilly View Post
                      Any examples of what you would like? And why not try them yourself? It's a really simple script...
                      I should have formulated it better: instead of "I would like to see a …" it should have said "You could think about a …".
                      I don't have any intention of coding anything, simple or not - this is your project, and I just want to feed you with some of my bad and good ideas only. Not for me, but for other people who will use your script (I like your idea, but I do use aliases in terminal anyhow for quite a long time).
                      And as I told you in confidence ;-) I quite hate coding - bad enough I seldom have to do it for work from time to time…

                      Have a nice evening!
                      Last edited by Schwarzer Kater; May 27, 2020, 01:55 PM.
                      Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
                      Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

                      get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
                      install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

                      Comment


                        #12
                        Well, I'm no good at coding at all.
                        Proof being, I just realised that I didn't need the $BASEDIR thing at all.
                        Turns out that $0 returns the absolute path to the script anyway :·/

                        I tried renaming it and moving it to a different place. It works just fine.
                        And it reduces it to 22 "lines of code" from 23 :·)
                        So you can rename it and move it around all you like...

                        Still, about the "other features". Which ones would you like, then?

                        [EDIT] See, I really appreciated the suggestion to restart the kdialog window.
                        Me, I have a "button" for it in the dock:
                        Click image for larger version

Name:	Screenshot_0527_225010.png
Views:	1
Size:	21.7 KB
ID:	644775
                        so it's a one-click-thing. But of course, most people won't have that.

                        And the hint about renaming the script was useful :·)
                        Last edited by Don B. Cilly; May 27, 2020, 02:55 PM.

                        Comment


                          #13
                          See how you like it.
                          I added "apt show" - which lists dependencies, so... maybe rdepends is a bit overkill. Also, it has to be installed separately.

                          Code:
                          #!/bin/bash
                          run_kons() {
                          konsole --hold \
                               --geometry 1200x900+0+0 \
                               -e /bin/bash -c "$*;$SHELL"
                          }
                          choice=$(kdialog --title "Updates" --geometry 360x300+300+300  \
                                    --separate-output  \
                                    --checklist "Update options:" \
                                        1 "List upgradable packages"             off \
                                        2 "Update database only"                 off \
                                        3 "Update database and install packages" off \
                                        4 "Search for packages"                  off \
                                        5 "Search for packages - with details"   off \
                                        6 "Search for packages - with dependecies and all"   off \
                                        7 "Do something silly :·)"               off \
                                        8 Exit                                  off)
                          case $choice in 
                          1) run_kons "apt list --upgradable -v" ; $0          ;;
                          2) run_kons "sudo apt update" ; $0                          ;;
                          3) run_kons "sudo apt update && sudo apt full-upgrade" ; $0 ;;
                          4) term=$(kdialog --title "Package search" --inputbox "Package to search for:  (partial names allowed - may return long lists)");run_kons "apt search $term;echo Use sudo apt install [package name] to install it." ; $0  ;;
                          5) term=$(kdialog --title "Package search" --inputbox "Package to search for:  (wildcards (*) allowed - returns a lot of info)");run_kons "apt-cache policy $term" ; $0  ;;
                          6) term=$(kdialog --title "Package search" --inputbox "Package to search for:  [wildcards (*) allowed (*not* advised)] - returns quite a lot of info)");run_kons "apt show  $term" ; $0  ;;
                          7) run_kons "apt moo" ; $0 ;;
                          8) exit
                          esac
                          Last edited by Don B. Cilly; May 30, 2020, 03:52 AM.

                          Comment


                            #14
                            Anyway, I "published" it in this version (without the apt moo :·)
                            Thanks for the feedback.

                            I also made a zenity/yad one for GTK buffs.

                            [EDIT] I re-published it - with the apt moo :·)
                            Last edited by Don B. Cilly; May 30, 2020, 03:58 AM.

                            Comment


                              #15
                              Just downloaded it. Works here, also after renaming it. Thanks.
                              Of course window size of KDialog only is correct if you use standard fonts/font sizes.
                              Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
                              Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

                              get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
                              install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

                              Comment

                              Working...
                              X