source: live-build/trunk/fuentes/debian/patches/add-chroot-early @ 900

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

add original source

File size: 2.3 KB
Line 
1Adds a new chroot_early hook type allowing actions prior to package
2installation. This is required by Ubuntu Touch and possibly other
3system-image type images where we want to force a pre-defined user/group
4sets.
5
6--- live-build-3.0~a57.orig/scripts/build/lb_chroot
7+++ live-build-3.0~a57/scripts/build/lb_chroot
8@@ -54,6 +54,7 @@ lb chroot_archives chroot install ${*}
9 # Customizing chroot
10 lb chroot_linux-image ${*}
11 lb chroot_preseed ${*}
12+lb chroot_early_hooks ${*}
13 
14 for _PASS in install live
15 do
16--- /dev/null
17+++ live-build-3.0~a57/scripts/build/lb_chroot_early_hooks
18@@ -0,0 +1,70 @@
19+#!/bin/sh
20+
21+## live-build(7) - System Build Scripts
22+## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
23+##
24+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
25+## This is free software, and you are welcome to redistribute it
26+## under certain conditions; see COPYING for details.
27+
28+
29+set -e
30+
31+# Including common functions
32+( . "${LIVE_BUILD}/scripts/build.sh" > /dev/null 2>&1 || true ) || . /usr/lib/live/build.sh
33+
34+# Setting static variables
35+DESCRIPTION="$(Echo 'execute hooks in chroot (early stage)')"
36+HELP=""
37+USAGE="${PROGRAM} [--force]"
38+
39+Arguments "${@}"
40+
41+# Reading configuration files
42+Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
43+Set_defaults
44+
45+Echo_message "Begin executing early chroot hooks..."
46+
47+# Requiring stage file
48+Require_stagefile .build/config .build/bootstrap
49+
50+# Checking stage file
51+Check_stagefile .build/chroot_early_hooks
52+
53+# Checking lock file
54+Check_lockfile .lock
55+
56+# Creating lock file
57+Create_lockfile .lock
58+
59+## Processing local hooks
60+if Find_files config/hooks/*.chroot_early
61+then
62+       # Restoring cache
63+       Restore_cache cache/packages.chroot
64+
65+       for _HOOK in config/hooks/*.chroot_early
66+       do
67+               # Copying hook
68+               cp "${_HOOK}" chroot/root
69+
70+               # Making hook executable
71+               if [ ! -x chroot/root/"$(basename ${_HOOK})" ]
72+               then
73+                       chmod +x chroot/root/"$(basename ${_HOOK})"
74+               fi
75+
76+               # Executing hook
77+               Chroot chroot "/root/$(basename ${_HOOK})" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
78+
79+               # Removing hook
80+               rm -f chroot/root/"$(basename ${_HOOK})"
81+       done
82+
83+       # Saving cache
84+       Save_cache cache/packages.chroot
85+
86+       # Creating stage file
87+       Create_stagefile .build/chroot_early_hooks
88+fi
Note: See TracBrowser for help on using the repository browser.