##// END OF EJS Templates
Remove resolv.conf on cleanup
Filip Pytloun -
r57:b1b528ff680c
parent child
Show More
@@ -1,300 +1,301
1 #!/bin/sh
1 #!/bin/sh
2
2
3 ########################################################################
3 ########################################################################
4 # rpi2-gen-image.sh ver2a 12/2015
4 # rpi2-gen-image.sh ver2a 12/2015
5 #
5 #
6 # Advanced debian "jessie" bootstrap script for RPi2
6 # Advanced debian "jessie" bootstrap script for RPi2
7 #
7 #
8 # This program is free software; you can redistribute it and/or
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License
9 # modify it under the terms of the GNU General Public License
10 # as published by the Free Software Foundation; either version 2
10 # as published by the Free Software Foundation; either version 2
11 # of the License, or (at your option) any later version.
11 # of the License, or (at your option) any later version.
12 #
12 #
13 # some parts based on rpi2-build-image:
13 # some parts based on rpi2-build-image:
14 # Copyright (C) 2015 Ryan Finnie <ryan@finnie.org>
14 # Copyright (C) 2015 Ryan Finnie <ryan@finnie.org>
15 # Copyright (C) 2015 Luca Falavigna <dktrkranz@debian.org>
15 # Copyright (C) 2015 Luca Falavigna <dktrkranz@debian.org>
16 ########################################################################
16 ########################################################################
17
17
18 source ./functions.sh
18 source ./functions.sh
19
19
20 set -e
20 set -e
21 set -x
21 set -x
22
22
23 # Debian release
23 # Debian release
24 RELEASE=${RELEASE:=jessie}
24 RELEASE=${RELEASE:=jessie}
25 KERNEL=${KERNEL:=3.18.0-trunk-rpi2}
25 KERNEL=${KERNEL:=3.18.0-trunk-rpi2}
26
26
27 # Build settings
27 # Build settings
28 BASEDIR=$(pwd)/images/${RELEASE}
28 BASEDIR=$(pwd)/images/${RELEASE}
29 BUILDDIR=${BASEDIR}/build
29 BUILDDIR=${BASEDIR}/build
30
30
31 # General settings
31 # General settings
32 HOSTNAME=${HOSTNAME:=rpi2-${RELEASE}}
32 HOSTNAME=${HOSTNAME:=rpi2-${RELEASE}}
33 PASSWORD=${PASSWORD:=raspberry}
33 PASSWORD=${PASSWORD:=raspberry}
34 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
34 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
35 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
35 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
36 XKBMODEL=${XKBMODEL:=""}
36 XKBMODEL=${XKBMODEL:=""}
37 XKBLAYOUT=${XKBLAYOUT:=""}
37 XKBLAYOUT=${XKBLAYOUT:=""}
38 XKBVARIANT=${XKBVARIANT:=""}
38 XKBVARIANT=${XKBVARIANT:=""}
39 XKBOPTIONS=${XKBOPTIONS:=""}
39 XKBOPTIONS=${XKBOPTIONS:=""}
40 EXPANDROOT=${EXPANDROOT:=true}
40 EXPANDROOT=${EXPANDROOT:=true}
41
41
42 # Network settings
42 # Network settings
43 ENABLE_DHCP=${ENABLE_DHCP:=true}
43 ENABLE_DHCP=${ENABLE_DHCP:=true}
44 # NET_* settings are ignored when ENABLE_DHCP=true
44 # NET_* settings are ignored when ENABLE_DHCP=true
45 # NET_ADDRESS is an IPv4 or IPv6 address and its prefix, separated by "/"
45 # NET_ADDRESS is an IPv4 or IPv6 address and its prefix, separated by "/"
46 NET_ADDRESS=${NET_ADDRESS:=""}
46 NET_ADDRESS=${NET_ADDRESS:=""}
47 NET_GATEWAY=${NET_GATEWAY:=""}
47 NET_GATEWAY=${NET_GATEWAY:=""}
48 NET_DNS_1=${NET_DNS_1:=""}
48 NET_DNS_1=${NET_DNS_1:=""}
49 NET_DNS_2=${NET_DNS_2:=""}
49 NET_DNS_2=${NET_DNS_2:=""}
50 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
50 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
51 NET_NTP_1=${NET_NTP_1:=""}
51 NET_NTP_1=${NET_NTP_1:=""}
52 NET_NTP_2=${NET_NTP_2:=""}
52 NET_NTP_2=${NET_NTP_2:=""}
53
53
54 # APT settings
54 # APT settings
55 APT_PROXY=${APT_PROXY:=""}
55 APT_PROXY=${APT_PROXY:=""}
56 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
56 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
57
57
58 # Feature settings
58 # Feature settings
59 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
59 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
60 ENABLE_IPV6=${ENABLE_IPV6:=true}
60 ENABLE_IPV6=${ENABLE_IPV6:=true}
61 ENABLE_SSHD=${ENABLE_SSHD:=true}
61 ENABLE_SSHD=${ENABLE_SSHD:=true}
62 ENABLE_SOUND=${ENABLE_SOUND:=true}
62 ENABLE_SOUND=${ENABLE_SOUND:=true}
63 ENABLE_DBUS=${ENABLE_DBUS:=true}
63 ENABLE_DBUS=${ENABLE_DBUS:=true}
64 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
64 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
65 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
65 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
66 ENABLE_XORG=${ENABLE_XORG:=false}
66 ENABLE_XORG=${ENABLE_XORG:=false}
67 ENABLE_WM=${ENABLE_WM:=""}
67 ENABLE_WM=${ENABLE_WM:=""}
68 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
68 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
69 ENABLE_USER=${ENABLE_USER:=true}
69 ENABLE_USER=${ENABLE_USER:=true}
70 ENABLE_ROOT=${ENABLE_ROOT:=false}
70 ENABLE_ROOT=${ENABLE_ROOT:=false}
71 ENABLE_ROOT_SSH=${ENABLE_ROOT_SSH:=false}
71 ENABLE_ROOT_SSH=${ENABLE_ROOT_SSH:=false}
72
72
73 # Advanced settings
73 # Advanced settings
74 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
74 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
75 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
75 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
76 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
76 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
77 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
77 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
78 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
78 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
79
79
80 # Kernel compilation settings
80 # Kernel compilation settings
81 BUILD_KERNEL=${BUILD_KERNEL:=false}
81 BUILD_KERNEL=${BUILD_KERNEL:=false}
82
82
83 # Image chroot path
83 # Image chroot path
84 R=${BUILDDIR}/chroot
84 R=${BUILDDIR}/chroot
85 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
85 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
86
86
87 # Packages required for bootstrapping
87 # Packages required for bootstrapping
88 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core"
88 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core"
89
89
90 # Missing packages that need to be installed
90 # Missing packages that need to be installed
91 MISSING_PACKAGES=""
91 MISSING_PACKAGES=""
92
92
93 # Packages required in the chroot build environment
93 # Packages required in the chroot build environment
94 APT_INCLUDES=${APT_INCLUDES:=""}
94 APT_INCLUDES=${APT_INCLUDES:=""}
95 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,ca-certificates,debian-archive-keyring,dialog,sudo"
95 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,ca-certificates,debian-archive-keyring,dialog,sudo"
96
96
97 set +x
97 set +x
98
98
99 # Are we running as root?
99 # Are we running as root?
100 if [ "$(id -u)" -ne "0" ] ; then
100 if [ "$(id -u)" -ne "0" ] ; then
101 echo "this script must be executed with root privileges"
101 echo "this script must be executed with root privileges"
102 exit 1
102 exit 1
103 fi
103 fi
104
104
105 # Add packages required for kernel cross compilation
105 # Add packages required for kernel cross compilation
106 if [ "$BUILD_KERNEL" = true ] ; then
106 if [ "$BUILD_KERNEL" = true ] ; then
107 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
107 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
108 fi
108 fi
109
109
110 # Check if all required packages are installed
110 # Check if all required packages are installed
111 for package in $REQUIRED_PACKAGES ; do
111 for package in $REQUIRED_PACKAGES ; do
112 if [ "`dpkg-query -W -f='${Status}' $package`" != "install ok installed" ] ; then
112 if [ "`dpkg-query -W -f='${Status}' $package`" != "install ok installed" ] ; then
113 MISSING_PACKAGES="$MISSING_PACKAGES $package"
113 MISSING_PACKAGES="$MISSING_PACKAGES $package"
114 fi
114 fi
115 done
115 done
116
116
117 # Ask if missing packages should get installed right now
117 # Ask if missing packages should get installed right now
118 if [ -n "$MISSING_PACKAGES" ] ; then
118 if [ -n "$MISSING_PACKAGES" ] ; then
119 echo "the following packages needed by this script are not installed:"
119 echo "the following packages needed by this script are not installed:"
120 echo "$MISSING_PACKAGES"
120 echo "$MISSING_PACKAGES"
121
121
122 echo -n "\ndo you want to install the missing packages right now? [y/n] "
122 echo -n "\ndo you want to install the missing packages right now? [y/n] "
123 read confirm
123 read confirm
124 if [ "$confirm" != "y" ] ; then
124 if [ "$confirm" != "y" ] ; then
125 exit 1
125 exit 1
126 fi
126 fi
127 fi
127 fi
128
128
129 # Make sure all required packages are installed
129 # Make sure all required packages are installed
130 apt-get -qq -y install ${REQUIRED_PACKAGES}
130 apt-get -qq -y install ${REQUIRED_PACKAGES}
131
131
132 # Don't clobber an old build
132 # Don't clobber an old build
133 if [ -e "$BUILDDIR" ]; then
133 if [ -e "$BUILDDIR" ]; then
134 echo "directory $BUILDDIR already exists, not proceeding"
134 echo "directory $BUILDDIR already exists, not proceeding"
135 exit 1
135 exit 1
136 fi
136 fi
137
137
138 set -x
138 set -x
139
139
140 # Call "cleanup" function on various signals and errors
140 # Call "cleanup" function on various signals and errors
141 trap cleanup 0 1 2 3 6
141 trap cleanup 0 1 2 3 6
142
142
143 # Set up chroot directory
143 # Set up chroot directory
144 mkdir -p $R
144 mkdir -p $R
145
145
146 # Add required packages for the minbase installation
146 # Add required packages for the minbase installation
147 if [ "$ENABLE_MINBASE" = true ] ; then
147 if [ "$ENABLE_MINBASE" = true ] ; then
148 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools"
148 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools"
149 else
149 else
150 APT_INCLUDES="${APT_INCLUDES},locales,keyboard-configuration,console-setup"
150 APT_INCLUDES="${APT_INCLUDES},locales,keyboard-configuration,console-setup"
151 fi
151 fi
152
152
153 # Add parted package, required to get partprobe utility
153 # Add parted package, required to get partprobe utility
154 if [ "$EXPANDROOT" = true ] ; then
154 if [ "$EXPANDROOT" = true ] ; then
155 APT_INCLUDES="${APT_INCLUDES},parted"
155 APT_INCLUDES="${APT_INCLUDES},parted"
156 fi
156 fi
157
157
158 # Add dbus package, recommended if using systemd
158 # Add dbus package, recommended if using systemd
159 if [ "$ENABLE_DBUS" = true ] ; then
159 if [ "$ENABLE_DBUS" = true ] ; then
160 APT_INCLUDES="${APT_INCLUDES},dbus"
160 APT_INCLUDES="${APT_INCLUDES},dbus"
161 fi
161 fi
162
162
163 # Add iptables IPv4/IPv6 package
163 # Add iptables IPv4/IPv6 package
164 if [ "$ENABLE_IPTABLES" = true ] ; then
164 if [ "$ENABLE_IPTABLES" = true ] ; then
165 APT_INCLUDES="${APT_INCLUDES},iptables"
165 APT_INCLUDES="${APT_INCLUDES},iptables"
166 fi
166 fi
167
167
168 # Add openssh server package
168 # Add openssh server package
169 if [ "$ENABLE_SSHD" = true ] ; then
169 if [ "$ENABLE_SSHD" = true ] ; then
170 APT_INCLUDES="${APT_INCLUDES},openssh-server"
170 APT_INCLUDES="${APT_INCLUDES},openssh-server"
171 fi
171 fi
172
172
173 # Add alsa-utils package
173 # Add alsa-utils package
174 if [ "$ENABLE_SOUND" = true ] ; then
174 if [ "$ENABLE_SOUND" = true ] ; then
175 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
175 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
176 fi
176 fi
177
177
178 # Add rng-tools package
178 # Add rng-tools package
179 if [ "$ENABLE_HWRANDOM" = true ] ; then
179 if [ "$ENABLE_HWRANDOM" = true ] ; then
180 APT_INCLUDES="${APT_INCLUDES},rng-tools"
180 APT_INCLUDES="${APT_INCLUDES},rng-tools"
181 fi
181 fi
182
182
183 if [ "$ENABLE_USER" = true ]; then
183 if [ "$ENABLE_USER" = true ]; then
184 APT_INCLUDES="${APT_INCLUDES},sudo"
184 APT_INCLUDES="${APT_INCLUDES},sudo"
185 fi
185 fi
186
186
187 # Add fbturbo video driver
187 # Add fbturbo video driver
188 if [ "$ENABLE_FBTURBO" = true ] ; then
188 if [ "$ENABLE_FBTURBO" = true ] ; then
189 # Enable xorg package dependencies
189 # Enable xorg package dependencies
190 ENABLE_XORG=true
190 ENABLE_XORG=true
191 fi
191 fi
192
192
193 # Add user defined window manager package
193 # Add user defined window manager package
194 if [ -n "$ENABLE_WM" ] ; then
194 if [ -n "$ENABLE_WM" ] ; then
195 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
195 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
196
196
197 # Enable xorg package dependencies
197 # Enable xorg package dependencies
198 ENABLE_XORG=true
198 ENABLE_XORG=true
199 fi
199 fi
200
200
201 # Add xorg package
201 # Add xorg package
202 if [ "$ENABLE_XORG" = true ] ; then
202 if [ "$ENABLE_XORG" = true ] ; then
203 APT_INCLUDES="${APT_INCLUDES},xorg"
203 APT_INCLUDES="${APT_INCLUDES},xorg"
204 fi
204 fi
205
205
206 ## Main bootstrap
206 ## Main bootstrap
207 for i in bootstrap.d/*.sh; do
207 for i in bootstrap.d/*.sh; do
208 . $i
208 . $i
209 done
209 done
210
210
211 for i in custom.d/*.sh; do
211 for i in custom.d/*.sh; do
212 . $i
212 . $i
213 done
213 done
214
214
215 # Invoke custom scripts
215 # Invoke custom scripts
216 if [ -n "${CHROOT_SCRIPTS}" ]; then
216 if [ -n "${CHROOT_SCRIPTS}" ]; then
217 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
217 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
218 LANG=C chroot $R bash -c 'for SCRIPT in /chroot_scripts/*; do if [ -f $SCRIPT -a -x $SCRIPT ]; then $SCRIPT; fi done;'
218 LANG=C chroot $R bash -c 'for SCRIPT in /chroot_scripts/*; do if [ -f $SCRIPT -a -x $SCRIPT ]; then $SCRIPT; fi done;'
219 rm -rf "${R}/chroot_scripts"
219 rm -rf "${R}/chroot_scripts"
220 fi
220 fi
221
221
222 ## Cleanup
222 ## Cleanup
223 chroot_exec apt-get -y clean
223 chroot_exec apt-get -y clean
224 chroot_exec apt-get -y autoclean
224 chroot_exec apt-get -y autoclean
225 chroot_exec apt-get -y autoremove
225 chroot_exec apt-get -y autoremove
226
226
227 # Unmount mounted filesystems
227 # Unmount mounted filesystems
228 umount -l $R/proc
228 umount -l $R/proc
229 umount -l $R/sys
229 umount -l $R/sys
230
230
231 # Clean up files
231 # Clean up files
232 rm -f $R/etc/apt/sources.list.save
232 rm -f $R/etc/apt/sources.list.save
233 rm -f $R/etc/resolvconf/resolv.conf.d/original
233 rm -f $R/etc/resolvconf/resolv.conf.d/original
234 rm -rf $R/run
234 rm -rf $R/run
235 mkdir -p $R/run
235 mkdir -p $R/run
236 rm -f $R/etc/*-
236 rm -f $R/etc/*-
237 rm -f $R/root/.bash_history
237 rm -f $R/root/.bash_history
238 rm -rf $R/tmp/*
238 rm -rf $R/tmp/*
239 rm -f $R/var/lib/urandom/random-seed
239 rm -f $R/var/lib/urandom/random-seed
240 [ -L $R/var/lib/dbus/machine-id ] || rm -f $R/var/lib/dbus/machine-id
240 [ -L $R/var/lib/dbus/machine-id ] || rm -f $R/var/lib/dbus/machine-id
241 rm -f $R/etc/machine-id
241 rm -f $R/etc/machine-id
242 rm -fr $R/etc/apt/apt.conf.d/10proxy
242 rm -fr $R/etc/apt/apt.conf.d/10proxy
243 rm -f $R/etc/resolv.conf
243
244
244 # Calculate size of the chroot directory in KB
245 # Calculate size of the chroot directory in KB
245 CHROOT_SIZE=$(expr `du -s $R | awk '{ print $1 }'`)
246 CHROOT_SIZE=$(expr `du -s $R | awk '{ print $1 }'`)
246
247
247 # Calculate the amount of needed 512 Byte sectors
248 # Calculate the amount of needed 512 Byte sectors
248 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
249 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
249 BOOT_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
250 BOOT_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
250 ROOT_OFFSET=$(expr ${TABLE_SECTORS} + ${BOOT_SECTORS})
251 ROOT_OFFSET=$(expr ${TABLE_SECTORS} + ${BOOT_SECTORS})
251
252
252 # The root partition is EXT4
253 # The root partition is EXT4
253 # This means more space than the actual used space of the chroot is used.
254 # This means more space than the actual used space of the chroot is used.
254 # As overhead for journaling and reserved blocks 20% are added.
255 # As overhead for journaling and reserved blocks 20% are added.
255 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 20) \* 1024 \/ 512)
256 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 20) \* 1024 \/ 512)
256
257
257 # Calculate required image size in 512 Byte sectors
258 # Calculate required image size in 512 Byte sectors
258 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${BOOT_SECTORS} + ${ROOT_SECTORS})
259 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${BOOT_SECTORS} + ${ROOT_SECTORS})
259
260
260 # Prepare date string for image file name
261 # Prepare date string for image file name
261 DATE="$(date +%Y-%m-%d)"
262 DATE="$(date +%Y-%m-%d)"
262
263
263 # Prepare image file
264 # Prepare image file
264 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=${TABLE_SECTORS}
265 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=${TABLE_SECTORS}
265 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=0 seek=${IMAGE_SECTORS}
266 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=0 seek=${IMAGE_SECTORS}
266
267
267 # Write partition table
268 # Write partition table
268 sfdisk -q -f "$BASEDIR/${DATE}-debian-${RELEASE}.img" <<EOM
269 sfdisk -q -f "$BASEDIR/${DATE}-debian-${RELEASE}.img" <<EOM
269 unit: sectors
270 unit: sectors
270
271
271 1 : start= ${TABLE_SECTORS}, size= ${BOOT_SECTORS}, Id= c, bootable
272 1 : start= ${TABLE_SECTORS}, size= ${BOOT_SECTORS}, Id= c, bootable
272 2 : start= ${ROOT_OFFSET}, size= ${ROOT_SECTORS}, Id=83
273 2 : start= ${ROOT_OFFSET}, size= ${ROOT_SECTORS}, Id=83
273 3 : start= 0, size= 0, Id= 0
274 3 : start= 0, size= 0, Id= 0
274 4 : start= 0, size= 0, Id= 0
275 4 : start= 0, size= 0, Id= 0
275 EOM
276 EOM
276
277
277 # Set up temporary loop devices and build filesystems
278 # Set up temporary loop devices and build filesystems
278 VFAT_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
279 VFAT_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
279 EXT4_LOOP="$(losetup -o 65M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
280 EXT4_LOOP="$(losetup -o 65M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
280 mkfs.vfat "$VFAT_LOOP"
281 mkfs.vfat "$VFAT_LOOP"
281 mkfs.ext4 "$EXT4_LOOP"
282 mkfs.ext4 "$EXT4_LOOP"
282
283
283 # Mount the temporary loop devices
284 # Mount the temporary loop devices
284 mkdir -p "$BUILDDIR/mount"
285 mkdir -p "$BUILDDIR/mount"
285 mount "$EXT4_LOOP" "$BUILDDIR/mount"
286 mount "$EXT4_LOOP" "$BUILDDIR/mount"
286
287
287 mkdir -p "$BUILDDIR/mount/boot/firmware"
288 mkdir -p "$BUILDDIR/mount/boot/firmware"
288 mount "$VFAT_LOOP" "$BUILDDIR/mount/boot/firmware"
289 mount "$VFAT_LOOP" "$BUILDDIR/mount/boot/firmware"
289
290
290 # Copy all files from the chroot to the loop device mount point directory
291 # Copy all files from the chroot to the loop device mount point directory
291 rsync -a "$R/" "$BUILDDIR/mount/"
292 rsync -a "$R/" "$BUILDDIR/mount/"
292
293
293 # Unmount all temporary loop devices and mount points
294 # Unmount all temporary loop devices and mount points
294 cleanup
295 cleanup
295
296
296 # (optinal) create block map file for "bmaptool"
297 # (optinal) create block map file for "bmaptool"
297 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}.img"
298 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}.img"
298
299
299 # Image was successfully created
300 # Image was successfully created
300 echo "$BASEDIR/${DATE}-debian-${RELEASE}.img (${IMAGE_SIZE})" ": successfully created"
301 echo "$BASEDIR/${DATE}-debian-${RELEASE}.img (${IMAGE_SIZE})" ": successfully created"
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant