]> Raphaƫl G. Git Repositories - distcook/blob - lib/setup.sh
Import cooking scripts
[distcook] / lib / setup.sh
1 #! /bin/sh -e
2
3 #Remove cache
4 if [ -f "$PWD/root/var/cache/urpmi/mirrors.cache" ]; then
5 rm -f "$PWD/root/var/cache/urpmi/mirrors.cache"
6 fi
7 if [ -f "$PWD/root/var/cache/urpmi/.metalink" ]; then
8 rm -f "$PWD/root/var/cache/urpmi/.metalink"
9 fi
10
11 #Bind mount
12 #XXX: umount many time just in case
13 umount "$PWD/root/proc" "$PWD/root/sys" || true
14 mount --bind /proc "$PWD/root/proc"
15 mount --bind /sys "$PWD/root/sys"
16
17 #Setup clock
18 cat << EOF > "$PWD/root/etc/sysconfig/clock"
19 ZONE=$ZONE
20 ARC=false
21 UTC=true
22 EOF
23
24 #Fix timezone for urpmi
25 if [ -f "$PWD/root/usr/share/zoneinfo/$ZONE" ]; then
26 ln -fs "../usr/share/zoneinfo/$ZONE" "$PWD/root/etc/localtime"
27 fi
28
29 #Add urpmi ressources
30 LC_ALL=C chroot "$PWD/root" urpmi.removemedia -a
31 #--all-media
32 LC_ALL=C chroot "$PWD/root" urpmi.addmedia --distrib --mirrorlist http://mirrors.mageia.org/api/mageia.$MGARELEASE.$ARCH.list
33
34 umount "$PWD/root/proc" "$PWD/root/sys"
35
36 #perl -pne 's%(.*testing.*) {\n%\1 {\n ignore\n%i' -i "$PWD/root/etc/urpmi/urpmi.cfg"
37 #perl -pne 'undef $/; s% +{(?:\n +.(?:country|proximity|longitude|arch|version|zone|latitude).[^,]+,){7}\n +.url.[^,]+distrib-coffee[^,]+,(?:\n +.(?:type|proximity_corrected).[^,]+,){2}\n%%' -i "$PWD/root/var/cache/urpmi/mirrors.cache"
38