Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-22-2024, 02:57 PM
|
#1
|
Senior Member
Registered: Sep 2006
Posts: 1,512
Rep:
|
softi: Automatically Update On a Predefined Schedule
OK. I essentially wrote a package manager, which is going to get the abillity to add it to more systems. However, right now, it works on Linux Mint.
The problem now, is that the update manager that comes with linux mint, is incompatible. It's not general enough to be compatible. I decided NOT to fork it at this time.
So that leaves me with needing to automatically update on my own, while I don't need to uninstall my update manager, just in case I need it, I need to automatically install updates, on a schedule. This will save me some time, anyway.
So how do I do that? Well, the command to install updates, is simple:
That's it! It will update system packages, flatpaks, snaps, homebrew packages, and cinnamon spices, with some conditions on each.
This could take a bit of time, and I don't want the user doing anything while I update. I want to make sure the user is also logged on, if possible, before I even run the update. I want it to be able to run no matter which user is logged on. anacron handles the when to do it, now I just need code to check for the logon, and not do anything unless a user is logged on, then display the output in either the terminal they are logged on with, or the gui terminal emulator. I only need to do this with the first user that logs on. Please help me figure this out, but I will try to do research also, and see if I find a solution to the problem. Thanks! If I can block all input while the update is going on, even better!
|
|
|
05-22-2024, 05:29 PM
|
#2
|
Member
Registered: Jan 2022
Location: UK
Distribution: Mabox - Manjaro/Arch
Posts: 60
Rep:
|
Insisting on updates and not allowing a user to decide to defer, or even control what is installed, or input anything whilst you force install updates.... you need a Windows PC.... Linux is about choice, and that includes what/when to update and install!
|
|
|
05-22-2024, 11:32 PM
|
#3
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,924
|
Just run your program from crontab at 03:00
|
|
|
05-23-2024, 12:33 AM
|
#4
|
Senior Member
Registered: Sep 2006
Posts: 1,512
Original Poster
Rep:
|
Theres nothing inherently wrong with the updater provided, except it wont use my new package manager. It provides no options to choose my package manager instead of the default one. But Im trying to avoid forking it, because then i have to maintain theyre changes and merge them with mine, but with my differences. I dont want to disable theirs because i need it to go to new versions entirely. Right now, im tring to automate what i want to do anyway, and offer my solutions in case others want it. But im not trying to hard code solutions in even my own stuff. I can change the frequency with a few commands by design.
|
|
|
05-23-2024, 12:51 AM
|
#5
|
Senior Member
Registered: Sep 2006
Posts: 1,512
Original Poster
Rep:
|
I need to take into account that the systems may be off. So i need anacron. Its preinstalled, i guess. But the problem im having is the package manager makes changes that may be major to the system. So i need a sign visibly that its running like a terminal window. Then, i need it to be able to either block all input, keyboard, mice, all of that, while it updates, so the user wont do something stupid like open libreoffice writer while its updating thus failing it or giving an incomplete install or the like. Then, since it can run while not logged on, its best if it waits for logon from any account, then first account it runs in, can use machine account to gain root privileges and run under. Its ok if it requires password or a key press to do work. In the future i might have my own format too, but ill worry about that then. My package manager is a very smart front end. But updating without it doesnt allow functions later like undo.
|
|
|
05-23-2024, 02:38 AM
|
#6
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,924
|
Off: an advice: make sure to never install this program on work/school computers, only on your own computer.
|
|
|
05-23-2024, 06:00 AM
|
#7
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,702
|
Wow, you wrote a package manager which is incompatible with the existing one. It just means trouble. It looks like you still need to solve a lot of issues to really make it work, like: disable user activities, manage conflicts with other package managers, handle network related issues, version conflicts and incompatibilities (amongst packages) and who knows what. Not to speak about error handling, undo/revert functionality in case of a failed upgrade.
And actually I think most of these issues are already solved by the built-in package manager.
|
|
|
05-23-2024, 08:51 AM
|
#8
|
Moderator
Registered: Aug 2002
Posts: 26,127
|
I agree that your package manager will interfere with Mint's update notification tool etc which will have to be disabled.
It is possible to send a desktop notification that you can select to update which reboots the OS, runs the update and then restarts the OS. That is how debian updates works.
|
|
|
05-23-2024, 11:35 AM
|
#9
|
Senior Member
Registered: Sep 2006
Posts: 1,512
Original Poster
Rep:
|
Maybe ill just poke around at code written, if gpl, as thats the license i want for my package manager. Maybe i can get ideas for my updates from there without a total rewrite.
Yes, some issues were solved, but i needed to solve the problem of portable code from command line when i switch distros. Still working on feature completeness for that goal. Its not incompatible with the pm there. It calls it for its start. Its only incompatible with update manager, but only sort of. The main reason i wrote it so far, is portability concerns with scripts. It could easily use the whole update manager if it just could not care about which pm it uses. Maybe i will just fork it if it needs to be simple.
|
|
|
05-24-2024, 07:41 PM
|
#10
|
Senior Member
Registered: Sep 2006
Posts: 1,512
Original Poster
Rep:
|
So what's debian's updater called, so I can look it up? I know what mint's updater is called. I would like to see if I can understand the source code of debian's updater. It's difficult to understand the source for mint's updater right now. Perhaps, if they are both gpl, I can find a solution from reading those codebases. I found that yes, mint's updater is gpl. It's gpl 3.0, which is great for me! It's sounding as if debians, if I could find it, is simpler and their algorithm should work, perhaps, but just not their commands at the command line.
|
|
|
05-25-2024, 12:29 AM
|
#11
|
Member
Registered: Sep 2010
Location: Washington state, USA
Distribution: Ubuntu among others
Posts: 75
Rep:
|
Last edited by memilanuk; 05-25-2024 at 12:38 AM.
|
|
|
05-26-2024, 11:58 PM
|
#12
|
Senior Member
Registered: Sep 2006
Posts: 1,512
Original Poster
Rep:
|
OK. After poking around with code, and also many failed tries, I was able to create my own updater that is always on. Here is the code for it:
Code:
#! /bin/sh
while :;
do
if [ -f /etc/settings/flags/linux_mint-update.flg ]; then
reply.sh
if [ $? -eq 0 ]; then
#notify-send Updates "Updating System. DO NOT use your computer."
sudo softi upgrade
#notify-send Updates "Done with updates. You may use your computer."
fi
fi
sudo rm -f /etc/settings/flags/linux_mint-update.flg
clear
sleep 5
done
Code:
[Desktop Entry]
Type=Application
Name=linux_mint-update
Comment=Runs OS Updates
Exec=gnome-terminal --window -- sudo -u smileynet sudo linux_mint-update.sh &
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Terminal=false
Name[en_US]=linux_mint-update.desktop
Code:
#! /bin/bash
echo "Do you wish to continue?"
select yn in "Yes" "No"; do
case $yn in
"Yes" ) exit 0; break;;
"No" ) exit 1; break;;
esac
done
|
|
|
All times are GMT -5. The time now is 04:04 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|