You are not logged in.

#1 2016-11-10 11:37:14

limser
Member
Registered: 2015-05-04
Posts: 2

set what you need in chroot, before building package by makechrootpkg

When I build a VCS package, for example `foo-git`, I need to set git http.proxy to speed up source downloads.

At first, I add the git config to `/build/.gitconfig` in <chrootdir> of makechrootpkg. But it seems `/build/.gitconfig` will be removed every time when i run makechrootpkg. Ha, It's a fresh `/build/`.

Then, maybe I can set `env var`, such as `export http_proxy`, `export https_proxy`. And I found this thread .
I don't like that, `http_proxy`, `https_proxy` will affect too many things. How can I just do that for git and user `builduser `?

Here is  my solution:

There is a script <chrootdir>/<copy>/chrootbuild

#!/bin/bash
_chrootbuild () 
{ 
    . /etc/profile;
    export HOME=/build;
    cd /startdir;
    sudo -u builduser makepkg "$@"
}
_chrootbuild -s --noconfirm -L --holdver -s || exit

It will source /etc/profile before call `makepkg`.

In `/etc/profile`, we have this part:

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
	for profile in /etc/profile.d/*.sh; do
		test -r "$profile" && . "$profile"
	done
	unset profile
fi

So I can just add something to `/etc/profile.d/`, which is <chrootdir>/<copy>/etc/profile.d/ in the HOST system.

[$] cat <chrootdir>/<copy>/etc/profile.d/builduser-profile.sh
#!/bin/bash
cat > /build/.gitconfig <<EOF
[https]
	proxy = https://127.0.0.1:8087
[http]
	proxy = http://127.0.0.1:8087
	sslVerify = false
EOF

Finally, it works!

And please share your other solutions or ideas.

Offline

#2 2016-11-11 03:19:48

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: set what you need in chroot, before building package by makechrootpkg

Ummmmmm, git automatically reads the system configuration from /etc/gitconfig so I am not sure why you engage in such elaborate hacks...

But I also don't know why you want to tell git inside the chroot how to use a proxy, when the sources are downloaded before you enter the chroot. So you really should be setting things in your current user's gitconfig. And I assume that is already the case...

(On which note, I really think makechrootpkg could use --skipinteg and --holdver as default makepkg arguments.)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB