You are not logged in.

#1 2015-01-05 17:58:29

ewancoder
Member
Registered: 2014-05-13
Posts: 19

Upgrading packages automatically with yaourt

After 'asroot' option was removed from makepkg it's impossible to make a shortcut "sudo yaourt -Syua --noconfirm" anymore (it was assigned to some key on my keyboard and this exact command was in my sudoers file as NOPASSWD).

So now I'm thinking of writing such script:

1. yaourt builds all new packages (yaourt -Syua --export /tmp/$random) into random dir in RAM-disk

2. pacman -U /tmp/$random/* executes which will be in sudoers NOPASSWD section.

So is anyone has a better solution for this purpose? And what do you guys use for updating packages anyway? (it's surely not an option to enter password each single time).

Last edited by ewancoder (2015-01-05 18:40:07)

Offline

#2 2015-01-05 18:14:50

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,523

Re: Upgrading packages automatically with yaourt

This is my alias

alias yu='sudo pacman -Sy $(pacman -Qq | grep headers) --needed && yaourt -Sua'

I don't get the problem you mentioned.
I put my user in the sudo group, so I've administration permission, without password.


do it good first, it will be faster than do it twice the saint wink

Offline

#3 2015-01-05 18:23:05

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,771
Website

Re: Upgrading packages automatically with yaourt

@TheSaint -- running `pacman -Sy <package` without a full system upgrade can break your system.

ArchWiki wrote:

partial upgrades are not supported. Do not use pacman -Sy package

https://wiki.archlinux.org/index.php/Pa … nsupported

Offline

#4 2015-01-05 18:36:31

ewancoder
Member
Registered: 2014-05-13
Posts: 19

Re: Upgrading packages automatically with yaourt

Well, this is what I've come up with:

    dir=`mktemp -d`
    yaourt -Syua --export $dir --noconfirm
    sudo pacman -U $dir/*.tar.xz
    rm -r $dir

But there's a catch: yaourt doesn't exist because it awaits for password to INSTALL packages. So how to tell yaourt to just build packages and exit?

Last edited by ewancoder (2015-01-05 18:39:20)

Offline

#5 2015-01-05 18:54:32

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Upgrading packages automatically with yaourt

Post your /etc/sudoers.
You shouldn't install packages w/o checking the PKGBUILDs first.

Offline

#6 2015-01-05 19:59:51

ewancoder
Member
Registered: 2014-05-13
Posts: 19

Re: Upgrading packages automatically with yaourt

karol wrote:

Post your /etc/sudoers.
You shouldn't install packages w/o checking the PKGBUILDs first.

Currently my sudoers file is just normal. Recently I used this:

    ewancoder ALL=(ALL) NOPASSWD: /usr/bin/yaourt -Syua --noconfirm

Now, after finishing my current script for updating system, I am planning on using something like this:

    ewancoder ALL=(ALL) NOPASSWD: /usr/bin/pacman -U /tmp/...

Offline

#7 2015-01-05 20:28:25

ewancoder
Member
Registered: 2014-05-13
Posts: 19

Re: Upgrading packages automatically with yaourt

Okay, I have created a patch produces Arch Linux Forums which adds "asroot" parameter to makepkg. This is dirty and temporary solution, but it works smile

Offline

#8 2015-01-05 20:33:36

Awebb
Member
Registered: 2010-05-06
Posts: 6,319

Re: Upgrading packages automatically with yaourt

Why on earth would I want to build a package as root? Instead of patching everything that is not broken, you could replace yaourt with something like cower and write a small bash script, that updates the AUR stuff. Every time I read yaourt and sudoers on one page, I want to put on a helmet and prepare for the worst.

Offline

#9 2015-01-05 20:38:33

bleach
Member
Registered: 2013-07-26
Posts: 264

Re: Upgrading packages automatically with yaourt

I agree what you want is to build with limited user land and then install as root.

Offline

#10 2015-01-05 20:46:52

ewancoder
Member
Registered: 2014-05-13
Posts: 19

Re: Upgrading packages automatically with yaourt

Awebb wrote:

Why on earth would I want to build a package as root? Instead of patching everything that is not broken, you could replace yaourt with something like cower and write a small bash script, that updates the AUR stuff. Every time I read yaourt and sudoers on one page, I want to put on a helmet and prepare for the worst.

Yes, I thought about migrating to something small and writing script for it, and yes I'm aware of the danger of root-building aur packages, but:

1. I'm already used to yaourt, I'm using it everywhere even instead of pacman for regular packages, so it's a habit and it will be pain in the ass to relearn the habit of typing this word in a terminal (although, I can use an alias yaourt->pacman after switching off).

2. I'm not a paranoid person at all and I am an optimist. So I believe in perfect, beautiful code in each and every one pkgbuild which does not need checking and contains colourful rainbows and flying butterflies. Maybe after some pkgbuild will broke my hdd and erase all my backups I'll consider your offer to put on a helmet, but for now on this is just the way I see it smile

P.S. Gonna read about cower and other alternatives though, because my way is just dirty, and I like clean and perfect solutions.

Offline

#11 2015-01-05 20:48:40

ewancoder
Member
Registered: 2014-05-13
Posts: 19

Re: Upgrading packages automatically with yaourt

bleach wrote:

I agree what you want is to build with limited user land and then install as root.

Yes, that's exactly what I want. Yaourt can't do this supposedly, because he's forcefully gives control to pacman after building package and I couldn't find a way to prevent this, so now I'm looking forward to find some alternative.

Offline

#12 2015-01-05 21:11:04

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Upgrading packages automatically with yaourt

I use packer (yay for giving it a keyword and it returning packages both from the repos and AUR), I have pacman with NOPASSWD in sudoers, packer nicely builds packages as user and installs them by calling "sudo pacman", it can work with --noconfirm.

Offline

#13 2015-01-05 21:54:53

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Upgrading packages automatically with yaourt

ewancoder wrote:

how to tell yaourt to just build packages and exit?

I heard of a tool that does that... what was it called... oh yeah makepkg ;D

Offline

#14 2015-01-05 22:12:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,611
Website

Re: Upgrading packages automatically with yaourt

Awebb wrote:

Every time I read yaourt and sudoers on one page, I want to put on a helmet and prepare for the worst.

I just grab popcorn ... because it's sure to be a good show.

There are so many things wrong here: building as root, installing AUR packages without even glancing at what they are, and most importantly (even though the other two are already pretty damn important) running a system upgrade on a keypress which presumably dumps all the output to /dev/null or to a log that will never be seen.  Forget all the AUR issues, just running pacman in such a way will almost assuredly lead to complete system breakage eventually.  The keybinding presented in the OP is only marginally better than playing Russion Roulette, and that margin is only due to the gun being pointed at your computer rather than your head.

And in case anyone wants to argue that they've used such a keybinding for a while and had no bad consequences, I'd liken that to a guy who took 5 consequtive turns of Russian Roulette and concluded it was perfectly safe.  Nope, he was just exceptionally lucky, and he'd be exceptionally stupid to think that his luck would continue for the 6th shot.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#15 2015-01-05 23:00:09

ewancoder
Member
Registered: 2014-05-13
Posts: 19

Re: Upgrading packages automatically with yaourt

lucke wrote:

I use packer (yay for giving it a keyword and it returning packages both from the repos and AUR), I have pacman with NOPASSWD in sudoers, packer nicely builds packages as user and installs them by calling "sudo pacman", it can work with --noconfirm.

Perfect! Gonna try it. I suppose it can update all already installed but outdated packages just like yaourt does?

Trilby wrote:

Forget all the AUR issues, just running pacman in such a way will almost assuredly lead to complete system breakage eventually.

Well, I am just exceptionally lucky guy big_smile The system never breaks while I'm updating it by just a key press. There are some minor issues sometimes but I'm fixing them quickly and I'm reading arch linux news via RSS so any major update which requires manual handling is noted.

Offline

#16 2015-01-05 23:01:30

ewancoder
Member
Registered: 2014-05-13
Posts: 19

Re: Upgrading packages automatically with yaourt

tomk wrote:

I heard of a tool that does that... what was it called... oh yeah makepkg ;D

Well, unfortunately it can't update all outdated installed AUR software like yaourt does =/

Offline

#17 2015-01-05 23:27:26

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Upgrading packages automatically with yaourt

ewancoder wrote:
lucke wrote:

I use packer (yay for giving it a keyword and it returning packages both from the repos and AUR), I have pacman with NOPASSWD in sudoers, packer nicely builds packages as user and installs them by calling "sudo pacman", it can work with --noconfirm.

Perfect! Gonna try it. I suppose it can update all already installed but outdated packages just like yaourt does?

Yes, it updates everything that is installed.

Offline

#18 2015-01-05 23:55:24

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: Upgrading packages automatically with yaourt

cower + meat

And to break the yaourt habbit, just uninstall it. After about 5 times of the error popping up about not finding the command, you'll have it licked!


Matt

"It is very difficult to educate the educated."

Offline

#19 2015-01-06 03:31:10

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,822

Re: Upgrading packages automatically with yaourt

Moving to AUR issues.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#20 2015-01-06 08:16:44

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,523

Re: Upgrading packages automatically with yaourt

Head_on_a_Stick wrote:

partial upgrades are not supported. Do not use pacman -Sy package

Ooops. Thanks for the advice.


do it good first, it will be faster than do it twice the saint wink

Offline

Board footer

Powered by FluxBB