]> spindle.queued.net Git - xodist/blob - configs/debxo-gnome/hooks
debxo: no longer make /ofw directory
[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         # OFW needs this to boot w/ partitions
28         ln -s . ${ROOT_DIR}/boot/boot
29         
30         # Apt can't deal w/ jffs2's lack of mmap, so we keep apt's cache on tmpfs
31         # (see <http://bugs.debian.org/314334>).
32         mkdir ${ROOT_DIR}/var/cache/apt/cache
33         mount -t tmpfs tmpfs ${ROOT_DIR}/var/cache/apt/cache
34         # XOs are slow and small; don't use pdiffs, don't install recommends, and
35         # work around lack of mmap.
36 cat >${ROOT_DIR}/etc/apt/apt.conf<<EOF
37 Acquire::Pdiffs "false";
38 APT::Install-Recommends "false";
39 Dir {
40         Cache "var/cache/apt/" {
41                 srcpkgcache "cache/srcpkgcache.bin";
42                 pkgcache "cache/pkgcache.bin";
43         };
44 };
45 EOF
46 }
47
48 package_configure_hook()
49 {
50         ROOT_DIR="$1"
51
52         # Any customizations that need to be made after all packages have been
53         # installed should be put here.  $ROOT_DIR should be prefixed to any
54         # paths.
55
56
57         # Ensure certain modules get loaded during boot
58         cat >>${ROOT_DIR}/etc/modules<<EOF
59 lxfb
60 fbcon
61 olpc_dcon
62 scx200_acb
63 i8042
64 olpc_battery
65 msr
66 EOF
67
68         # UBIFS needs this
69         cat >>${ROOT_DIR}/etc/initramfs-tools/modules<<EOF
70 ubi mtd=root
71 EOF
72
73         # install some custom packages that aren't on mirrors.  ugly hack!
74         k="http://lunge.mit.edu/~dilinger/debxo-0.2/ofw-config_0.1_all.deb 
75  http://lunge.mit.edu/~dilinger/debxo-0.6/linux-image-2.6.37-rc1+_2.6.37-rc1+-47_i386.deb"
76         mkdir -p cache
77         for i in $k; do
78                 pkg=$(basename ${i})
79                 wget --continue -O cache/${pkg} ${i}
80                 cp cache/${pkg} ${ROOT_DIR}/${pkg}
81                 (chroot ${ROOT_DIR} dpkg -i /${pkg})
82                 pkgbase=$(echo $pkg | cut -d_ -f1)
83                 echo $pkgbase hold | (chroot ${ROOT_DIR} dpkg --set-selections)
84                 rm -f ${ROOT_DIR}/${pkg}
85         done
86
87         # No longer a need for xorg.conf
88         rm -f ${ROOT_DIR}/etc/X11/xorg.conf
89
90         # configure gnome
91         if [ -d ${ROOT_DIR}/etc/gconf/2 ]; then
92                 cat >${ROOT_DIR}/etc/gconf/2/local-defaults.path<<EOF
93 # DebXO defaults (customized for the XO-1's display
94 xml:readonly:/etc/gconf/debxo.xml.defaults
95 EOF
96                 mkdir -p ${ROOT_DIR}/etc/gconf/debxo.xml.defaults
97                 cp %gconf-tree.xml ${ROOT_DIR}/etc/gconf/debxo.xml.defaults/
98         fi
99
100         # configure gdm
101         if [ -d ${ROOT_DIR}/etc/gdm ]; then
102                 sed -i "s_\[daemon\]_\[daemon\]\n\nGreeter=/usr/lib/gdm/gdmlogin\n\nAutomaticLoginEnable=true\n\nAutomaticLogin=${DEFUSER}_" ${ROOT_DIR}/etc/gdm/gdm.conf
103         fi
104
105 }
106
107 cleanup_chroot_hook()
108 {
109         ROOT_DIR="$1"
110
111         # Any customizations that need to be made after the chroot creation is
112         # complete should be put here.  $ROOT_DIR should be prefixed to any
113         # paths.
114
115         umount ${ROOT_DIR}/var/cache/apt/cache
116 }