]> spindle.queued.net Git - xodist/blob - configs/debxo-gnome/hooks
debxo: one final tweak for ubifs support..
[xodist] / configs / debxo-gnome / hooks
1 # Default hooks - copy & customize this for a new image build
2 #
3 # Copyright © 2008-2009  Andres Salomon <dilinger@collabora.co.uk>
4 #
5 # This file is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 customize_chroot_hook()
20 {
21         ROOT_DIR="$1"
22
23         # Any customizations that need to be made to the chroot after the base system
24         # has been installed (but prior to custom package installation) should be
25         # put here.  $ROOT_DIR should be prefixed to any paths.
26         
27         mkdir ${ROOT_DIR}/ofw
28
29         # OFW needs this to boot w/ partitions
30         ln -s . ${ROOT_DIR}/boot/boot
31         
32         # Apt can't deal w/ jffs2's lack of mmap, so we keep apt's cache on tmpfs
33         # (see <http://bugs.debian.org/314334>).
34         mkdir ${ROOT_DIR}/var/cache/apt/cache
35         mount -t tmpfs tmpfs ${ROOT_DIR}/var/cache/apt/cache
36         # XOs are slow and small; don't use pdiffs, don't install recommends, and
37         # work around lack of mmap.
38 cat >${ROOT_DIR}/etc/apt/apt.conf<<EOF
39 Acquire::Pdiffs "false";
40 APT::Install-Recommends "false";
41 Dir {
42         Cache "var/cache/apt/" {
43                 srcpkgcache "cache/srcpkgcache.bin";
44                 pkgcache "cache/pkgcache.bin";
45         };
46 };
47 EOF
48
49         # add archive key for lenny-backports
50         wget -O - http://backports.org/debian/archive.key | (chroot ${ROOT_DIR} apt-key add -)
51 }
52
53 package_configure_hook()
54 {
55         ROOT_DIR="$1"
56
57         # Any customizations that need to be made after all packages have been
58         # installed should be put here.  $ROOT_DIR should be prefixed to any
59         # paths.
60
61
62         # Ensure certain modules get loaded during boot
63         cat >>${ROOT_DIR}/etc/modules<<EOF
64 lxfb
65 fbcon
66 olpc_dcon
67 scx200_acb
68 i8042
69 olpc_battery
70 msr
71 EOF
72
73         # UBIFS needs this
74         cat >>${ROOT_DIR}/etc/initramfs-tools/modules<<EOF
75 ubi mtd=root
76 EOF
77
78         # install some custom packages that aren't on mirrors.  ugly hack!
79         k="http://lunge.mit.edu/~dilinger/debxo-0.2/ofw-config_0.1_all.deb 
80  http://lunge.mit.edu/~dilinger/debxo-0.6/linux-image-2.6.36+_2.6.36+-14_i386.deb"
81         mkdir -p cache
82         for i in $k; do
83                 pkg=$(basename ${i})
84                 wget --continue -O cache/${pkg} ${i}
85                 cp cache/${pkg} ${ROOT_DIR}/${pkg}
86                 (chroot ${ROOT_DIR} dpkg -i /${pkg})
87                 pkgbase=$(echo $pkg | cut -d_ -f1)
88                 echo $pkgbase hold | (chroot ${ROOT_DIR} dpkg --set-selections)
89                 rm -f ${ROOT_DIR}/${pkg}
90         done
91
92         # No longer a need for xorg.conf
93         rm -f ${ROOT_DIR}/etc/X11/xorg.conf
94
95         # key bindings/mappings
96         if [ -d ${ROOT_DIR}/usr/share/hal/fdi/information/10freedesktop/ ]; then
97                 cp 30-keymap-olpc.fdi ${ROOT_DIR}/usr/share/hal/fdi/information/10freedesktop/
98         fi
99
100         # configure gnome
101         if [ -d ${ROOT_DIR}/etc/gconf/2 ]; then
102                 cat >${ROOT_DIR}/etc/gconf/2/local-defaults.path<<EOF
103 # DebXO defaults (customized for the XO-1's display
104 xml:readonly:/etc/gconf/debxo.xml.defaults
105 EOF
106                 mkdir -p ${ROOT_DIR}/etc/gconf/debxo.xml.defaults
107                 cp %gconf-tree.xml ${ROOT_DIR}/etc/gconf/debxo.xml.defaults/
108         fi
109
110         # configure gdm
111         if [ -d ${ROOT_DIR}/etc/gdm ]; then
112                 sed -i "s_\[daemon\]_\[daemon\]\n\nGreeter=/usr/lib/gdm/gdmlogin\n\nAutomaticLoginEnable=true\n\nAutomaticLogin=${DEFUSER}_" ${ROOT_DIR}/etc/gdm/gdm.conf
113         fi
114
115 }
116
117 cleanup_chroot_hook()
118 {
119         ROOT_DIR="$1"
120
121         # Any customizations that need to be made after the chroot creation is
122         # complete should be put here.  $ROOT_DIR should be prefixed to any
123         # paths.
124
125         umount ${ROOT_DIR}/var/cache/apt/cache
126 }