@@ -5,7 +5,7 | |||||
5 | ## Build dependencies |
|
5 | ## Build dependencies | |
6 | The following list of Debian packages must be installed on the build system because they are essentially required for the bootstrapping process. The script will check if all required packages are installed and missing packages will be installed automatically if confirmed by the user. |
|
6 | The following list of Debian packages must be installed on the build system because they are essentially required for the bootstrapping process. The script will check if all required packages are installed and missing packages will be installed automatically if confirmed by the user. | |
7 |
|
7 | |||
8 | ```debootstrap debian-archive-keyring qemu-user-static dosfstools rsync bmap-tools whois git-core``` |
|
8 | ```debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core``` | |
9 |
|
9 | |||
10 | ## Command-line parameters |
|
10 | ## Command-line parameters | |
11 | The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi2-gen-image.sh` script via (simple) shell-variables. Unlike environment shell-variables (simple) shell-variables are defined at the beginning of the command-line call of the `rpi2-gen-image.sh` script. |
|
11 | The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi2-gen-image.sh` script via (simple) shell-variables. Unlike environment shell-variables (simple) shell-variables are defined at the beginning of the command-line call of the `rpi2-gen-image.sh` script. | |
@@ -19,6 +19,7 ENABLE_HARDNET=true ENABLE_IPTABLES=true /rpi2-gen-image.sh | |||||
19 | APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi2-gen-image.sh |
|
19 | APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi2-gen-image.sh | |
20 | ENABLE_MINBASE=true ./rpi2-gen-image.sh |
|
20 | ENABLE_MINBASE=true ./rpi2-gen-image.sh | |
21 | BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi2-gen-image.sh |
|
21 | BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi2-gen-image.sh | |
|
22 | BUILD_KERNEL=true KERNEL_SRCDIR=/tmp/linux ./rpi2-gen-image.sh | |||
22 | ``` |
|
23 | ``` | |
23 |
|
24 | |||
24 | #### APT settings: |
|
25 | #### APT settings: | |
@@ -158,7 +159,10 Path to a directory with scripts that should be run in the chroot before the ima | |||||
158 |
|
159 | |||
159 | #### Kernel compilation: |
|
160 | #### Kernel compilation: | |
160 | ##### `BUILD_KERNEL`=false |
|
161 | ##### `BUILD_KERNEL`=false | |
161 |
Build and install the latest RPi2 |
|
162 | Build and install the latest RPi2 Linux kernel. Currently only the default RPi2 kernel configuration is used. Detailed configuration parameters for customizing the kernel and minor bug fixes still need to get implemented. feel free to help. | |
|
163 | ||||
|
164 | ##### `KERNEL_SRCDIR`="" | |||
|
165 | Path to a directory of [RaspberryPi Linux kernel] sources (https://github.com/raspberrypi/linux) that will be copied, configured, build and installed inside the chroot. | |||
162 |
|
166 | |||
163 | ##### `KERNEL_THREADS`=1 |
|
167 | ##### `KERNEL_THREADS`=1 | |
164 | Number of parallel kernel building threads. If the parameter is left untouched the script will automatically determine the number of CPU cores to set the number of parallel threads to speed the kernel compilation. |
|
168 | Number of parallel kernel building threads. If the parameter is left untouched the script will automatically determine the number of CPU cores to set the number of parallel threads to speed the kernel compilation. | |
@@ -169,8 +173,14 Install kernel headers with built kernel. | |||||
169 | ##### `KERNEL_MENUCONFIG`=false |
|
173 | ##### `KERNEL_MENUCONFIG`=false | |
170 | Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated. |
|
174 | Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated. | |
171 |
|
175 | |||
|
176 | ##### `KERNEL_CONFIGSRC`=true | |||
|
177 | Run `make bcm2709_defconfig` (and optional `make menuconfig`) to configure the kernel sources before building. This setting is automatically set to `true` if no existing kernel sources directory was specified using `KERNEL_SRCDIR`. | |||
|
178 | ||||
|
179 | ##### `KERNEL_CLEANSRC`=false | |||
|
180 | Clean the existing kernel sources directory `KERNEL_SRCDIR` (using `make mrproper`) after it was copied to the chroot and before the compilation of the kernel has started. This setting will be ignored if no `KERNEL_SRCDIR` was specified. | |||
|
181 | ||||
172 | ##### `KERNEL_RMSRC`=true |
|
182 | ##### `KERNEL_RMSRC`=true | |
173 |
Remove all kernel sources from the generated OS image after |
|
183 | Remove all kernel sources from the generated OS image after it was built and installed. | |
174 |
|
184 | |||
175 | ## Understanding the script |
|
185 | ## Understanding the script | |
176 | The functions of this script that are required for the different stages of the bootstrapping are split up into single files located inside the `bootstrap.d` directory. During the bootstrapping every script in this directory gets executed in lexicographical order: |
|
186 | The functions of this script that are required for the different stages of the bootstrapping are split up into single files located inside the `bootstrap.d` directory. During the bootstrapping every script in this directory gets executed in lexicographical order: |
@@ -27,3 +27,4 sed -i "s/ jessie/ ${RELEASE}/" $R/etc/apt/sources.list | |||||
27 | # Upgrade package index and update all installed packages and changed dependencies |
|
27 | # Upgrade package index and update all installed packages and changed dependencies | |
28 | chroot_exec apt-get -qq -y update |
|
28 | chroot_exec apt-get -qq -y update | |
29 | chroot_exec apt-get -qq -y -u dist-upgrade |
|
29 | chroot_exec apt-get -qq -y -u dist-upgrade | |
|
30 | chroot_exec apt-get -qq -y check |
@@ -7,27 +7,50 | |||||
7 |
|
7 | |||
8 | # Fetch and build latest raspberry kernel |
|
8 | # Fetch and build latest raspberry kernel | |
9 | if [ "$BUILD_KERNEL" = true ] ; then |
|
9 | if [ "$BUILD_KERNEL" = true ] ; then | |
|
10 | # Setup source directory | |||
|
11 | mkdir -p $R/usr/src | |||
|
12 | ||||
|
13 | # Copy existing kernel sources into chroot directory | |||
|
14 | if [ -n "$KERNEL_SRCDIR" ] && [ -d "$KERNEL_SRCDIR" ] ; then | |||
|
15 | # Copy kernel sources | |||
|
16 | cp -r "${KERNEL_SRCDIR}" "${R}/usr/src" | |||
|
17 | ||||
|
18 | # Clean the kernel sources | |||
|
19 | if [ "$KERNEL_CLEANSRC" = true ] ; then | |||
|
20 | make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} mrproper | |||
|
21 | fi | |||
|
22 | else # KERNEL_SRCDIR="" | |||
10 | # Fetch current raspberrypi kernel sources |
|
23 | # Fetch current raspberrypi kernel sources | |
11 | git -C $R/usr/src clone --depth=1 https://github.com/raspberrypi/linux |
|
24 | git -C $R/usr/src clone --depth=1 https://github.com/raspberrypi/linux | |
12 |
|
25 | fi | ||
13 | # Load default raspberry kernel configuration |
|
|||
14 | make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} bcm2709_defconfig |
|
|||
15 |
|
26 | |||
16 | # Calculate optimal number of kernel building threads |
|
27 | # Calculate optimal number of kernel building threads | |
17 | if [ "$KERNEL_THREADS" = 1 ] ; then |
|
28 | if [ "$KERNEL_THREADS" = "1" ] ; then | |
18 |
if [ - |
|
29 | if [ -r /proc/cpuinfo ] ; then | |
19 | KERNEL_THREADS=$(grep -c processor /proc/cpuinfo) |
|
30 | KERNEL_THREADS=$(grep -c processor /proc/cpuinfo) | |
20 | fi |
|
31 | fi | |
21 | fi |
|
32 | fi | |
22 |
|
33 | |||
|
34 | if [ "$KERNEL_CONFIGSRC" = true ] ; then | |||
|
35 | # Load default raspberry kernel configuration | |||
|
36 | make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${KERNEL_DEFCONFIG} | |||
|
37 | ||||
23 | # Start menu-driven kernel configuration (interactive) |
|
38 | # Start menu-driven kernel configuration (interactive) | |
24 | if [ "$KERNEL_MENUCONFIG" = true ] ; then |
|
39 | if [ "$KERNEL_MENUCONFIG" = true ] ; then | |
25 | make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} menuconfig |
|
40 | make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} menuconfig | |
26 | fi |
|
41 | fi | |
|
42 | fi | |||
27 |
|
43 | |||
28 | # Cross compile kernel and modules |
|
44 | # Cross compile kernel and modules | |
29 | make -C $R/usr/src/linux -j${KERNEL_THREADS} ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} zImage modules dtbs |
|
45 | make -C $R/usr/src/linux -j${KERNEL_THREADS} ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} zImage modules dtbs | |
30 |
|
46 | |||
|
47 | # Check if kernel compilation was successful | |||
|
48 | if [ ! -r $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/zImage ] ; then | |||
|
49 | echo "error: kernel compilation failed!" | |||
|
50 | cleanup | |||
|
51 | exit 1 | |||
|
52 | fi | |||
|
53 | ||||
31 | # Install kernel modules |
|
54 | # Install kernel modules | |
32 | make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} INSTALL_MOD_PATH=../../.. modules_install |
|
55 | make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} INSTALL_MOD_PATH=../../.. modules_install | |
33 |
|
56 |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -9,5 +9,5 | |||||
9 | if [ "$ENABLE_RSYSLOG" = false ]; then |
|
9 | if [ "$ENABLE_RSYSLOG" = false ] ; then | |
10 | sed -i "s|[#]*ForwardToSyslog=yes|ForwardToSyslog=no|g" $R/etc/systemd/journald.conf |
|
10 | sed -i "s|[#]*ForwardToSyslog=yes|ForwardToSyslog=no|g" $R/etc/systemd/journald.conf | |
11 | chroot_exec systemctl disable rsyslog |
|
11 | chroot_exec systemctl disable rsyslog | |
12 |
chroot_exec apt-get |
|
12 | chroot_exec apt-get -qq -y --force-yes purge rsyslog | |
13 | fi |
|
13 | fi |
@@ -7,7 +7,7 | |||||
7 |
|
7 | |||
8 | # Install gcc/c++ build environment inside the chroot |
|
8 | # Install gcc/c++ build environment inside the chroot | |
9 | if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ]; then |
|
9 | if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ] ; then | |
10 |
chroot_exec apt-get |
|
10 | chroot_exec apt-get -q -y --force-yes --no-install-recommends install linux-compiler-gcc-4.9-arm g++ make bc | |
11 | fi |
|
11 | fi | |
12 |
|
12 | |||
13 | # Fetch and build U-Boot bootloader |
|
13 | # Fetch and build U-Boot bootloader |
@@ -10,7 +10,7 if [ "$ENABLE_FBTURBO" = true ] ; then | |||||
10 | git -C $R/tmp clone https://github.com/ssvb/xf86-video-fbturbo.git |
|
10 | git -C $R/tmp clone https://github.com/ssvb/xf86-video-fbturbo.git | |
11 |
|
11 | |||
12 | # Install Xorg build dependencies |
|
12 | # Install Xorg build dependencies | |
13 |
chroot_exec apt-get |
|
13 | chroot_exec apt-get -q -y --no-install-recommends install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev | |
14 |
|
14 | |||
15 | # Build and install fbturbo driver inside chroot |
|
15 | # Build and install fbturbo driver inside chroot | |
16 | chroot_exec /bin/bash -x <<'EOF' |
|
16 | chroot_exec /bin/bash -x <<'EOF' | |
@@ -25,10 +25,10 EOF | |||||
25 | install_readonly files/xorg/99-fbturbo.conf $R/usr/share/X11/xorg.conf.d/99-fbturbo.conf |
|
25 | install_readonly files/xorg/99-fbturbo.conf $R/usr/share/X11/xorg.conf.d/99-fbturbo.conf | |
26 |
|
26 | |||
27 | # Remove Xorg build dependencies |
|
27 | # Remove Xorg build dependencies | |
28 |
chroot_exec apt-get -q -y purge |
|
28 | chroot_exec apt-get -qq -y --auto-remove purge xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev | |
29 | fi |
|
29 | fi | |
30 |
|
30 | |||
31 | # Remove gcc/c++ build environment from the chroot |
|
31 | # Remove gcc/c++ build environment from the chroot | |
32 | if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ]; then |
|
32 | if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ] ; then | |
33 |
chroot_exec apt-get -y - |
|
33 | chroot_exec apt-get -qq -y --auto-remove purge bc binutils cpp cpp-4.9 g++ g++-4.9 gcc gcc-4.9 libasan1 libatomic1 libc-dev-bin libc6-dev libcloog-isl4 libgcc-4.9-dev libgomp1 libisl10 libmpc3 libmpfr4 libstdc++-4.9-dev libubsan0 linux-compiler-gcc-4.9-arm linux-libc-dev make | |
34 | fi |
|
34 | fi |
@@ -15,6 +15,12 | |||||
15 | # Copyright (C) 2015 Luca Falavigna <dktrkranz@debian.org> |
|
15 | # Copyright (C) 2015 Luca Falavigna <dktrkranz@debian.org> | |
16 | ######################################################################## |
|
16 | ######################################################################## | |
17 |
|
17 | |||
|
18 | # Check if ./functions.sh script exists | |||
|
19 | if [ ! -r "./functions.sh" ] ; then | |||
|
20 | echo "error: './functions.sh' required script not found. please reinstall the latest script version!" | |||
|
21 | exit 1 | |||
|
22 | fi | |||
|
23 | ||||
18 | # Load utility functions |
|
24 | # Load utility functions | |
19 | . ./functions.sh |
|
25 | . ./functions.sh | |
20 |
|
26 | |||
@@ -29,6 +35,7 KERNEL_ARCH=${KERNEL_ARCH:=arm} | |||||
29 | RELEASE_ARCH=${RELEASE_ARCH:=armhf} |
|
35 | RELEASE_ARCH=${RELEASE_ARCH:=armhf} | |
30 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-} |
|
36 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-} | |
31 | COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2} |
|
37 | COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2} | |
|
38 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} | |||
32 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} |
|
39 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} | |
33 |
|
40 | |||
34 | # Build settings |
|
41 | # Build settings | |
@@ -90,9 +97,12 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false} | |||||
90 |
|
97 | |||
91 | # Kernel compilation settings |
|
98 | # Kernel compilation settings | |
92 | BUILD_KERNEL=${BUILD_KERNEL:=false} |
|
99 | BUILD_KERNEL=${BUILD_KERNEL:=false} | |
|
100 | KERNEL_SRCDIR=${KERNEL_SRCDIR:=""} | |||
93 | KERNEL_THREADS=${KERNEL_THREADS:=1} |
|
101 | KERNEL_THREADS=${KERNEL_THREADS:=1} | |
94 | KERNEL_HEADERS=${KERNEL_HEADERS:=true} |
|
102 | KERNEL_HEADERS=${KERNEL_HEADERS:=true} | |
95 | KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false} |
|
103 | KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false} | |
|
104 | KERNEL_CLEANSRC=${KERNEL_CLEANSRC:=false} | |||
|
105 | KERNEL_CONFIGSRC=${KERNEL_CONFIGSRC:=true} | |||
96 | KERNEL_RMSRC=${KERNEL_RMSRC:=true} |
|
106 | KERNEL_RMSRC=${KERNEL_RMSRC:=true} | |
97 |
|
107 | |||
98 | # Image chroot path |
|
108 | # Image chroot path | |
@@ -107,13 +117,37 MISSING_PACKAGES="" | |||||
107 |
|
117 | |||
108 | # Packages required in the chroot build environment |
|
118 | # Packages required in the chroot build environment | |
109 | APT_INCLUDES=${APT_INCLUDES:=""} |
|
119 | APT_INCLUDES=${APT_INCLUDES:=""} | |
110 | APT_INCLUDES="${APT_INCLUDES},apt-transport-https,ca-certificates,debian-archive-keyring,dialog,sudo" |
|
120 | APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo" | |
111 |
|
121 | |||
112 | set +x |
|
122 | set +x | |
113 |
|
123 | |||
114 | # Are we running as root? |
|
124 | # Are we running as root? | |
115 | if [ "$(id -u)" -ne "0" ] ; then |
|
125 | if [ "$(id -u)" -ne "0" ] ; then | |
116 | echo "this script must be executed with root privileges" |
|
126 | echo "error: this script must be executed with root privileges!" | |
|
127 | exit 1 | |||
|
128 | fi | |||
|
129 | ||||
|
130 | # Check if ./bootstrap.d directory exists | |||
|
131 | if [ ! -d "./bootstrap.d/" ] ; then | |||
|
132 | echo "error: './bootstrap.d' required directory not found. please reinstall the latest script version!" | |||
|
133 | exit 1 | |||
|
134 | fi | |||
|
135 | ||||
|
136 | # Check if ./files directory exists | |||
|
137 | if [ ! -d "./files/" ] ; then | |||
|
138 | echo "error: './files' required directory not found. please reinstall the latest script version!" | |||
|
139 | exit 1 | |||
|
140 | fi | |||
|
141 | ||||
|
142 | # Check if specified KERNEL_SRCDIR directory exists | |||
|
143 | if [ -n "$KERNEL_SRCDIR" ] && [ ! -d "$KERNEL_SRCDIR" ] ; then | |||
|
144 | echo "error: ${KERNEL_SRCDIR} (KERNEL_SRCDIR) specified directory not found!" | |||
|
145 | exit 1 | |||
|
146 | fi | |||
|
147 | ||||
|
148 | # Check if specified CHROOT_SCRIPTS directory exists | |||
|
149 | if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then | |||
|
150 | echo "error: ${CHROOT_SCRIPTS} (CHROOT_SCRIPTS) specified directory not found!" | |||
117 | exit 1 |
|
151 | exit 1 | |
118 | fi |
|
152 | fi | |
119 |
|
153 | |||
@@ -149,10 +183,21 apt-get -qq -y install ${REQUIRED_PACKAGES} | |||||
149 |
|
183 | |||
150 | # Don't clobber an old build |
|
184 | # Don't clobber an old build | |
151 | if [ -e "$BUILDDIR" ]; then |
|
185 | if [ -e "$BUILDDIR" ] ; then | |
152 | echo "directory $BUILDDIR already exists, not proceeding" |
|
186 | echo "error: directory ${BUILDDIR} already exists, not proceeding" | |
153 | exit 1 |
|
187 | exit 1 | |
154 | fi |
|
188 | fi | |
155 |
|
189 | |||
|
190 | # Check if build directory has enough of free disk space >512MB | |||
|
191 | if [ "$(df --output=avail ${BUILDDIR} | sed "1d")" -le "524288" ] ; then | |||
|
192 | echo "error: ${BUILDDIR} not enough space left on this partition to generate the output image!" | |||
|
193 | exit 1 | |||
|
194 | fi | |||
|
195 | ||||
|
196 | # Warn if build directory has low free disk space <1024MB | |||
|
197 | if [ "$(df --output=avail ${BUILDDIR} | sed "1d")" -le "1048576" ] ; then | |||
|
198 | echo `df -h --output=avail ${BUILDDIR} | sed "1 s|.*Avail|warning: $partition is low on free space:|"` | |||
|
199 | fi | |||
|
200 | ||||
156 | set -x |
|
201 | set -x | |
157 |
|
202 | |||
158 | # Call "cleanup" function on various signals and errors |
|
203 | # Call "cleanup" function on various signals and errors | |
@@ -198,10 +243,6 if [ "$ENABLE_HWRANDOM" = true ] ; then | |||||
198 | APT_INCLUDES="${APT_INCLUDES},rng-tools" |
|
243 | APT_INCLUDES="${APT_INCLUDES},rng-tools" | |
199 | fi |
|
244 | fi | |
200 |
|
245 | |||
201 | if [ "$ENABLE_USER" = true ]; then |
|
|||
202 | APT_INCLUDES="${APT_INCLUDES},sudo" |
|
|||
203 | fi |
|
|||
204 |
|
||||
205 | # Add fbturbo video driver |
|
246 | # Add fbturbo video driver | |
206 | if [ "$ENABLE_FBTURBO" = true ] ; then |
|
247 | if [ "$ENABLE_FBTURBO" = true ] ; then | |
207 | # Enable xorg package dependencies |
|
248 | # Enable xorg package dependencies | |
@@ -221,27 +262,42 if [ "$ENABLE_XORG" = true ] ; then | |||||
221 | APT_INCLUDES="${APT_INCLUDES},xorg" |
|
262 | APT_INCLUDES="${APT_INCLUDES},xorg" | |
222 | fi |
|
263 | fi | |
223 |
|
264 | |||
224 | ## Main bootstrap |
|
265 | # Set KERNEL_CONFIGSRC=true | |
225 | for i in bootstrap.d/*.sh; do |
|
266 | if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNEL_SRCDIR" ] ; then | |
226 | head -n 3 $i |
|
267 | KERNEL_CONFIGSRC=true | |
227 | . $i |
|
268 | fi | |
|
269 | ||||
|
270 | ## MAIN bootstrap | |||
|
271 | for SCRIPT in bootstrap.d/*.sh; do | |||
|
272 | # Execute bootstrap scripts (lexicographical order) | |||
|
273 | head -n 3 $SCRIPT | |||
|
274 | . $SCRIPT | |||
228 | done |
|
275 | done | |
229 |
|
276 | |||
230 | ## Custom bootstrap scripts |
|
277 | ## Custom bootstrap scripts | |
231 | if [ -d "custom.d" ]; then |
|
278 | if [ -d "custom.d" ] ; then | |
232 | for i in custom.d/*.sh; do |
|
279 | # Execute custom bootstrap scripts (lexicographical order) | |
233 | . $i |
|
280 | for SCRIPT in custom.d/*.sh; do | |
|
281 | . $SCRIPT | |||
234 | done |
|
282 | done | |
235 | fi |
|
283 | fi | |
236 |
|
284 | |||
237 | # Invoke custom scripts |
|
285 | # Invoke custom scripts | |
238 |
if [ -n "$ |
|
286 | if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then | |
239 | cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts" |
|
287 | cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts" | |
240 | LANG=C chroot $R bash -c 'for SCRIPT in /chroot_scripts/*; do if [ -f $SCRIPT -a -x $SCRIPT ]; then $SCRIPT; fi done;' |
|
288 | # Execute scripts inside the chroot (lexicographical order) | |
|
289 | chroot_exec /bin/bash -x <<'EOF' | |||
|
290 | for SCRIPT in /chroot_scripts/* ; do | |||
|
291 | if [ -f $SCRIPT -a -x $SCRIPT ] ; then | |||
|
292 | $SCRIPT | |||
|
293 | fi | |||
|
294 | done | |||
|
295 | EOF | |||
241 | rm -rf "${R}/chroot_scripts" |
|
296 | rm -rf "${R}/chroot_scripts" | |
242 | fi |
|
297 | fi | |
243 |
|
298 | |||
244 | ## Cleanup |
|
299 | ## Cleanup | |
|
300 | chroot_exec apt-get purge -q -y --force-yes apt-utils | |||
245 | chroot_exec apt-get -y clean |
|
301 | chroot_exec apt-get -y clean | |
246 | chroot_exec apt-get -y autoclean |
|
302 | chroot_exec apt-get -y autoclean | |
247 | chroot_exec apt-get -y autoremove |
|
303 | chroot_exec apt-get -y autoremove |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant