* updated libkcddb (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / target / share / livecd / build_image.sh
blobd0e059d984c3a36bcbe09352a5389eb0e8a64b6c
1 #!/bin/bash
2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 #
5 # T2 SDE: target/share/livecd/build_image.sh
6 # Copyright (C) 2004 - 2010 The T2 SDE Project
7 #
8 # More information can be found in the files COPYING and README.
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 . $base/misc/target/functions.in
18 set -e
20 mkdir -p $imagelocation ; cd $imagelocation
21 # just in case it is still there from the last run
22 (umount proc ; umount dev) 2>/dev/null || true
24 echo "Creating root file-system file lists ..."
25 f=" $pkg_filter "
26 for pkg in `grep '^X ' $base/config/$config/packages | cut -d ' ' -f 5`; do
27 # include the package?
28 if [ "${f/ $pkg /}" == "$f" ] ; then
29 cut -d ' ' -f 2 $build_root/var/adm/flists/$pkg || true
31 done > ../files-wanted
32 unset f
33 [ "$filter_hook" ] && "$filter_hook" ../files-wanted
34 sort -u ../files-wanted > x ; mv -f x ../files-wanted
36 # for rsync with --delete we can not use file lists, since rsync does not
37 # delete in that mode - instead we need to generate a negative list
39 time find $build_root -mount -wholename $build_root/TOOLCHAIN -prune -o -printf '%P\n' |
40 sort -u > ../files-all
41 # the difference
42 diff -u ../files-all ../files-wanted |
43 sed -n -e '/var\/adm\/olist/d' -e '/var\/adm\/logs/d' \
44 -e '/var\/adm\/dep-debug/d' -e '/var\/adm\/cache/d' -e 's/^-//p' > ../files-exclude
45 echo "TOOLCHAIN
46 proc/*
47 dev/*
48 */share/doc/*
49 var/adm/olist
50 var/adm/logs
51 var/adm/dep-debug
52 var/adm/cache" >> ../files-exclude
54 echo "Syncing root file-system (this may take some time) ..."
55 [ -e $imagelocation/bin ] && v="-v" || v=""
56 time rsync -artH $v --devices --specials --delete --delete-excluded \
57 --exclude-from ../files-exclude $build_root/ $imagelocation/
58 rm ../files-{wanted,all,exclude}
60 # avoid duplicate files on the medium and initrd anyway
61 find $isofsdir/boot -type f | while read f; do
62 rm -f ./${f#$isofsdir} > /dev/null
63 done
64 for initrd in $isofsdir/boot/initrd*; do
65 zcat $initrd | cpio -i --list | grep '.ko$' |
66 while read f; do
67 rm -f ./$f > /dev/null
68 done
69 done
71 echo "Overlaying root file-system with target defined files ..."
72 copy_and_parse_from_source $base/target/share/livecd/rootfs $imagelocation
73 copy_and_parse_from_source $base/target/$target/rootfs $imagelocation
75 [ "$inject_hook" ] && "$inject_hook"
77 echo "Running ldconfig and other postinstall scripts ..."
78 mount /dev dev --bind
79 mount none proc -t proc
80 for x in sbin/ldconfig etc/postinstall.d/*; do
81 case $x in
82 */scrollkeeper) echo "$x left out" ;;
83 *) chroot . /bin/sh -c ". /etc/profile; /$x" && true ;;
84 esac
85 done
86 umount proc
87 umount dev
89 echo "Squashing root file-system (this may take some time) ..."
90 time mksquashfs * $isofsdir/live.squash -noappend -no-progress -no-exports
91 du -sh $isofsdir/live.squash