source: live-build/trunk/fuentes/scripts/build/lb_source_debian @ 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.1 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 'debian sources')"
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
27if [ "${LB_SOURCE}" != "true" ]
28then
29        exit 0
30fi
31
32Echo_message "Begin downloading sources..."
33
34# Requiring stage file
35Require_stagefile .build/config .build/bootstrap
36
37# Checking stage file
38Check_stagefile .build/source_debian
39
40# Checking lock file
41Check_lockfile .lock
42
43# Creating lock file
44Create_lockfile .lock
45
46# Remove old sources
47if [ -d source/debian ]
48then
49        rm -rf source/debian
50fi
51
52# Download sources
53Chroot chroot "dpkg --get-selections" | awk '{ print $1 }' > source-selection.txt
54
55cat >> source-selection.txt << EOF
56${LB_BOOTLOADER}
57live-build
58genisoimage
59parted
60squashfs-tools
61mtd-tools
62EOF
63
64case "${LB_BINARY_FILESYSTEM}" in
65        fat*)
66                echo "dosfstools" >> source-selection.txt
67                ;;
68
69        ntfs)
70                case "${LB_PARENT_DISTRIBUTION}" in
71                        squeeze)
72                                echo "ntfsprogs" >> source-selection.txt
73                                ;;
74
75                        *)
76                                echo "ntfs-3g" >> source-selection.txt
77                                ;;
78                esac
79                ;;
80esac
81
82case "${LB_ARCHITECTURES}" in
83        amd64|i386)
84
85cat >> source-selection.txt << EOF
86mtools
87syslinux
88grub
89EOF
90
91                if [ "${LB_MEMTEST}" != "false" ] && [ "${LB_MEMTEST}" != "none" ]
92                then
93                        echo "${LB_MEMTEST}" >> source-selection.txt
94                fi
95                ;;
96
97        powerpc)
98                echo "yaboot" >> source-selection.txt
99                ;;
100
101        sparc)
102
103cat >> source-selection.txt << EOF
104silo
105sparc-utils
106EOF
107
108                ;;
109esac
110
111if [ -n "${LB_TASKS}" ]
112then
113        echo "${LB_TASKSEL}" >> source-selection.txt
114fi
115
116MISSING=""
117
118grep . source-selection.txt | \
119while read PACKAGE
120do
121        if ! Chroot chroot "apt-get ${APT_OPTIONS} --download-only source ${PACKAGE}"
122        then
123                MISSING="${MISSING} ${PACKAGE}"
124        fi
125done
126
127if [ -n "${MISSING}" ]
128then
129        cat > source/missing-source.txt << EOF
130This file contains the list of binary packages that are installed on this live
131system that do not have a corresponding source package.
132
133EOF
134
135        for PACKAGE in ${MISSING}
136        do
137                Chroot chroot "dpkg -l ${PACKAGE}" | tail -n1 >> source/missing-source.txt
138        done
139fi
140
141rm -f source-selection.txt
142
143# Sort sources
144for DSC in chroot/*.dsc
145do
146        SOURCE="$(sed -n 's|^Source: ||p' ${DSC} 2>/dev/null || :)"
147        # The sed may fail if multiple dsc files exist for same source, as the
148        # first one to match will have already been moved.
149        [ -n "$SOURCE" ] || continue
150
151        case "${SOURCE}" in
152                lib?*)
153                        LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')"
154                        ;;
155
156                *)
157                        LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')"
158                        ;;
159        esac
160
161        # Install directory
162        mkdir -p source/debian/"${LETTER}"/"${SOURCE}"
163
164        # Move files
165        mv chroot/"${SOURCE}"_* source/debian/"${LETTER}"/"${SOURCE}"
166done
167
168# Creating stage file
169Create_stagefile .build/source_debian
Note: See TracBrowser for help on using the repository browser.