Hello all,
This time not a real problem, but a question about how to do something.
I am trying to create an automated installation of Kinoite including:
adding RPM-Fusion repo’s,
Nvidia drivers installation and blocking nouveau and nova,
adding flathub repo and installing several flatpacks from flathub.
I have 6 scripts, each ending in a reboot. After the boot the following script is run. (through the correct desktop file in the autostart folder)
A lot of it is working except for 1 major thing:
In my scripts I want to automatically open the Konsole terminal and let the following commands in the script be executed in that terminal.
I found this: konsole -e ls (ls as simple example command which does no damage)
This should start Konsole, which it does, but I don’t see the execution of the ls command. So I guess this is not happening in Konsole but in free air.
Do I need to transfer my commands from the script into the terminal somehow?
At the moment I am manually trying the ls command above in a terminal and I do see another terminal window flashing after which the original terminal remains with the prompt.
Ten times the same konsole -e ls
command in the script flashes 10 terminals, one after the other without any visible output from the ls command.
How do I do this, how do I get Konsole to open en all my further commands be executed inside Konsole?
It’s all I could come up with. Is there any other way of doing something like this?
One more thing, I saw the listing output is different from what I normally have. I use an alias ls=‘ls -lh --color’ to get long listing all the time.
Now this alias is not used, am I using a different bash now, or is my .bashrc file not used?
I can try that as well, thank you again.
Did you read the last lines in my previous post, I added them later so you might have missed them. I wonder why the output of the ls command is different from what I normally have: long listing instead of getting non long listing output.
No, unfortunate it is still the same.
What is the reason you added bash -c to the line? I read the man page but don’t get it what the -c option does, plus I don’t know why bash itself has to be in there.
bash weirdness again ~/.bashrc is read only when bash is interactive
Try thus: konsole -e bash -i -c ...
Only to allow executing compound commands: ie: ls followed by waiting.
konsole does not uses the shell to execute the command after -e
(and this is good IMO: safer, easier for managing arguments with spaces)
This is getting much more difficult than I hoped for. But it works and if I need the ls command then I can always type ls -l.
I was just reading this page: bash -c but that made it also more complicated. I’m not very familiar with building scripts and hoping to learn from this exercise.
I will search more and in the mean time change my scripts so that I get what I want.
Thank you very much for your time and help, much appreciated.
Hi Peter, yes I know about cron jobs, I have used them several times in the past but I wanted to try something new. That part of it all works, I just needed help with opening Konsole from a script and have commands executed in Konsole.
Aren’t there more suitable tools for provisioning?
I don’t really use atomic, but provisioning a new Fedora VM from scratch up to user session defaults is entirely possible with just one Kickstart config and no extra reboots, so I expect atomic to provide a comparable level of efficiency.
The normal way would be to create a systemd oneshot service which will run at boot time. Or you can create /etc/rc.d/rc.local as a shell script and make it executable. This shell script can then call your scripts.
I like to point people towards Ansible for something like this instead of custom shell scripts. It has a learning curve, I won’t sugarcoat that, but it can do an enormous amount of things, without having to reinvent the wheel (examining a system, calling commands, handling errors, etc.).
For example, in my playbooks, I have tasks to add the RPM Fusion repos:
Before running these tasks, I load the appropriate distro_packages variable (which contains two lists of packages, absent and present), depending on the distro the target is running. This accounts for different package names and selections for different distros.
Hello Lars, I will certainly dive into that, but for now I think, no I know for sure, I will stick to my original idea creating a desktop file for every script and copy/remove them to/from the autostart folder in ~/.config/autostart, just before the necessary reboot.
One because ansible is completely unknown to me and two you wrote
meaning I have to study some more, which will take extra time.
Thank you for pointing out this possibility.
@pedgerow, @vgaetera and @vekruse thank you for your ideas, I will look into those for what could become a version 2 of this exercise, but for now I stick to my original idea. Yes, I know I am stubborn. @francismontagnac thank you again for helping me with the konsole problem.
That’s it for now, when I should require more help I will open a new thread especially about that issue.
Thanks all.