You are not logged in.
Pages: 1
Just wrote a simple python script to help keep packages up to date automatically. I use it in a cron every 12 hours and it will install automatically for you or prompt you to update. I am lazy and would always forget to run updates so this script takes the guess work out of it. The script is still in beta but I am fairly confident I worked out the bugs. It uses Python 2 and a few dependencies listed on the code itself. Check it out and give any feedback. Thanks!
https://github.com/blankwall/Arch.git
Last edited by blankwall (2013-07-02 19:58:50)
Offline
I don't speak python, but doesn't this update all packages, not only pacman?
If so, you can simply run 'checkupdates' once in a while:
$ checkupdates
libdrm
libtheora
libvdpau
Offline
Ya I wrote it more for automatic updating and threw in an update checker for fun. I put this in a cron and allow it to do automatic updates every 12 hours or so. Updated original description to reflect this.
Last edited by blankwall (2013-07-02 19:59:59)
Offline
Automatically updating the system without user intervention will likely lead to a broken system. Read the front-page news to see why.
I'm not familiar with pexpect so I have a question about this section of the update function:
if i == 0:
child.sendline('sudo rm /var/lib/pacman/db.lck')
child.expect(pexpect.EOF, timeout = None)
update()
Is that just automatically removing the lock file and trying again? If so, that can lead to corruption of the local file database.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Havnt read you're code, but automatic updates with arch is a bad idea
bitcoin: 1G62YGRFkMDwhGr5T5YGovfsxLx44eZo7U
Offline
I don't understand python but am I right in thinking that if you run it with cron, it will essentially do pacman -Syu without even showing you the output? So you will have no idea when pacman's output indicates intervention is required?
If so, this is a Very Bad Idea.
Or have I just misunderstood...?
EDIT: Beaten to it twice...
Last edited by cfr (2013-07-02 20:25:04)
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
If intervention is necessary the file will stop. It only cotinues through routine auto updates. Didnt realize this was such a no no. And for the section that remove the db.lck yes it is only there so if the database is read twice by pexpect it will remove the lock. Guess this is not very useful. Sorry for posting.
I guess it could still be used as an automatic update checker to let you know update is necessary. Also there is a line to uncomment to be shown output of Pacman if that makes it any better.
Last edited by blankwall (2013-07-02 20:37:03)
Offline
If intervention is necessary the file will stop. It only cotinues through routine auto updates. Didnt realize this was such a no no. And for the section that remove the db.lck yes it is only there so if the database is read twice by pexpect it will remove the lock. Guess this is not very useful. Sorry for posting.
You learn. One should always watch the output of pacman to see changes and to know when to merge pac files etc.
Have a look here, and at the linked thread.
https://bbs.archlinux.org/viewtopic.php?id=164777
Last edited by jrussell (2013-07-02 20:38:18)
bitcoin: 1G62YGRFkMDwhGr5T5YGovfsxLx44eZo7U
Offline
Ok cool guys thanks for offering some assistance. Maybe I will reedit the code so it will just download and cache the updates until someone runs pacman -Syu to make it easier. I will figure something out. Thanks for the advice.
Last edited by blankwall (2013-07-02 20:44:00)
Offline
If intervention is necessary the file will stop. It only cotinues through routine auto updates. Didnt realize this was such a no no.
Pacman will not always prompt for intervention. Please read the front-page news for examples of updates that require user intervention. The recent move of all executables to /usr is a good example. The update process required user intervention before running pacman followed by a specific sequence of package upgrades instead of the normal "-Syu".
Hmmm, now that I think about it, the operation would have failed in that case due to file conflicts so I suppose it isn't directly relevant, but that might not be so in the future. Regardless, output messages in pacman install scripts may also instruct the user to make manual changes without any interactive prompts. If that happens for a bootloader or other critical package and the user ignores it, bad things happen.
And for the section that remove the db.lck yes it is only there so if the database is read twice by pexpect it will remove the lock.
Would it remove a lock file from another pacman process?
Guess this is not very useful. Sorry for posting.
Sorry, I'm not trying to discourage you. I just want to make you (and others who might use this) aware of the risks of automatic updates.
edit
If you just want to download databases and display information, take a look at pyalpm and python3-aur. You might also find paconky interesting. It's a hackjob but it works. I
Last edited by Xyne (2013-07-02 20:52:21)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Cool thanks for the advice. No discouragement just felt like this would be useful but not quite there. I have plans to write some other tools to help everyday Arch life so hopefully they can be more well received. Thanks a bunch.
Tyler
Offline
Pages: 1