You are not logged in.

#1 2017-01-10 08:34:09

LetsAsk
Member
Registered: 2016-04-15
Posts: 9

makepkg script issues

Hello guys!

I am searching for a way to install some packages from the aur with a custom script (for the purpose of reinstalling arch linux).

I already wrote down some code which works fine ...

mkdir /tmp/PACKAGE && cd /tmp/PACKAGE
curl -L https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=PACKAGE -o PKGBUILD && makepkg -srci --noconfirm
cd ~ && rm -rf /tmp/PACKAGE

... but unfortunately makepkg needs root access for installing dependencies and the package itself.

Since I am not able to run makepkg with sudo rights, I cannot install any packages through an automatic script.

Is there any solution for doing this?

Thanks in advance!

Offline

#2 2017-01-10 08:43:10

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: makepkg script issues

Compling packages doesn't require root permissions but makepkg nees sudo for installing packages with pacman. You need to modify /etc/sudoers so that you can use "sudo pacman -U" without password prompt. As incorrect modification of /etc/sudoers may break sudo, I would suggest you to read wiki carefully before proceeding

Offline

#3 2017-01-10 08:45:13

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: makepkg script issues

I cannot quite help you on the matter of automating the OS installation, but on the issue of fetching the PKGBUILDs like that:
There are quite some packages where you require other files than just the PKGBUILD - so you might rather want to download the entire archives (either as a tarball, or better, through git).

Last edited by ayekat (2017-01-10 08:45:39)


pkgshackscfgblag

Offline

#4 2017-01-10 12:37:12

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

Re: makepkg script issues

I second the above - except I think "some packages" puts it a bit to softly: many packages have files other than their PKGBUILD and your approach will just completely fail.

The good news is that using git eliminates some of your steps:

git clone https://aur.archlinux.org/${PKG}.git
pushd ${PKG}
makepkg -srci
popd
rm -rf ${PKG}

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

Offline

#5 2017-01-10 16:30:42

LetsAsk
Member
Registered: 2016-04-15
Posts: 9

Re: makepkg script issues

Docbroke wrote:

You need to modify /etc/sudoers so that you can use "sudo pacman -U" without password prompt

Yes, I was thinking of that as well. I thought there would be a better solution for that specific issue.

This is how I change the /etc/sudoers for my purpose:

echo PASSWORD | sudo -S bash -c 'echo "USER HOST=NOPASSWD: /usr/bin/pacman" | (EDITOR="tee -a" visudo)'

At the end of my script I just delete this line so that I have to type in my password for the pacman command again (the standard behaviour).

ayekat wrote:

There are quite some packages where you require other files than just the PKGBUILD - so you might rather want to download the entire archives

My idea was to install an aur helper (e.g. packer) through this method (PKGBUILD) and then use the helper for the rest of my installation to get all the important stuff:

packer -G --noconfirm --noedit PACKAGE

Offline

#6 2017-01-10 17:07:17

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: makepkg script issues

May i suggest adding the aur helper to the archiso instead, by building a custom archiso.
Then call the aur helper with --root  /mnt to install to the new installed system's root.
This assumes that the aur helper passes the --root option on to pacman.
That way you won't have to "bootstrap" the AUR because you have an AUR helper available right away.

Offline

Board footer

Powered by FluxBB