]> spindle.queued.net Git - xodist/blob - configs/debxo-gnome/hooks
mkchroot.sh: break out non-olpc stuff
[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         # Apt can't deal w/ jffs2's lack of mmap, so we keep apt's cache on tmpfs
30         # (see <http://bugs.debian.org/314334>).
31         mkdir ${ROOT_DIR}/var/cache/apt/cache
32         mount -t tmpfs tmpfs ${ROOT_DIR}/var/cache/apt/cache
33         # XOs are slow and small; don't use pdiffs, don't install recommends, and
34         # work around lack of mmap.
35 cat >${ROOT_DIR}/etc/apt/apt.conf<<EOF
36 Acquire::Pdiffs "false";
37 APT::Install-Recommends "false";
38 Dir {
39         Cache "var/cache/apt/" {
40                 srcpkgcache "cache/srcpkgcache.bin";
41                 pkgcache "cache/pkgcache.bin";
42         };
43 };
44 EOF
45
46         
47 }
48
49 package_configure_hook()
50 {
51         ROOT_DIR="$1"
52
53         # Any customizations that need to be made after all packages have been
54         # installed should be put here.  $ROOT_DIR should be prefixed to any
55         # paths.
56
57
58         # Ensure certain modules get loaded during boot
59         cat >>${ROOT_DIR}/etc/modules<<EOF
60 lxfb
61 fbcon
62 olpc_dcon
63 scx200_acb
64 i8042
65 olpc_battery
66 msr
67 EOF
68
69         # install some custom packages that aren't on mirrors.  ugly hack!
70         k="http://lunge.mit.edu/~dilinger/debxo-0.2/initramfs-tools_0.92l.2_all.deb 
71  http://lunge.mit.edu/~dilinger/debxo-0.2/ofw-config_0.1_all.deb 
72  http://lunge.mit.edu/~dilinger/debxo-0.4/linux-2.6.25.15_2.6.25.15-165_i386.deb 
73  http://lunge.mit.edu/~dilinger/debxo-0.5/xserver-xorg-video-geode_2.11.0-0.3_i386.deb 
74  http://lunge.mit.edu/~dilinger/debxo-0.5/autox_0.1_all.deb"
75         mkdir -p cache
76         for i in $k; do
77                 pkg=$(basename ${i})
78                 wget --continue -O cache/${pkg} ${i}
79                 cp cache/${pkg} ${ROOT_DIR}/${pkg}
80                 (chroot ${ROOT_DIR} dpkg -i /${pkg})
81                 pkgbase=$(echo $pkg | cut -d_ -f1)
82                 echo $pkgbase hold | (chroot ${ROOT_DIR} dpkg --set-selections)
83                 rm -f ${ROOT_DIR}/${pkg}
84         done
85
86         # take some packages that are okay to upgrade off hold
87         echo xserver-xorg-video-geode install | (chroot ${ROOT_DIR} dpkg --set-selections)
88         echo autox install | (chroot ${ROOT_DIR} dpkg --set-selections)
89
90         # No longer a need for xorg.conf
91         rm -f ${ROOT_DIR}/etc/X11/xorg.conf
92
93         # key bindings/mappings
94         if [ -d ${ROOT_DIR}/usr/share/hal/fdi/information/10freedesktop/ ]; then
95                 cp 30-keymap-olpc.fdi ${ROOT_DIR}/usr/share/hal/fdi/information/10freedesktop/
96         fi
97
98         # configure autox
99         if [ -f ${ROOT_DIR}/etc/default/autox ]; then
100                 sed --in-place "s/USER=$/USER=${DEFUSER}/" ${ROOT_DIR}/etc/default/autox
101         fi
102
103         # configure gnome
104         if [ -d ${ROOT_DIR}/etc/gconf/2 ]; then
105                 cat >${ROOT_DIR}/etc/gconf/2/local-defaults.path<<EOF
106 # DebXO defaults (customized for the XO-1's display
107 xml:readonly:/etc/gconf/debxo.xml.defaults
108 EOF
109                 mkdir -p ${ROOT_DIR}/etc/gconf/debxo.xml.defaults
110                 cp %gconf-tree.xml ${ROOT_DIR}/etc/gconf/debxo.xml.defaults/
111         fi
112
113 }
114
115 cleanup_chroot_hook()
116 {
117         ROOT_DIR="$1"
118
119         # Any customizations that need to be made after the chroot creation is
120         # complete should be put here.  $ROOT_DIR should be prefixed to any
121         # paths.
122
123         umount ${ROOT_DIR}/var/cache/apt/cache
124 }