updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / arch64 / arch64.install
blob9e2051607a95e4741042cc49ee8f0484594a9316
1 post_install ()
3         echo -e >&2 "\033[1;32m==>\033[0m Installing base system (x86_64)..."
5         local mirrorlist=$(mktemp --tmpdir mirrorlist.XXXX)
7         sed "s/i686\|x86_64/x86_64/g" "/etc/pacman.d/mirrorlist" > "$mirrorlist"
9         local config=$(mktemp --tmpdir pacman.conf.XXXX)
11         # filling pacman.conf
12         echo -e "[options]\n\n" \
13                         "RootDir     = /opt/arch64/\n" \
14                         "DBPath      = /opt/arch64/var/lib/pacman/\n" \
15                         "LogFile     = /opt/arch64/var/log/pacman.log\n" \
16                         "HoldPkg     = pacman glibc\n" \
17                         "SyncFirst   = pacman\n" > "$config"
19         for i in testing core extra community; do
20                 # comment the following line to enable testing in chroot
21                 [ "$i" == "testing" ] && continue
23                 echo -e "[$i]\nInclude = $mirrorlist\n" >> "$config"
24         done
26         # install packages
27         pacman --noconfirm --config "$config" -Sy base base-devel sudo >&2 || return 1
29         install -Dm644 "$mirrorlist" "/opt/arch64/etc/pacman.d/mirrorlist"
31         for i in group hosts localtime locale.gen pacman.conf \
32                         profile.d/locale.sh rc.conf resolv.conf shadow sudoers;  do
33                 ln -f "/etc/$i" "/opt/arch64/etc/" 2>/dev/null \
34                         || cp -af "/etc/$i" "/opt/arch64/etc/"
35         done
37         echo -e >&2 "\033[1;32m==>\033[0m Configuring schroot..."
38         echo -e "[arch64]
39 description=arch64
40 type=directory
41 location=/opt/arch64
42 priority=1
43 #users=username
44 groups=users
45 root-groups=root
46 run-setup-scripts=true
47 run-exec-scripts=false
48 script-config=script-arch64
49 personality=linux
50 aliases=64\n" >> /etc/schroot/schroot.conf
52         schroot -c arch64 locale-gen >&2
55 pre_remove ()
57         [ -e /var/lib/schroot/mount/arch64-* ] \
58                 && echo -e >&2 "\033[1;31m==>\033[0m There is an active schroot session." \
59                 && echo -e >&2 "\033[1;31m==>\033[0m Please close this session to complete the package removal."
60         while [ -e /var/lib/schroot/mount/arch64-* ]; do
61                 sleep 10;
62         done
64         echo -e >&2 "\033[1;32m==>\033[0m Removing arch64 from schroot config"
65         sed -i '/\[arch64\]/,/^$/d' /etc/schroot/schroot.conf
66         echo -e >&2 "\033[1;32m==>\033[0m Removing /opt/arch64..."
67         rm -rf "/opt/arch64"