LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 05-22-2024, 02:57 PM   #1
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441
Blog Entries: 43

Rep: Reputation: 36
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:

Code:
sudo softi upgrade
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!
 
Old 05-22-2024, 05:29 PM   #2
Fearless Fred
Member
 
Registered: Jan 2022
Location: UK
Distribution: Mabox - Manjaro/Arch
Posts: 60

Rep: Reputation: 37
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!
 
Old 05-22-2024, 11:32 PM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,887
Blog Entries: 1

Rep: Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873
Just run your program from crontab at 03:00
 
Old 05-23-2024, 12:33 AM   #4
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441

Original Poster
Blog Entries: 43

Rep: Reputation: 36
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.
 
Old 05-23-2024, 12:51 AM   #5
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441

Original Poster
Blog Entries: 43

Rep: Reputation: 36
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.
 
Old 05-23-2024, 02:38 AM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,887
Blog Entries: 1

Rep: Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873
Off: an advice: make sure to never install this program on work/school computers, only on your own computer.
 
Old 05-23-2024, 06:00 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,123

Rep: Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373
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.
 
Old 05-23-2024, 08:51 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,827

Rep: Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964
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.
 
Old 05-23-2024, 11:35 AM   #9
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441

Original Poster
Blog Entries: 43

Rep: Reputation: 36
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.
 
Old 05-24-2024, 07:41 PM   #10
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441

Original Poster
Blog Entries: 43

Rep: Reputation: 36
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.
 
Old 05-25-2024, 12:29 AM   #11
memilanuk
Member
 
Registered: Sep 2010
Location: Washington state, USA
Distribution: Ubuntu among others
Posts: 75

Rep: Reputation: 4
https://wiki.debian.org/Synaptic

Upstream:
https://www.nongnu.org/synaptic/

Last edited by memilanuk; 05-25-2024 at 12:38 AM.
 
Old 05-26-2024, 11:58 PM   #12
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441

Original Poster
Blog Entries: 43

Rep: Reputation: 36
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] softi: Software Installer - Help finishing des_a Programming 2 07-07-2017 01:07 PM
LXer: Tentative Schedule Meets Tentative Schedule For ATO LXer Syndicated Linux News 0 08-11-2014 04:10 PM
LXer: Schedule Tasks Using Gnome-schedule (cron & at GUI) LXer Syndicated Linux News 0 07-28-2007 12:31 AM
How to start debian install cd with a predefined swap partition? stormrider_may Debian 5 03-07-2006 05:10 PM
Emacs copy predefined text jrdioko Linux - Software 2 09-11-2005 03:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration