summaryrefslogtreecommitdiff
path: root/newchroot
blob: fbfebbf4e927477c51589be62405ce7ab2c0a60d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Copyleft 2012 - Nicolás Reynolds <fauno@parabola.nu>
# Bootstraps a Parabola build root
# Note: this is a very basic script that let's you do whatever you want, so
# it's not foolproof ;)

# Attempt to provide some help
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
    echo "Installs a Parabola build root on the current dir"
    echo "Usage: newchroot [custom package1 ...]"
    echo "Tip: pass 'distcc ccache' to speed up builds"
    echo ""
    echo "Environment variables:"
    echo -e "WORKDIR \tThe install dir"
    echo -e "LOGFILE \tAn alternate logfile ($PWD/pacman.log)"
    echo -e "PACCACHE\tThe pacman cache (guessed)"
    exit
fi

. "$(dirname $0)"/newroot

pacman -S base-devel $@

# No need to fiddle with /etc/resolv.conf if you're changing networks
echo -e "80.87.131.252\trepo.parabolagnulinux.org" >> "${WORKDIR}"/etc/hosts

# Only use up to date repos
echo 'Server = http://repo.parabolagnulinux.org/$repo/os/$arch' > "${WORKDIR}"/etc/pacman.d/mirrorlist

echo 'Add this to your fstab:'
echo -e "# chroot
none\t${WORKDIR}/proc\tproc\tdefaults
none\t${WORKDIR}/sys\tsysfs\tdefaults
/dev\t${WORKDIR}/dev\tnone\trbind
# cache
${PACCACHE}\t${WORKDIR}/var/cache/pacman/pkg\tnone\tbind"