source: live-build/trunk/fuentes/scripts/build/lb_chroot_early_hooks @ 900

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

add original source

File size: 1.7 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 'execute hooks in chroot (early stage)')"
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
27Echo_message "Begin executing early chroot hooks..."
28
29# Requiring stage file
30Require_stagefile .build/config .build/bootstrap
31
32# Checking stage file
33Check_stagefile .build/chroot_early_hooks
34
35# Checking lock file
36Check_lockfile .lock
37
38# Creating lock file
39Create_lockfile .lock
40
41## Processing local hooks
42if Find_files config/hooks/*.chroot_early
43then
44        # Restoring cache
45        Restore_cache cache/packages.chroot
46
47        for _HOOK in config/hooks/*.chroot_early
48        do
49                # Copying hook
50                cp "${_HOOK}" chroot/root
51
52                # Making hook executable
53                if [ ! -x chroot/root/"$(basename ${_HOOK})" ]
54                then
55                        chmod +x chroot/root/"$(basename ${_HOOK})"
56                fi
57
58                # Executing hook
59                Chroot chroot "/root/$(basename ${_HOOK})" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
60
61                # Removing hook
62                rm -f chroot/root/"$(basename ${_HOOK})"
63        done
64
65        # Saving cache
66        Save_cache cache/packages.chroot
67
68        # Creating stage file
69        Create_stagefile .build/chroot_early_hooks
70fi
Note: See TracBrowser for help on using the repository browser.