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