source: live-build/trunk/fuentes/scripts/build/lb_chroot_linux-image @ 900

Last change on this file since 900 was 900, checked in by kbut, 4 years ago

add original source

  • Property svn:executable set to *
File size: 3.9 KB
Line 
1#!/bin/sh
2
3## live-build(7) - System Build Scripts
4## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
5##
6## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7## This is free software, and you are welcome to redistribute it
8## under certain conditions; see COPYING for details.
9
10
11set -e
12
13# Including common functions
14( . "${LIVE_BUILD}/scripts/build.sh" > /dev/null 2>&1 || true ) || . /usr/lib/live/build.sh
15
16# Setting static variables
17DESCRIPTION="$(Echo 'schedule kernel packages for installation')"
18HELP=""
19USAGE="${PROGRAM} [--force]"
20
21Arguments "${@}"
22
23# Reading configuration files
24Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25Set_defaults
26
27# Requiring stage file
28Require_stagefile .build/config .build/bootstrap
29
30# Checking stage file
31Check_stagefile .build/chroot_linux-image
32
33# Checking lock file
34Check_lockfile .lock
35
36# Creating lock file
37Create_lockfile .lock
38
39# Diverting update-initramfs
40#case "${LB_INITRAMFS}" in
41#       live-boot)
42#               mv chroot/usr/sbin/update-initramfs chroot/usr/sbin/update-initramfs.live-build
43#               ;;
44#esac
45
46if [ "${LB_LINUX_PACKAGES}" != "none" ]
47then
48        for FLAVOUR in ${LB_LINUX_FLAVOURS}
49        do
50                for PACKAGE in ${LB_LINUX_PACKAGES}
51                do
52                        echo ${PACKAGE}-${FLAVOUR} >> chroot/root/packages.chroot
53                done
54        done
55
56        # Include firmware packages
57        if [ "${LB_FIRMWARE_CHROOT}" = "true" ]
58        then
59                # Assumption: firmware packages install files into /lib/firmware
60
61                # Get all firmware packages names
62                mkdir -p cache/contents.chroot
63                wget ${WGET_OPTIONS} ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c > cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES}
64
65                FIRMWARE_PACKAGES=""
66                FIRMWARE_PACKAGES="$(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)"
67
68                if [ "${LB_DERIVATIVE}" = "true" ]
69                then
70                        wget {WGET_OPTIONS} ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c > cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES}
71
72                        FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)"
73                fi
74
75                # Filter out contrib packages if contrib is not enabled
76                if ! echo ${LB_ARCHIVE_AREAS} | grep -qs contrib
77                then
78                        _FIRMWARE_PACKAGES=""
79
80                        for _PACKAGE in ${FIRMWARE_PACKAGES}
81                        do
82                                _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | sed -e 's|^contrib/.*$||')"
83                        done
84
85                        FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}"
86                fi
87
88                # Filter out non-free packages if non-free is not enabled
89                if ! echo ${LB_ARCHIVE_AREAS} | grep -qs non-free
90                then
91                        _FIRMWARE_PACKAGES=""
92
93                        for _PACKAGE in ${FIRMWARE_PACKAGES}
94                        do
95                                _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | sed -e 's|^non-free/.*$||')"
96                        done
97
98                        FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}"
99                else
100                        # Manually add firmware-linux/non-free meta package
101                        FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} firmware-linux"
102
103                        # Manually add intel-microcode
104                        FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} intel-microcode"
105                fi
106
107                # Drop section and keep package names only
108                for _PACKAGE in ${FIRMWARE_PACKAGES}
109                do
110                        echo $(echo ${_PACKAGE} | awk -F/ '{ print $NF }') >> chroot/root/packages.chroot
111                done
112
113# Some known licenses required to be accepted
114cat >> chroot/root/packages.chroot.cfg << EOF
115firmware-ivtv firmware-ivtv/license/accepted boolean true
116firmware-ipw2x00 firmware-ipw2x00/license/accepted boolean true
117EOF
118
119        fi
120
121        cat > chroot/etc/kernel-img.conf << EOF
122# Kernel Image management overrides
123# See kernel-img.conf(5) for details
124do_symlinks = yes
125do_bootloader = no
126EOF
127
128        case "${LB_ARCHITECTURES}" in
129                alpha|amd64|hppa|i386|ia64|m68k|mips|mipsel)
130                        ;;
131
132                *)
133                        cat >> chroot/etc/kernel-img.conf << EOF
134link_in_boot = yes
135EOF
136                        ;;
137        esac
138
139        # Creating stage file
140        Create_stagefile .build/chroot_linux-image
141fi
Note: See TracBrowser for help on using the repository browser.