]> spindle.queued.net Git - xodist/blob - configs/debxo-lxde/hooks
debxo: no longer make /ofw directory
[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         # OFW needs this to boot w/ partitions
27         ln -s . ${ROOT_DIR}/boot/boot
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 package_configure_hook()
48 {
49         ROOT_DIR="$1"
50
51         # Any customizations that need to be made after all packages have been
52         # installed should be put here.  $ROOT_DIR should be prefixed to any
53         # paths.
54
55
56         # Ensure certain modules get loaded during boot
57         cat >>${ROOT_DIR}/etc/modules<<EOF
58 lxfb
59 fbcon
60 olpc_dcon
61 scx200_acb
62 i8042
63 olpc_battery
64 msr
65 EOF
66
67         # UBIFS needs this
68         cat >>${ROOT_DIR}/etc/initramfs-tools/modules<<EOF
69 ubi mtd=root
70 EOF
71
72         # install some custom packages that aren't on mirrors.  ugly hack!
73         k="http://lunge.mit.edu/~dilinger/debxo-0.2/ofw-config_0.1_all.deb 
74  http://lunge.mit.edu/~dilinger/debxo-0.6/linux-image-2.6.37-rc1+_2.6.37-rc1+-47_i386.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         # No longer a need for xorg.conf
87         rm -f ${ROOT_DIR}/etc/X11/xorg.conf
88
89         # configure nodm
90         F=${ROOT_DIR}/etc/default/nodm
91         if [ -f ${F} ]; then
92                 sed --in-place "s/NODM_USER=.*$/NODM_USER=${DEFUSER}/" ${F}
93                 sed --in-place "s/NODM_ENABLED=.*$/NODM_ENABLED=true/" ${F}
94         fi
95
96 }
97
98 cleanup_chroot_hook()
99 {
100         ROOT_DIR="$1"
101
102         # Any customizations that need to be made after the chroot creation is
103         # complete should be put here.  $ROOT_DIR should be prefixed to any
104         # paths.
105
106         umount ${ROOT_DIR}/var/cache/apt/cache
107 }