root/current/host/trunk/emdebian-tools/trunk/pbuilder/emrootfslib

Revision 4931, 17.0 kB (checked in by codehelp, 4 months ago)

* embootstrap fails if /bin/sh is not symlinked to /bin/bash (Closes:

#498495)

* pbuilder/emdebian.coreutils pbuilder/emdebian.crossd

pbuilder/emdebian.gpe pbuilder/emdebian.gtk pbuilder/empbuilderlib
pbuilder/emrootfslib: migrate POSIX functions out of empbuilderlib
and into a new shell library, emrootfslib, that is checked for
bashisms each build. Migrate deboostrap suite scripts into
/usr/share. Add experimental pbuilder/emdebian.coreutils.

Line 
1#  emrootfslib : shell library to support root filesystems for Emdebian.
2#
3#  This file is POSIX shell, compatible with debootstrap.
4#  Do not include or reference pbuilder functions or bash code here.
5#
6#  Copyright (C) 2006-2008  Neil Williams <codehelp@debian.org>
7#
8#  This package is free software; you can redistribute it and/or modify
9#  it under the terms of the GNU General Public License as published by
10#  the Free Software Foundation; either version 3 of the License, or
11#  (at your option) any later version.
12#
13#  This program is distributed in the hope that it will be useful,
14#  but WITHOUT ANY WARRANTY; without even the implied warranty of
15#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16#  GNU General Public License for more details.
17#
18#  You should have received a copy of the GNU General Public License
19#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20#
21
22# This shell library requires perl !
23
24# Intended solely for use on the build machine. Do not use these functions
25# in second_stage_install !
26
27OURVERSION=`perl -e 'use Emdebian::Tools; print &tools_version();'`
28
29get_default_arch ()
30{
31        ARCH=`perl -e 'use Debian::DpkgCross; \
32&read_config(); \
33my $arch = &get_architecture(); \
34print (qq/None.\n/) if (!$arch); \
35print $arch;';`
36}
37
38 get_work_dir ()
39{
40        WORKDIR=`perl -e 'use Cwd; use Emdebian::Tools; use Config::Auto; use Debian::DpkgCross; \
41&read_config; \
42my $w = &get_workdir; \
43$w = cwd if (! -d $w); \
44$w =~ s/\/$//; \
45print $w;';`
46}
47
48get_work_dir
49get_default_arch
50
51WORKPLACE="${WORKDIR}/pbuilder"
52BASETGZ="${WORKDIR}/emdebian.tgz"
53
54#pbuilder base values
55DEBIAN_BUILDARCH=$ARCH
56# cross-building chroot is same arch as host.
57BUILDRESULT="$WORKPLACE/result/"
58# tidy up // to /
59BUILDRESULT=`echo $BUILDRESULT | tr -s \/`
60APTCACHE="$WORKPLACE/aptcache/"
61# tidy up // to /
62APTCACHE=`echo $APTCACHE | tr -s \/`
63AUTO_DEBSIGN=yes
64APTCACHEHARDLINK="no"
65BUILDPLACE="$WORKPLACE/build"
66
67# the default is to add a PID in the buildplace.
68BASEBUILDPLACE="$BUILDPLACE"
69if [ "${PRESERVE_BUILDPLACE}" != "yes" ]; then
70    BUILDPLACE="$BUILDPLACE/$$"
71fi
72
73checkarch ()
74{
75        ARCH=$ARCH perl -e 'use Debian::DpkgCross; $arch = $ENV{ARCH}; $arch=~s/ //g; \
76                die "Unsupported architecture: $arch Use --arch\n" if (not defined (&check_arch($arch)));'
77}
78
79create_emdebiantgz() {
80        (
81        if ! cd "$BUILDPLACE"; then
82                echo "Error: unexpected error in chdir to $BUILDPLACE" >&2
83                exit 1;
84        fi
85        while test -f "${BASETGZ}.tmp"; do
86                echo "  -> Someone else has lock over ${BASETGZ}.tmp, waiting"
87                sleep 10s
88        done
89        echo " -> creating base tarball [${BASETGZ}]"
90        if ! sudo tar cfz "${BASETGZ}.tmp" * ; then
91                echo " -> failed building base tarball"
92                rm -f "${BASETGZ}.tmp"
93                exit 1;
94        fi
95        mv "${BASETGZ}.tmp" "${BASETGZ}"
96    )
97}
98
99check_dirs()
100{
101        if [ ! -d $BUILDPLACE ] ; then
102                mkdir -p $BUILDPLACE
103        fi
104        if [ ! -d $BUILDRESULT ] ; then
105                mkdir -p $BUILDRESULT
106        fi
107        if [ ! -d $APTCACHE ] ; then
108                mkdir -p $APTCACHE
109        fi
110}
111
112disable_apt_recommends () {
113        if [ -d "$BUILDPLACE/etc/apt/apt.conf.d/" ]; then
114                if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/10disablerecommends" ]; then
115                        echo "  -> disabling Apt::Install-Recommends"
116                        cat > $BUILDPLACE/etc/apt/apt.conf.d/10disablerecommends << 'EOF'
117APT
118{
119  Install-Recommends "false"
120};
121EOF
122                fi
123        fi
124}
125
126disable_apt_pdiffs () {
127        if [ -d "$BUILDPLACE/etc/apt/apt.conf.d/" ]; then
128                if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/12disablepdiffs" ]; then
129                        echo "  -> disabling Apt::Acquire::PDiffs"
130                        cat > $BUILDPLACE/etc/apt/apt.conf.d/12disablepdiffs << 'EOF'
131APT
132{
133  Acquire::PDiffs "false";
134};
135EOF
136                fi
137        fi
138}
139
140apt_autoremove_always () {
141        if [ -d "$BUILDPLACE/etc/apt/apt.conf.d/" ]; then
142                if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/11always_autoremove" ]; then
143                        echo "  -> enabling Apt::AutomaticRemove"
144                        cat > $BUILDPLACE/etc/apt/apt.conf.d/11always_autoremove << 'EOF'
145APT
146{
147  AutomaticRemove "true"
148};
149EOF
150                fi
151        fi
152}
153
154unpack_debootstrap () {
155        info INSTCORE "Starting unpacking in $BUILDPLACE"
156        for deb in `ls $BUILDPLACE/var/cache/apt/archives/*.deb`; do
157                ver=`dpkg -f $deb Version`
158                pkg=`dpkg -f $deb Package`
159                info INSTCORE "Unpacking $pkg ($ver) ...."
160                dpkg -x $deb $BUILDPLACE/
161                # get the package listing with reduced parsing complexity
162                mkdir $BUILDPLACE/listing
163                ar -p $deb data.tar.gz > $BUILDPLACE/listing/data.tar.gz
164                tar -tzf $BUILDPLACE/listing/data.tar.gz | sed -e 's/^\.//' | sed -e 's/^\/$/\/\./' | sed -e 's/\/$//' > $BUILDPLACE/var/lib/dpkg/info/${pkg}.list
165                rm -rf $BUILDPLACE/listing
166                rm -rf $BUILDPLACE/tmp/*
167                dpkg -e $deb $BUILDPLACE/tmp/
168                for maint in `ls $BUILDPLACE/tmp/`; do
169                        mv $BUILDPLACE/tmp/$maint $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint
170                        if [ $maint = "control" ]; then
171                                cat $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint >> $BUILDPLACE/var/lib/dpkg/available
172                                cat $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint >> $BUILDPLACE/var/lib/dpkg/status
173                                echo "" >> $BUILDPLACE/var/lib/dpkg/available
174                                echo "Status: install ok unpacked" >> $BUILDPLACE/var/lib/dpkg/status
175                                rm $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint
176                        fi
177                        # need a dpkg filter to make this stick
178                        if [ $maint = "symbols" ]; then
179                                rm $BUILDPLACE/var/lib/dpkg/info/$pkg.symbols
180                        fi
181                done
182                if [ -f $BUILDPLACE/var/lib/dpkg/info/$pkg.conffiles ]; then
183                        echo "Conffiles:" >> $BUILDPLACE/var/lib/dpkg/status
184                        info INSTCORE "Processing $pkg.conffiles"
185                        for line in `cat $BUILDPLACE/var/lib/dpkg/info/$pkg.conffiles`; do
186                                md5=`md5sum $BUILDPLACE/$line | cut -d" " -f1`
187                                echo " $line $md5" >> $BUILDPLACE/var/lib/dpkg/status
188                        done
189                fi
190                echo "" >> $BUILDPLACE/var/lib/dpkg/status
191        done
192        # busybox symlinks are best managed in postinst so that dpkg
193        # does not complain when they are replaced by Debian packages.
194        # this allows more applets to be supported by default.
195        if [ -f $BUILDPLACE/usr/share/busybox/busybox.links ]; then
196                cd $BUILDPLACE
197                # setup busybox
198                cp usr/share/busybox/busybox.links .
199                cp usr/share/busybox/install.sh .
200                # link in the rest of its applets from OUTSIDE the chroot
201                info INSTCORE "Symlinking the busybox applets..."
202                sh ./install.sh $BUILDPLACE/ --symlinks
203                rm $BUILDPLACE/install.sh
204                rm $BUILDPLACE/busybox.links
205        else
206                info INSTCORE "busybox configuration not required"
207        fi
208        if [ ! -e "$BUILDPLACE/etc/localtime" ]; then
209                ln -sf /usr/share/zoneinfo/UTC "$BUILDPLACE/etc/localtime"
210        fi
211        # a better fix for /usr/sbin/update-rc.d is available via sysv-rc
212        if [ ! -f $BUILDPLACE/usr/sbin/update-rc.d ]; then
213                echo "#!/bin/sh" > $BUILDPLACE/usr/sbin/update-rc.d
214                echo "" >> $BUILDPLACE/usr/sbin/update-rc.d
215                chmod 755 $BUILDPLACE/usr/sbin/update-rc.d
216        fi
217        RC=`head $BUILDPLACE/usr/sbin/update-rc.d | grep /usr/bin/perl || true`
218        if [ "$RC" != "" ]; then
219                info INSTCORE "Replacing perl update-rc.d"
220                echo "#!/bin/sh" > $BUILDPLACE/usr/sbin/update-rc.d
221                echo "" >> $BUILDPLACE/usr/sbin/update-rc.d
222                chmod 755 $BUILDPLACE/usr/sbin/update-rc.d
223        fi
224        # invoke-rc.d is usually shell but is being looked at in Debian.
225        if [ ! -f $BUILDPLACE/usr/sbin/invoke-rc.d ]; then
226                echo '#!/bin/sh' > $BUILDPLACE/usr/sbin/invoke-rc.d
227                echo 'exec /etc/init.d/$1 $2' > $BUILDPLACE/usr/sbin/invoke-rc.d
228                echo '' >> $BUILDPLACE/usr/sbin/invoke-rc.d
229                chmod 755 $BUILDPLACE/usr/sbin/invoke-rc.d
230        fi
231        info INSTCORE "Removing archives..."
232        rm -f $BUILDPLACE/var/cache/apt/archives/*.deb
233        # (skip stages in emsecondstage)
234        touch $BUILDPLACE/debootstrap/unpacked
235}
236
237extra_etc_rcd ()
238{
239        if [ ! -d $BUILDPLACE/etc/rcS.d ]; then
240                mkdir $BUILDPLACE/etc/rcS.d
241        fi
242        if [ ! -d $BUILDPLACE/etc/rc0.d ]; then
243                mkdir $BUILDPLACE/etc/rc0.d
244        fi
245        if [ ! -d $BUILDPLACE/etc/rc1.d ]; then
246                mkdir $BUILDPLACE/etc/rc1.d
247        fi
248        if [ ! -d $BUILDPLACE/etc/rc6.d ]; then
249                mkdir $BUILDPLACE/etc/rc6.d
250        fi
251}
252
253provide_var_lib_x11 ()
254{
255        if [ ! -d $BUILDPLACE/var/lib/x11 ]; then
256                mkdir -p $BUILDPLACE/var/lib/x11
257        fi
258}
259
260basic_group_setup () {
261        if [ ! -f $BUILDPLACE/etc/group ]; then
262                echo \
263"root:x:0:
264daemon:x:1:
265bin:x:2:
266sys:x:3:
267adm:x:4:
268tty:x:5:
269disk:x:6:
270lp:x:7:
271mail:x:8:
272news:x:9:
273uucp:x:10:
274man:x:12:
275proxy:x:13:
276kmem:x:15:
277audio:x:29:
278utmp:x:43:
279video:x:44:
280" > $BUILDPLACE/etc/group
281        fi
282}
283
284basic_passwd_setup () {
285        if [ ! -f $BUILDPLACE/etc/passwd ]; then
286                echo \
287"root:x:0:0:root:/root:/bin/sh
288daemon:x:1:1:daemon:/usr/sbin:/bin/sh
289bin:x:2:2:bin:/bin:/bin/sh
290sys:x:3:3:sys:/dev:/bin/sh
291sync:x:4:65534:sync:/bin:/bin/sync
292games:x:5:60:games:/usr/games:/bin/sh
293man:x:6:12:man:/var/cache/man:/bin/sh
294lp:x:7:7:lp:/var/spool/lpd:/bin/sh
295mail:x:8:8:mail:/var/mail:/bin/sh
296news:x:9:9:news:/var/spool/news:/bin/sh
297uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
298proxy:x:13:13:proxy:/bin:/bin/sh
299www-data:x:33:33:www-data:/var/www:/bin/sh
300backup:x:34:34:backup:/var/backups:/bin/sh
301list:x:38:38:Mailing List Manager:/var/list:/bin/sh
302irc:x:39:39:ircd:/var/run/ircd:/bin/sh
303gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
304nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
305" > $BUILDPLACE/etc/passwd
306        fi
307}
308
309# need /etc/shadow too
310basic_shadow_setup () {
311        if [ ! -f $BUILDPLACE/etc/shadow ]; then
312                echo \
313"root:$1$Vu4M34LT$0L2BfH9nXbSG1zQWxUH8M1:0::::::
314daemon:*:13896:0:99999:7:::
315bin:*:0:0:99999:7:::
316sys:*:0:0:99999:7:::
317sync:*:0:0:99999:7:::
318games:*:0:0:99999:7:::
319man:*:0:0:99999:7:::
320lp:*:0:0:99999:7:::
321mail:*:0:0:99999:7:::
322news:*:0:0:99999:7:::
323uucp:*:0:0:99999:7:::
324proxy:*:0:0:99999:7:::
325www-data:*:0:0:99999:7:::
326backup:*:0:0:99999:7:::
327list:*:0:0:99999:7:::
328irc:*:0:0:99999:7:::
329gnats:*:0:0:99999:7:::
330nobody:*:0:0:99999:7:::" > $BUILDPLACE/etc/shadow
331        fi
332}
333
334provide_empty_install_info () {
335        if [ ! -f $BUILDPLACE/usr/sbin/install-info ]; then
336        echo \
337'#!/bin/sh
338exec /etc/init.d/$1 $2
339' > $BUILDPLACE/usr/sbin/install-info
340        chmod 755 $BUILDPLACE/usr/sbin/install-info
341        fi
342}
343
344set_approx_time () {
345        if [ -d $BUILDPLACE/bin ]; then
346                DATE=`date`
347                ZERO=`date -d@0`
348                # if we have a usable date, store it.
349                if [ "$DATE" != "$ZERO" ]; then
350                        APPROX=`stat -c%Y $BUILDPLACE/bin/`
351                        STR=`date -d@$APPROX +%m%d%H%M%Y`
352                        info INSTCORE "Storing approximate time '$STR' in './datestring'"
353                        echo "$STR" > $BUILDPLACE/datestring
354                fi
355        fi
356}
357
358basic_etc_fstab () {
359        if [ ! -f "$BUILDPLACE/etc/fstab" ]; then
360                cat > $BUILDPLACE/etc/fstab << 'EOF'
361# /etc/fstab: static file system information.
362#
363# <file system> <mount point>   <type>  <options>       <dump>  <pass>
364proc            /proc           proc    defaults        0       0
365sysfs           /sys            sysfs   defaults        0       0
366devpts          /dev/pts        devpts  mode=0620,gid=5 0       0
367EOF
368                chown 0.0 "$BUILDPLACE/etc/fstab";
369                chmod 0644 "$BUILDPLACE/etc/fstab"
370        fi
371}
372
373make_dpkg_dirs () {
374        mkdir -p "$BUILDPLACE/var/lib/dpkg"
375        : >"$BUILDPLACE/var/lib/dpkg/status"
376        echo >"$BUILDPLACE/var/lib/dpkg/available"
377}
378
379x_feign_install () {
380        local pkg="$1"
381        local deb="$(debfor $pkg)"
382        local ver="$(
383                ar -p "$BUILDPLACE/$deb" control.tar.gz | zcat |
384                        tar -O -xf - control ./control 2>/dev/null |
385                        sed -ne 's/^Version: *//Ip' | head -n 1
386                )"
387        mkdir -p "$BUILDPLACE/var/lib/dpkg/info"
388        echo \
389"Package: $pkg
390Version: $ver
391Status: install ok installed" >> "$BUILDPLACE/var/lib/dpkg/status"
392        touch "$BUILDPLACE/var/lib/dpkg/info/${pkg}.list"
393}
394
395prepare_proc () {
396        if [ ! -d $BUILDPLACE/proc ]; then
397                mkdir -p $BUILDPLACE/proc
398        fi
399        if [ ! -d $BUILDPLACE/sys ]; then
400                mkdir -p $BUILDPLACE/sys
401        fi
402}
403
404prepare_var () {
405        if [ ! -d $BUILDPLACE/var/log ]; then
406                mkdir -p $BUILDPLACE/var/log
407        fi
408        if [ ! -d $BUILDPLACE/var/spool ]; then
409                mkdir -p $BUILDPLACE/var/spool
410        fi
411}
412
413busybox_inittab () {
414        if [ ! -e "$BUILDPLACE/etc/inittab" ]; then
415                info INSTCORE "Adding default busybox inittab"
416                cat > $BUILDPLACE/etc/inittab << 'EOF'
417# /etc/inittab
418#
419# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
420#
421# Note: BusyBox init doesn't support runlevels.
422
423# Startup the system
424null::sysinit:/bin/mount -o remount,rw /
425null::sysinit:/bin/mount -t proc proc /proc
426null::sysinit:/bin/mount -t sysfs sysfs /sys
427null::sysinit:/bin/mount -t devpts devpts /dev/pts
428null::sysinit:/bin/mount -a
429null::sysinit:/bin/hostname -F /etc/hostname
430null::sysinit:/sbin/ifconfig lo 127.0.0.1 up
431null::sysinit:/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
432# now run any rc scripts and then login
433::sysinit:/etc/init.d/rcS
434
435# Set up a couple of getty's
436tty1::respawn:/sbin/getty 38400 tty1
437tty2::respawn:/sbin/getty 38400 tty2
438
439# Put a getty on the serial port
440#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
441ttyS2::respawn:/sbin/getty -L ttyS2 115200 vt100
442
443# Logging junk
444null::sysinit:/bin/touch /var/log/messages
445null::respawn:/sbin/syslogd -n -m 0
446null::respawn:/sbin/klogd -n
447tty3::respawn:/usr/bin/tail -f /var/log/messages
448
449# Stuff to do for the 3-finger salute
450::ctrlaltdel:/sbin/reboot
451
452# Stuff to do before rebooting
453null::shutdown:/usr/bin/killall klogd
454null::shutdown:/usr/bin/killall syslogd
455null::shutdown:/bin/umount -a -r
456null::shutdown:/sbin/swapoff -a
457
458EOF
459        fi
460}
461
462busybox_rcS () {
463        if [ ! -d "$BUILDPLACE/etc/default" ]; then
464                mkdir -p $BUILDPLACE/etc/default
465        fi
466        if [ ! -d "$BUILDPLACE/etc/rc.d" ]; then
467                mkdir -p $BUILDPLACE/etc/rc.d
468        fi
469        if [ ! -f "$BUILDPLACE/etc/default/rcS" ]; then
470                echo "#!/bin/sh" > $BUILDPLACE/etc/default/rcS
471                echo >> $BUILDPLACE/etc/default/rcS
472                chown 0.0 "$BUILDPLACE/etc/default/rcS"
473                chmod 644 "$BUILDPLACE/etc/default/rcS"
474        fi
475        # derived from the buildroot version.
476        if [ ! -e "$BUILDPLACE/etc/init.d/rcS" ]; then
477                info INSTCORE "Adding default busybox rcS"
478                cat  > $BUILDPLACE/etc/init.d/rcS << 'EOF'
479#!/bin/sh
480set -e
481# Start all init scripts in /etc/rc.d/
482#
483if [ ! -z "$SPAWNED" ]; then
484        /bin/login
485fi
486SPAWNED="$SPAWNED ."
487export SPAWNED=\$SPAWNED
488for i in /etc/rc.d/S??* ;do
489        # Ignore dangling symlinks (if any).
490        [ ! -f "$i" ] && continue
491        case "$i" in
492        *.sh)
493                # Source shell script for speed.
494                (
495                trap - INT QUIT TSTP
496                set start
497                . $i
498                )
499                ;;
500        *)
501                # No sh extension, so fork subprocess.
502                $i start
503                ;;
504        esac
505done
506EOF
507        chown 0.0 "$BUILDPLACE/etc/init.d/rcS"
508        chmod 0755 "$BUILDPLACE/etc/init.d/rcS"
509        fi
510}
511
512# call repeatedly to create init symlinks.
513# arg1 is the file in $BUILDPLACE/etc/init.d/
514# arg2 is the number for the link in the init sequence
515# where 'foo 20' runs after 'bar 10' etc.
516symlink_rcS () {
517        local file="$1"
518        local num="$2"
519        linkname="S$num$file"
520        if [ ! -d "$BUILDPLACE/etc/rc.d/" ]; then
521                mkdir $BUILDPLACE/etc/rc.d
522        fi
523        if [ -f $BUILDPLACE/etc/init.d/$file ]; then
524                ln -sf ../init.d/$file $BUILDPLACE/etc/rc.d/$linkname
525        fi
526}
527
528symlink_rcK () {
529        local file="$1"
530        local num="$2"
531        linkname="K$num$file"
532        if [ ! -d "$BUILDPLACE/etc/rc.d/" ]; then
533                mkdir $BUILDPLACE/etc/rc.d
534        fi
535        if [ -f $BUILDPLACE/etc/init.d/$file ]; then
536                ln -sf ../init.d/$file $BUILDPLACE/etc/rc.d/$linkname
537        fi
538}
539
540basic_etc_profile () {
541        if [ ! -e "$BUILDPLACE/etc/profile" ]; then
542                info INSTCORE "Adding a basic /etc/profile file"
543                cat  > $BUILDPLACE/etc/profile << 'EOF'
544if [ "`id -u`" -eq 0 ]; then
545  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games/"
546else
547  PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
548fi
549
550if [ "$PS1" ]; then
551    if [ "`id -u`" -eq 0 ]; then
552      PS1='# '
553    else
554      PS1='$ '
555    fi
556fi
557
558export PATH
559export DISPLAY=:0
560umask 022
561
562EOF
563        fi
564}
565
566set_cdebconf_default () {
567        info INSTCORE "Setting cdebconf as default."
568        echo "export DEBCONF_USE_CDEBCONF=true" >> $BUILDPLACE/etc/profile
569}
570
571set_tslib_pointercal () {
572        info INSTCORE "Setting location of tslib calibration file."
573        echo "export TSLIB_CALIBFILE=/etc/pointercal" >> $BUILDPLACE/etc/profile
574}
575
576# this function is coded to match the sample_xorg_conf
577# some devices might use /dev/input/event1 or event2
578set_tslib_tsdevice () {
579        info INSTCORE "Setting location of tslib touchscreen device."
580        echo "export TSLIB_TSDEVICE=/dev/input/event0" >> $BUILDPLACE/etc/profile
581}
582
583sample_xorg_conf () {
584        if [ ! -e "$BUILDPLACE/etc/X11/xorg.conf" ]; then
585                info INSTCORE "Adding sample xorg.conf"
586                cat > $BUILDPLACE/etc/X11/xorg.conf << 'EOF'
587# You probably want to change at least some of these
588# lines and provide it via machine:variant customisations.
589# This one comes from balloon3-config.
590Section "Files"
591        FontPath        "/usr/share/fonts/truetype/ttf-bitstream-vera/"
592EndSection
593
594Section "InputDevice"
595        Identifier      "Generic Keyboard"
596        Driver          "kbd"
597EndSection
598
599# /dev/input/event0 is kernel-module specific.
600# You may need to change this.
601Section "InputDevice"
602        Identifier "Touchscreen"
603        Driver "tslib"
604        Option "ScreenNumber"  "0"
605        Option "Width"         "0"
606        Option "Height"        "0"
607        Option "Rotate"        "NONE"
608        Option "TslibDevice"   "/dev/input/event0"
609EndSection
610
611Section "Device"
612        Identifier      "Generic Video Card"
613        Driver          "fbdev"
614        Option          "UseFBDev"              "true"
615EndSection
616
617Section "Monitor"
618        Identifier      "Configured Monitor"
619EndSection
620
621Section "ServerLayout"
622        Identifier      "Default Layout"
623        Screen          "Default Screen"
624        InputDevice     "Touchscreen"
625EndSection
626
627Section "Screen"
628       Identifier      "Default Screen"
629       Monitor         "Configured Monitor"
630EndSection
631
632EOF
633        fi
634}
635
636shell_update_rcd () {
637        if [ ! -e "$BUILDPLACE/usr/sbin/update-rc.d" ]; then
638                info INSTCORE "Adding a /usr/sbin/update-rc.d shell script"
639                cp /usr/share/emdebian-tools/update-rc.d $BUILDPLACE/usr/sbin/
640                chmod 0755 $BUILDPLACE/usr/sbin/update-rc.d
641        fi
642}
Note: See TracBrowser for help on using the browser.