source: live-build/trunk/fuentes/scripts/build/lb_source_checksums @ 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: 2.0 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 'create source checksums')"
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_CHECKSUMS}" = "none" ] || [ "${LB_SOURCE}" != "true" ]
28then
29        exit 0
30fi
31
32# Requiring stage file
33Require_stagefile .build/config .build/source_debian
34
35# Checking stage file
36Check_stagefile .build/source_checksums
37
38# Checking lock file
39Check_lockfile .lock
40
41# Creating lock file
42Create_lockfile .lock
43
44for DIRECTORY in source/debian source/debian-live
45do
46        if [ ! -d ${DIRECTORY} ]
47        then
48                continue
49        fi
50
51        for CHECKSUM in ${LB_CHECKSUMS}
52        do
53                CHECKSUMS="$(echo ${CHECKSUM} | tr [a-z] [A-Z])SUMS"
54
55                Echo_message "Begin creating source ${CHECKSUMS}..."
56
57                # Remove old checksums
58                if [ -f ${DIRECTORY}/${CHECKSUMS} ]
59                then
60                        rm -f ${DIRECTORY}/${CHECKSUMS}
61                fi
62
63                # Calculating checksums
64                cd ${DIRECTORY}
65                find . -type f \
66                        \! -path './*SUMS' \
67                -print0 | sort -z | xargs -0 ${CHECKSUM}sum > ../${CHECKSUMS}
68
69cat > ${CHECKSUMS} << EOF
70This file contains the list of ${CHECKSUM} checksums of all files on this medium.
71
72You can verify them automatically with the 'integrity-check' boot parameter,
73or, manually with: '${CHECKSUM}sum -c ${CHECKSUMS}'.
74
75
76EOF
77
78                cat ../${CHECKSUMS} >> ${CHECKSUMS}
79                rm -f ../${CHECKSUMS}
80
81                cd "${OLDPWD}"
82        done
83
84        # File list
85        cd ${DIRECTORY}
86        find . | sed -e 's|^.||g' | grep "^/" | sort > ../../$(echo ${DIRECTORY} | sed -e 's|/|.|').list
87        cd "${OLDPWD}"
88done
89
90# Creating stage file
91Create_stagefile .build/source_checksums
Note: See TracBrowser for help on using the repository browser.