bomb
[mirrors/Programs.git] / bash / pacman-doctor / archstrap.sh
CommitLineData
e2c9be16
H
1#!/bin/bash
2#Simple script to create ArchLinux system suitable for chroot or virtualserver.
3#It will take ~400-500MB but you will probably want to uninstall some pkgs.
4#You will be automaticaly chrooted into new system once installation is done...
5
6pacman='/usr/bin/pacman'
7ROOT="$1"
8pacman="$pacman --noconfirm --ignore kernel26 --root $ROOT"
9
10[ -z "$1" ] && echo "Usage: root@localhost# $0 /path/to/empty/installation/directory/" && exit 1
11[ "$UID" != 0 ] && echo "You have to be root!" && exit 7
12[ ! -d "$ROOT" ] && echo "Error: $ROOT is not a directory!" && exit 2
13[ -n "$(ls -A "$ROOT")" ] && echo "Error: $ROOT is not empty!" && exit 3
14
15echo -e "Hello. I will install ArchLinux to $ROOT directory.\n"
16echo '==> Creating pacman DB...'
17 mkdir -p "$ROOT/var/lib/pacman/" || exit 4
18echo '==> Synchronizing pacman DB...'
19 $pacman -Sy || exit 5
20echo '==> Installing packages from base group...'
21 $pacman -S base || exit 6
22echo '==> Minimal configuration - copying from parent...'
23 no_blanks() { grep -Ev '^(#|$)'; }
24 for i in /etc/resolv.conf /etc/pacman.d/mirrorlist; do
25 echo " -> $i";
26 cat "$i" | no_blanks >> "$ROOT$i";
27 done;
28 #Hack for special configurations:
29 echo " -> /etc/pacman.d/mirrorlist*";
30 cat /etc/pacman.d/mirrorlist* | no_blanks >> "$ROOT/etc/pacman.d/mirrorlist";
31
32echo '==> Entering chroot...'
33 chroot $ROOT
34echo -e "\nBye bye. You can enter your system again by executing following command as root
35chroot '$ROOT'"
36
37exit 0
This page took 0.18894 seconds and 4 git commands to generate.