3 #####################################################
4 # This program is licensed under GPL v2 only #
5 # See LICENSE for more details #
6 #####################################################
8 source /etc
/makepkg.conf
11 function GetCorePkgs
{
12 if [ "${PACKAGES}" ]; then
19 function BootstrapCore
{
20 COREPKGS
=$
(GetCorePkgs
)
22 mkdir
-p ${TMPROOT}/var
/lib
/pacman
/
23 mkdir
-p ${TMPROOT}/dev
24 mkdir
-p ${TMPROOT}/etc
25 mount
--bind /dev
${TMPROOT}/dev
26 echo "[core]" > ${TMPROOT}/etc
/pacman.conf.bootstrap
27 echo "Server = $MIRROR" >> ${TMPROOT}/etc
/pacman.conf.bootstrap
28 echo "[extra]" >> ${TMPROOT}/etc
/pacman.conf.bootstrap
29 echo "Server = $MIRROR" >> ${TMPROOT}/etc
/pacman.conf.bootstrap
30 pacman
-Sy --verbose --root ${TMPROOT} --config ${TMPROOT}/etc/pacman.conf.bootstrap --noconfirm --cachedir ${PKGCACHE}
31 pacman
-S $COREPKGS --cachedir ${PKGCACHE} --root ${TMPROOT}/ --config ${TMPROOT}/etc
/pacman.conf.bootstrap
33 rm ${TMPROOT}/etc
/pacman.conf.bootstrap
36 function DisplaySyntax
{
37 echo 'Usage: archbootstrap-ee --target=<dir> [--arch=<arch>] [--mirror=<url>] [--pkgcache=<dir>] [--packages=<file>]'
41 if [ "$(whoami)" != "root" ]; then
42 echo "You need to be root."
46 echo "Archbootstrap-ee 0.5"
47 echo "Bootstraps a new Arch Linux system."
57 if [ ${i/--arch/} != $i ]; then
60 if [ ${i/--target/} != $i ]; then
61 TMPROOT
=${i/--target=/}
63 if [ ${i/--mirror/} != $i ]; then
64 MIRROR
=${i/--mirror=/}
66 if [ ${i/--pkgcache/} != $i ]; then
67 PKGCACHE
=${i/--pkgcache=/}
69 if [ ${i/--packages/} != $i ]; then
70 PACKAGES
=${i/--packages=/}
74 [ "$1" == "--help" ] && DisplaySyntax
75 [ -z "${TARCH}" ] && DisplaySyntax
76 [ -z "${TMPROOT}" ] && DisplaySyntax
77 [ -z "${MIRROR}" ] && MIRROR
="ftp://ftp.archlinux.org/\$repo/os/$TARCH"
80 if [ -z "${PKGCACHE}" ]; then
81 if [ "${CARCH}" == "${TARCH}" ]; then
82 PKGCACHE
=/var
/cache
/pacman
/pkg
84 if [ "${TARCH}" == "i686" ]; then
85 PKGCACHE
=/var
/cache
/pacman
/pkg32
87 if [ "${TARCH}" == "x86_64" ]; then
88 PKGCACHE
=/var
/cache
/pacman
/pkg64
91 if [ -z "${PKGCACHE}" ]; then
92 echo "Archbootstrap does not support this host/target architecture."
98 echo "Bootstrap summary:"
99 echo "Host architecture: $CARCH"
100 echo "Target architecture: $TARCH"
101 echo "Target directory: $TMPROOT"
102 echo "Mirror: $MIRROR"
103 echo "Package cache directory: $PKGCACHE"
104 [ "${PACKAGES}" ] && echo "Package list: ${PACKAGES}"