How to create KDE desktop shortcut for multiple sudo commands?

So I want to semi automate my upgrade process via a single KDE desktop shortcut.
What I need is a desktop shortcut that when opened does this:
sudo zypper refresh
then, sequentially sudo zypper dup
and also sequentially sudo flatpak update
All running in a terminal.

How can I do this? I tried setting it up with GUI as program = sudo, then arguments = zypper refresh && sudo zypper dup && sudo flatpak update

which automatically becomes program = sudo, then arguments = zypper refresh ‘&&’ sudo zypper dup ‘&&’ sudo flatpak update

But this doesn’t work, it terminates abruptly.

Currently, I run an icon for each one.

How can I achieve this?

There are countless methods. One is:
Create a shell script and add an application starter with pkexec <your_shell_script_name>

1 Like

Ok, nevermind, I figured out a way to solve it by creating a bash script with those three commands as contents, then the desktop shortcut has program = sh, arguments = ~/locationtoscript

Try using alias

konsole -e "bash <PATH_TO_SCRIPT>"

Let me INSIST on stating this is NOT SAFE. There are tools, like salt-stack, cockpit that can do this for you. These have levels of health-checking that ^^ does not provide.

Cockpit looks like it has a nice GUI for doing updates. Will it ask me to pick a solution whenever packman and openSUSE packages have a conflict or will it solve it automatically? Also, a whole server config stack for connecting and managing localhost? Its a desktop I own, not a server.

Saltstack may do the trick. But it turns out all I needed was to concatenate a series of update commands and a series of cleanup commands. I dont need many command stacks. Maybe Id use it to configure a system to be like mine finally is, if I ever have to reinstall. I hope not.

Btw I have an issue with KDE. If I press the physical poweroff button my PC shuts down. But if I use KDE Menu’s restart or turn off buttons, all they do is end the session, close stuff and the PC gets stuck at a black screen. It wont complete turn off/restart process unless I press the power button once. If I do sudo reboot on konsole it works alright.

I believe something is impeding whatever commands those KDE buttons send, to complete shutdown. I suspect it might be an issue with root processes, like services or something. How can I diagnose what’s preventing shutdown? Only root service I remember enabling was mpd, though I enabled it for user later on.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.