##// END OF EJS Templates
shred-fix
Jan Wagner -
r78:7b0a7803dcb8
parent child
Show More
@@ -1,39 +1,44
1 # This file contains utility functions used by rpi2-gen-image.sh
1 # This file contains utility functions used by rpi2-gen-image.sh
2
2
3 cleanup (){
3 cleanup (){
4 set +x
4 set +x
5 set +e
5 set +e
6
6
7 # Identify and kill all processes still using files
7 # Identify and kill all processes still using files
8 echo "killing processes using mount point ..."
8 echo "killing processes using mount point ..."
9 fuser -k "$R"
9 fuser -k "$R"
10 sleep 3
10 sleep 3
11 fuser -9 -k -v "$R"
11 fuser -9 -k -v "$R"
12
12
13 # Clean up temporary .password file
14 if [ -r ".password" ] ; then
15 shred -zu .password
16 fi
17
13 # Clean up all temporary mount points
18 # Clean up all temporary mount points
14 echo "removing temporary mount points ..."
19 echo "removing temporary mount points ..."
15 umount -l "$R/proc" 2> /dev/null
20 umount -l "$R/proc" 2> /dev/null
16 umount -l "$R/sys" 2> /dev/null
21 umount -l "$R/sys" 2> /dev/null
17 umount -l "$R/dev/pts" 2> /dev/null
22 umount -l "$R/dev/pts" 2> /dev/null
18 umount "$BUILDDIR/mount/boot/firmware" 2> /dev/null
23 umount "$BUILDDIR/mount/boot/firmware" 2> /dev/null
19 umount "$BUILDDIR/mount" 2> /dev/null
24 umount "$BUILDDIR/mount" 2> /dev/null
20 cryptsetup close "${CRYPTFS_MAPPING}" 2> /dev/null
25 cryptsetup close "${CRYPTFS_MAPPING}" 2> /dev/null
21 losetup -d "$ROOT_LOOP" 2> /dev/null
26 losetup -d "$ROOT_LOOP" 2> /dev/null
22 losetup -d "$FRMW_LOOP" 2> /dev/null
27 losetup -d "$FRMW_LOOP" 2> /dev/null
23 trap - 0 1 2 3 6
28 trap - 0 1 2 3 6
24 }
29 }
25
30
26 chroot_exec() {
31 chroot_exec() {
27 # Exec command in chroot
32 # Exec command in chroot
28 LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot $R $*
33 LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot $R $*
29 }
34 }
30
35
31 install_readonly() {
36 install_readonly() {
32 # Install file with user read-only permissions
37 # Install file with user read-only permissions
33 install -o root -g root -m 644 $*
38 install -o root -g root -m 644 $*
34 }
39 }
35
40
36 install_exec() {
41 install_exec() {
37 # Install file with root exec permissions
42 # Install file with root exec permissions
38 install -o root -g root -m 744 $*
43 install -o root -g root -m 744 $*
39 }
44 }
@@ -1,504 +1,505
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 # Are we running as root?
18 # Are we running as root?
19 if [ "$(id -u)" -ne "0" ] ; then
19 if [ "$(id -u)" -ne "0" ] ; then
20 echo "error: this script must be executed with root privileges!"
20 echo "error: this script must be executed with root privileges!"
21 exit 1
21 exit 1
22 fi
22 fi
23
23
24 # Check if ./functions.sh script exists
24 # Check if ./functions.sh script exists
25 if [ ! -r "./functions.sh" ] ; then
25 if [ ! -r "./functions.sh" ] ; then
26 echo "error: './functions.sh' required script not found!"
26 echo "error: './functions.sh' required script not found!"
27 exit 1
27 exit 1
28 fi
28 fi
29
29
30 # Load utility functions
30 # Load utility functions
31 . ./functions.sh
31 . ./functions.sh
32
32
33 # Introduce settings
33 # Introduce settings
34 set -e
34 set -e
35 echo -n -e "\n#\n# RPi2 Bootstrap Settings\n#\n"
35 echo -n -e "\n#\n# RPi2 Bootstrap Settings\n#\n"
36 set -x
36 set -x
37
37
38 # Debian release
38 # Debian release
39 RELEASE=${RELEASE:=jessie}
39 RELEASE=${RELEASE:=jessie}
40 KERNEL_ARCH=${KERNEL_ARCH:=arm}
40 KERNEL_ARCH=${KERNEL_ARCH:=arm}
41 RELEASE_ARCH=${RELEASE_ARCH:=armhf}
41 RELEASE_ARCH=${RELEASE_ARCH:=armhf}
42 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
42 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
43 COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2}
43 COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2}
44 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
44 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
45 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
45 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
46
46
47 # Build directories
47 # Build directories
48 BASEDIR="$(pwd)/images/${RELEASE}"
48 BASEDIR="$(pwd)/images/${RELEASE}"
49 BUILDDIR="${BASEDIR}/build"
49 BUILDDIR="${BASEDIR}/build"
50 R="${BUILDDIR}/chroot"
50 R="${BUILDDIR}/chroot"
51
51
52 # General settings
52 # General settings
53 HOSTNAME=${HOSTNAME:=rpi2-${RELEASE}}
53 HOSTNAME=${HOSTNAME:=rpi2-${RELEASE}}
54 PASSWORD=${PASSWORD:=raspberry}
54 PASSWORD=${PASSWORD:=raspberry}
55 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
55 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
56 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
56 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
57 EXPANDROOT=${EXPANDROOT:=true}
57 EXPANDROOT=${EXPANDROOT:=true}
58
58
59 # Keyboard settings
59 # Keyboard settings
60 XKB_MODEL=${XKB_MODEL:=""}
60 XKB_MODEL=${XKB_MODEL:=""}
61 XKB_LAYOUT=${XKB_LAYOUT:=""}
61 XKB_LAYOUT=${XKB_LAYOUT:=""}
62 XKB_VARIANT=${XKB_VARIANT:=""}
62 XKB_VARIANT=${XKB_VARIANT:=""}
63 XKB_OPTIONS=${XKB_OPTIONS:=""}
63 XKB_OPTIONS=${XKB_OPTIONS:=""}
64
64
65 # Network settings (DHCP)
65 # Network settings (DHCP)
66 ENABLE_DHCP=${ENABLE_DHCP:=true}
66 ENABLE_DHCP=${ENABLE_DHCP:=true}
67
67
68 # Network settings (static)
68 # Network settings (static)
69 NET_ADDRESS=${NET_ADDRESS:=""}
69 NET_ADDRESS=${NET_ADDRESS:=""}
70 NET_GATEWAY=${NET_GATEWAY:=""}
70 NET_GATEWAY=${NET_GATEWAY:=""}
71 NET_DNS_1=${NET_DNS_1:=""}
71 NET_DNS_1=${NET_DNS_1:=""}
72 NET_DNS_2=${NET_DNS_2:=""}
72 NET_DNS_2=${NET_DNS_2:=""}
73 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
73 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
74 NET_NTP_1=${NET_NTP_1:=""}
74 NET_NTP_1=${NET_NTP_1:=""}
75 NET_NTP_2=${NET_NTP_2:=""}
75 NET_NTP_2=${NET_NTP_2:=""}
76
76
77 # APT settings
77 # APT settings
78 APT_PROXY=${APT_PROXY:=""}
78 APT_PROXY=${APT_PROXY:=""}
79 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
79 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
80
80
81 # Feature settings
81 # Feature settings
82 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
82 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
83 ENABLE_IPV6=${ENABLE_IPV6:=true}
83 ENABLE_IPV6=${ENABLE_IPV6:=true}
84 ENABLE_SSHD=${ENABLE_SSHD:=true}
84 ENABLE_SSHD=${ENABLE_SSHD:=true}
85 ENABLE_SOUND=${ENABLE_SOUND:=true}
85 ENABLE_SOUND=${ENABLE_SOUND:=true}
86 ENABLE_DBUS=${ENABLE_DBUS:=true}
86 ENABLE_DBUS=${ENABLE_DBUS:=true}
87 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
87 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
88 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
88 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
89 ENABLE_XORG=${ENABLE_XORG:=false}
89 ENABLE_XORG=${ENABLE_XORG:=false}
90 ENABLE_WM=${ENABLE_WM:=""}
90 ENABLE_WM=${ENABLE_WM:=""}
91 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
91 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
92 ENABLE_USER=${ENABLE_USER:=true}
92 ENABLE_USER=${ENABLE_USER:=true}
93 ENABLE_ROOT=${ENABLE_ROOT:=false}
93 ENABLE_ROOT=${ENABLE_ROOT:=false}
94 ENABLE_ROOT_SSH=${ENABLE_ROOT_SSH:=false}
94 ENABLE_ROOT_SSH=${ENABLE_ROOT_SSH:=false}
95
95
96 # Advanced settings
96 # Advanced settings
97 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
97 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
98 ENABLE_REDUCE=${ENABLE_REDUCE:=flase}
98 ENABLE_REDUCE=${ENABLE_REDUCE:=flase}
99 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
99 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
100 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
100 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
101 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
101 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
102 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
102 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
103 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
103 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
104 ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
104 ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
105
105
106 # Kernel compilation settings
106 # Kernel compilation settings
107 BUILD_KERNEL=${BUILD_KERNEL:=false}
107 BUILD_KERNEL=${BUILD_KERNEL:=false}
108 KERNEL_REDUCE=${KERNEL_REDUCE:=false}
108 KERNEL_REDUCE=${KERNEL_REDUCE:=false}
109 KERNEL_THREADS=${KERNEL_THREADS:=1}
109 KERNEL_THREADS=${KERNEL_THREADS:=1}
110 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
110 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
111 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
111 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
112 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
112 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
113
113
114 # Kernel compilation from source directory settings
114 # Kernel compilation from source directory settings
115 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
115 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
116 KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
116 KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
117 KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
117 KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
118 KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
118 KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
119
119
120 # Reduce disk usage settings
120 # Reduce disk usage settings
121 REDUCE_APT=${REDUCE_APT:=true}
121 REDUCE_APT=${REDUCE_APT:=true}
122 REDUCE_DOC=${REDUCE_DOC:=true}
122 REDUCE_DOC=${REDUCE_DOC:=true}
123 REDUCE_MAN=${REDUCE_MAN:=true}
123 REDUCE_MAN=${REDUCE_MAN:=true}
124 REDUCE_VIM=${REDUCE_VIM:=false}
124 REDUCE_VIM=${REDUCE_VIM:=false}
125 REDUCE_BASH=${REDUCE_BASH:=false}
125 REDUCE_BASH=${REDUCE_BASH:=false}
126 REDUCE_HWDB=${REDUCE_HWDB:=true}
126 REDUCE_HWDB=${REDUCE_HWDB:=true}
127 REDUCE_SSHD=${REDUCE_SSHD:=true}
127 REDUCE_SSHD=${REDUCE_SSHD:=true}
128 REDUCE_LOCALE=${REDUCE_LOCALE:=true}
128 REDUCE_LOCALE=${REDUCE_LOCALE:=true}
129
129
130 # Encrypted filesystem settings
130 # Encrypted filesystem settings
131 ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false}
131 ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false}
132 CRYPTFS_PASSWORD=${CRYPTFS_PASSWORD:=""}
132 CRYPTFS_PASSWORD=${CRYPTFS_PASSWORD:=""}
133 CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"}
133 CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"}
134 CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64:sha512"}
134 CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64:sha512"}
135 CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512}
135 CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512}
136
136
137 # Stop the Crypto Wars
137 # Stop the Crypto Wars
138 DISABLE_FBI=${DISABLE_FBI:=false}
138 DISABLE_FBI=${DISABLE_FBI:=false}
139
139
140 # Chroot scripts directory
140 # Chroot scripts directory
141 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
141 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
142
142
143 # Packages required in the chroot build environment
143 # Packages required in the chroot build environment
144 APT_INCLUDES=${APT_INCLUDES:=""}
144 APT_INCLUDES=${APT_INCLUDES:=""}
145 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo"
145 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo"
146
146
147 # Packages required for bootstrapping
147 # Packages required for bootstrapping
148 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core"
148 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core"
149 MISSING_PACKAGES=""
149 MISSING_PACKAGES=""
150
150
151 set +x
151 set +x
152
152
153 # Add packages required for kernel cross compilation
153 # Add packages required for kernel cross compilation
154 if [ "$BUILD_KERNEL" = true ] ; then
154 if [ "$BUILD_KERNEL" = true ] ; then
155 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
155 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
156 fi
156 fi
157
157
158 # Add libncurses5 to enable kernel menuconfig
158 # Add libncurses5 to enable kernel menuconfig
159 if [ "$KERNEL_MENUCONFIG" = true ] ; then
159 if [ "$KERNEL_MENUCONFIG" = true ] ; then
160 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses5-dev"
160 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses5-dev"
161 fi
161 fi
162
162
163 # Stop the Crypto Wars
163 # Stop the Crypto Wars
164 if [ "$DISABLE_FBI" = true ] ; then
164 if [ "$DISABLE_FBI" = true ] ; then
165 ENABLE_CRYPTFS=true
165 ENABLE_CRYPTFS=true
166 fi
166 fi
167
167
168 # Add cryptsetup package to enable filesystem encryption
168 # Add cryptsetup package to enable filesystem encryption
169 if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
169 if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
170 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup"
170 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup"
171 APT_INCLUDES="${APT_INCLUDES},cryptsetup"
171 APT_INCLUDES="${APT_INCLUDES},cryptsetup"
172
172
173 if [ -z "$CRYPTFS_PASSWORD" ] ; then
173 if [ -z "$CRYPTFS_PASSWORD" ] ; then
174 echo "error: no password defined (CRYPTFS_PASSWORD)!"
174 echo "error: no password defined (CRYPTFS_PASSWORD)!"
175 exit 1
175 exit 1
176 fi
176 fi
177 ENABLE_INITRAMFS=true
177 ENABLE_INITRAMFS=true
178 fi
178 fi
179
179
180 # Add initramfs generation tools
180 # Add initramfs generation tools
181 if [ "$ENABLE_INITRAMFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
181 if [ "$ENABLE_INITRAMFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
182 APT_INCLUDES="${APT_INCLUDES},initramfs-tools"
182 APT_INCLUDES="${APT_INCLUDES},initramfs-tools"
183 fi
183 fi
184
184
185 # Check if all required packages are installed on the build system
185 # Check if all required packages are installed on the build system
186 for package in $REQUIRED_PACKAGES ; do
186 for package in $REQUIRED_PACKAGES ; do
187 if [ "`dpkg-query -W -f='${Status}' $package`" != "install ok installed" ] ; then
187 if [ "`dpkg-query -W -f='${Status}' $package`" != "install ok installed" ] ; then
188 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
188 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
189 fi
189 fi
190 done
190 done
191
191
192 # Ask if missing packages should get installed right now
192 # Ask if missing packages should get installed right now
193 if [ -n "$MISSING_PACKAGES" ] ; then
193 if [ -n "$MISSING_PACKAGES" ] ; then
194 echo "the following packages needed by this script are not installed:"
194 echo "the following packages needed by this script are not installed:"
195 echo "$MISSING_PACKAGES"
195 echo "$MISSING_PACKAGES"
196
196
197 echo -n "\ndo you want to install the missing packages right now? [y/n] "
197 echo -n "\ndo you want to install the missing packages right now? [y/n] "
198 read confirm
198 read confirm
199 [ "$confirm" != "y" ] && exit 1
199 [ "$confirm" != "y" ] && exit 1
200 fi
200 fi
201
201
202 # Make sure all required packages are installed
202 # Make sure all required packages are installed
203 apt-get -qq -y install ${REQUIRED_PACKAGES}
203 apt-get -qq -y install ${REQUIRED_PACKAGES}
204
204
205 # Check if ./bootstrap.d directory exists
205 # Check if ./bootstrap.d directory exists
206 if [ ! -d "./bootstrap.d/" ] ; then
206 if [ ! -d "./bootstrap.d/" ] ; then
207 echo "error: './bootstrap.d' required directory not found!"
207 echo "error: './bootstrap.d' required directory not found!"
208 exit 1
208 exit 1
209 fi
209 fi
210
210
211 # Check if ./files directory exists
211 # Check if ./files directory exists
212 if [ ! -d "./files/" ] ; then
212 if [ ! -d "./files/" ] ; then
213 echo "error: './files' required directory not found!"
213 echo "error: './files' required directory not found!"
214 exit 1
214 exit 1
215 fi
215 fi
216
216
217 # Check if specified KERNELSRC_DIR directory exists
217 # Check if specified KERNELSRC_DIR directory exists
218 if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then
218 if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then
219 echo "error: '${KERNELSRC_DIR}' specified directory not found (KERNELSRC_DIR)!"
219 echo "error: '${KERNELSRC_DIR}' specified directory not found (KERNELSRC_DIR)!"
220 exit 1
220 exit 1
221 fi
221 fi
222
222
223 # Check if specified CHROOT_SCRIPTS directory exists
223 # Check if specified CHROOT_SCRIPTS directory exists
224 if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
224 if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
225 echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!"
225 echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!"
226 exit 1
226 exit 1
227 fi
227 fi
228
228
229 # Check if specified device mapping already exists (will be used by cryptsetup)
229 # Check if specified device mapping already exists (will be used by cryptsetup)
230 if [ -r "/dev/mapping/${CRYPTFS_MAPPING}" ] ; then
230 if [ -r "/dev/mapping/${CRYPTFS_MAPPING}" ] ; then
231 echo "error: mapping /dev/mapping/${CRYPTFS_MAPPING} already exists, not proceeding"
231 echo "error: mapping /dev/mapping/${CRYPTFS_MAPPING} already exists, not proceeding"
232 exit 1
232 exit 1
233 fi
233 fi
234
234
235 # Don't clobber an old build
235 # Don't clobber an old build
236 if [ -e "$BUILDDIR" ] ; then
236 if [ -e "$BUILDDIR" ] ; then
237 echo "error: directory ${BUILDDIR} already exists, not proceeding"
237 echo "error: directory ${BUILDDIR} already exists, not proceeding"
238 exit 1
238 exit 1
239 fi
239 fi
240
240
241 # Setup chroot directory
241 # Setup chroot directory
242 mkdir -p "$R"
242 mkdir -p "$R"
243
243
244 # Check if build directory has enough of free disk space >512MB
244 # Check if build directory has enough of free disk space >512MB
245 if [ "$(df --output=avail ${BUILDDIR} | sed "1d")" -le "524288" ] ; then
245 if [ "$(df --output=avail ${BUILDDIR} | sed "1d")" -le "524288" ] ; then
246 echo "error: ${BUILDDIR} not enough space left to generate the output image!"
246 echo "error: ${BUILDDIR} not enough space left to generate the output image!"
247 exit 1
247 exit 1
248 fi
248 fi
249
249
250 set -x
250 set -x
251
251
252 # Call "cleanup" function on various signals and errors
252 # Call "cleanup" function on various signals and errors
253 trap cleanup 0 1 2 3 6
253 trap cleanup 0 1 2 3 6
254
254
255 # Add required packages for the minbase installation
255 # Add required packages for the minbase installation
256 if [ "$ENABLE_MINBASE" = true ] ; then
256 if [ "$ENABLE_MINBASE" = true ] ; then
257 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools,ifupdown"
257 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools,ifupdown"
258 else
258 else
259 APT_INCLUDES="${APT_INCLUDES},locales,keyboard-configuration,console-setup"
259 APT_INCLUDES="${APT_INCLUDES},locales,keyboard-configuration,console-setup"
260 fi
260 fi
261
261
262 # Add parted package, required to get partprobe utility
262 # Add parted package, required to get partprobe utility
263 if [ "$EXPANDROOT" = true ] ; then
263 if [ "$EXPANDROOT" = true ] ; then
264 APT_INCLUDES="${APT_INCLUDES},parted"
264 APT_INCLUDES="${APT_INCLUDES},parted"
265 fi
265 fi
266
266
267 # Add dbus package, recommended if using systemd
267 # Add dbus package, recommended if using systemd
268 if [ "$ENABLE_DBUS" = true ] ; then
268 if [ "$ENABLE_DBUS" = true ] ; then
269 APT_INCLUDES="${APT_INCLUDES},dbus"
269 APT_INCLUDES="${APT_INCLUDES},dbus"
270 fi
270 fi
271
271
272 # Add iptables IPv4/IPv6 package
272 # Add iptables IPv4/IPv6 package
273 if [ "$ENABLE_IPTABLES" = true ] ; then
273 if [ "$ENABLE_IPTABLES" = true ] ; then
274 APT_INCLUDES="${APT_INCLUDES},iptables"
274 APT_INCLUDES="${APT_INCLUDES},iptables"
275 fi
275 fi
276
276
277 # Add openssh server package
277 # Add openssh server package
278 if [ "$ENABLE_SSHD" = true ] ; then
278 if [ "$ENABLE_SSHD" = true ] ; then
279 APT_INCLUDES="${APT_INCLUDES},openssh-server"
279 APT_INCLUDES="${APT_INCLUDES},openssh-server"
280 fi
280 fi
281
281
282 # Add alsa-utils package
282 # Add alsa-utils package
283 if [ "$ENABLE_SOUND" = true ] ; then
283 if [ "$ENABLE_SOUND" = true ] ; then
284 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
284 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
285 fi
285 fi
286
286
287 # Add rng-tools package
287 # Add rng-tools package
288 if [ "$ENABLE_HWRANDOM" = true ] ; then
288 if [ "$ENABLE_HWRANDOM" = true ] ; then
289 APT_INCLUDES="${APT_INCLUDES},rng-tools"
289 APT_INCLUDES="${APT_INCLUDES},rng-tools"
290 fi
290 fi
291
291
292 # Add fbturbo video driver
292 # Add fbturbo video driver
293 if [ "$ENABLE_FBTURBO" = true ] ; then
293 if [ "$ENABLE_FBTURBO" = true ] ; then
294 # Enable xorg package dependencies
294 # Enable xorg package dependencies
295 ENABLE_XORG=true
295 ENABLE_XORG=true
296 fi
296 fi
297
297
298 # Add user defined window manager package
298 # Add user defined window manager package
299 if [ -n "$ENABLE_WM" ] ; then
299 if [ -n "$ENABLE_WM" ] ; then
300 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
300 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
301
301
302 # Enable xorg package dependencies
302 # Enable xorg package dependencies
303 ENABLE_XORG=true
303 ENABLE_XORG=true
304 fi
304 fi
305
305
306 # Add xorg package
306 # Add xorg package
307 if [ "$ENABLE_XORG" = true ] ; then
307 if [ "$ENABLE_XORG" = true ] ; then
308 APT_INCLUDES="${APT_INCLUDES},xorg"
308 APT_INCLUDES="${APT_INCLUDES},xorg"
309 fi
309 fi
310
310
311 # Replace selected packages with smaller clones
311 # Replace selected packages with smaller clones
312 if [ "$ENABLE_REDUCE" = true ] ; then
312 if [ "$ENABLE_REDUCE" = true ] ; then
313 # Add levee package instead of vim-tiny
313 # Add levee package instead of vim-tiny
314 if [ "$REDUCE_VIM" = true ] ; then
314 if [ "$REDUCE_VIM" = true ] ; then
315 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")"
315 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")"
316 fi
316 fi
317
317
318 # Add dropbear package instead of openssh-server
318 # Add dropbear package instead of openssh-server
319 if [ "$REDUCE_SSHD" = true ] ; then
319 if [ "$REDUCE_SSHD" = true ] ; then
320 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/openssh-server/dropbear/")"
320 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/openssh-server/dropbear/")"
321 fi
321 fi
322 fi
322 fi
323
323
324 # Configure kernel sources if no KERNELSRC_DIR
324 # Configure kernel sources if no KERNELSRC_DIR
325 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then
325 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then
326 KERNELSRC_CONFIG=true
326 KERNELSRC_CONFIG=true
327 fi
327 fi
328
328
329 # Configure reduced kernel
329 # Configure reduced kernel
330 if [ "$KERNEL_REDUCE" = true ] ; then
330 if [ "$KERNEL_REDUCE" = true ] ; then
331 KERNELSRC_CONFIG=false
331 KERNELSRC_CONFIG=false
332 fi
332 fi
333
333
334 # Execute bootstrap scripts
334 # Execute bootstrap scripts
335 for SCRIPT in bootstrap.d/*.sh; do
335 for SCRIPT in bootstrap.d/*.sh; do
336 head -n 3 "$SCRIPT"
336 head -n 3 "$SCRIPT"
337 . "$SCRIPT"
337 . "$SCRIPT"
338 done
338 done
339
339
340 ## Execute custom bootstrap scripts
340 ## Execute custom bootstrap scripts
341 if [ -d "custom.d" ] ; then
341 if [ -d "custom.d" ] ; then
342 for SCRIPT in custom.d/*.sh; do
342 for SCRIPT in custom.d/*.sh; do
343 . "$SCRIPT"
343 . "$SCRIPT"
344 done
344 done
345 fi
345 fi
346
346
347 # Execute custom scripts inside the chroot
347 # Execute custom scripts inside the chroot
348 if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then
348 if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then
349 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
349 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
350 chroot_exec /bin/bash -x <<'EOF'
350 chroot_exec /bin/bash -x <<'EOF'
351 for SCRIPT in /chroot_scripts/* ; do
351 for SCRIPT in /chroot_scripts/* ; do
352 if [ -f $SCRIPT -a -x $SCRIPT ] ; then
352 if [ -f $SCRIPT -a -x $SCRIPT ] ; then
353 $SCRIPT
353 $SCRIPT
354 fi
354 fi
355 done
355 done
356 EOF
356 EOF
357 rm -rf "$R/chroot_scripts"
357 rm -rf "$R/chroot_scripts"
358 fi
358 fi
359
359
360 # Remove apt-utils
360 # Remove apt-utils
361 chroot_exec apt-get purge -qq -y --force-yes apt-utils
361 chroot_exec apt-get purge -qq -y --force-yes apt-utils
362
362
363 # Generate required machine-id
363 # Generate required machine-id
364 MACHINE_ID=$(dbus-uuidgen)
364 MACHINE_ID=$(dbus-uuidgen)
365 echo -n "${MACHINE_ID}" > "$R/var/lib/dbus/machine-id"
365 echo -n "${MACHINE_ID}" > "$R/var/lib/dbus/machine-id"
366 echo -n "${MACHINE_ID}" > "$R/etc/machine-id"
366 echo -n "${MACHINE_ID}" > "$R/etc/machine-id"
367
367
368 # APT Cleanup
368 # APT Cleanup
369 chroot_exec apt-get -y clean
369 chroot_exec apt-get -y clean
370 chroot_exec apt-get -y autoclean
370 chroot_exec apt-get -y autoclean
371 chroot_exec apt-get -y autoremove
371 chroot_exec apt-get -y autoremove
372
372
373 # Unmount mounted filesystems
373 # Unmount mounted filesystems
374 umount -l "$R/proc"
374 umount -l "$R/proc"
375 umount -l "$R/sys"
375 umount -l "$R/sys"
376
376
377 # Clean up directories
377 # Clean up directories
378 rm -rf "$R/run/*"
378 rm -rf "$R/run/*"
379 rm -rf "$R/tmp/*"
379 rm -rf "$R/tmp/*"
380
380
381 # Clean up files
381 # Clean up files
382 rm -f "$R/etc/ssh/ssh_host_*"
382 rm -f "$R/etc/ssh/ssh_host_*"
383 rm -f "$R/etc/dropbear/dropbear_*"
383 rm -f "$R/etc/dropbear/dropbear_*"
384 rm -f "$R/etc/apt/sources.list.save"
384 rm -f "$R/etc/apt/sources.list.save"
385 rm -f "$R/etc/resolvconf/resolv.conf.d/original"
385 rm -f "$R/etc/resolvconf/resolv.conf.d/original"
386 rm -f "$R/etc/*-"
386 rm -f "$R/etc/*-"
387 rm -f "$R/root/.bash_history"
387 rm -f "$R/root/.bash_history"
388 rm -f "$R/var/lib/urandom/random-seed"
388 rm -f "$R/var/lib/urandom/random-seed"
389 rm -f "$R/etc/apt/apt.conf.d/10proxy"
389 rm -f "$R/etc/apt/apt.conf.d/10proxy"
390 rm -f "$R/etc/resolv.conf"
390 rm -f "$R/etc/resolv.conf"
391 rm -f "$R/initrd.img"
391 rm -f "$R/initrd.img"
392 rm -f "$R/vmlinuz"
392 rm -f "$R/vmlinuz"
393 rm -f "${R}${QEMU_BINARY}"
393 rm -f "${R}${QEMU_BINARY}"
394
394
395 # Calculate size of the chroot directory in KB
395 # Calculate size of the chroot directory in KB
396 CHROOT_SIZE=$(expr `du -s "$R" | awk '{ print $1 }'`)
396 CHROOT_SIZE=$(expr `du -s "$R" | awk '{ print $1 }'`)
397
397
398 # Calculate the amount of needed 512 Byte sectors
398 # Calculate the amount of needed 512 Byte sectors
399 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
399 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
400 FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
400 FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
401 ROOT_OFFSET=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS})
401 ROOT_OFFSET=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS})
402
402
403 # The root partition is EXT4
403 # The root partition is EXT4
404 # This means more space than the actual used space of the chroot is used.
404 # This means more space than the actual used space of the chroot is used.
405 # As overhead for journaling and reserved blocks 20% are added.
405 # As overhead for journaling and reserved blocks 20% are added.
406 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 20) \* 1024 \/ 512)
406 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 20) \* 1024 \/ 512)
407
407
408 # Calculate required image size in 512 Byte sectors
408 # Calculate required image size in 512 Byte sectors
409 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS})
409 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS})
410
410
411 # Prepare date string for image file name
411 # Prepare date string for image file name
412 DATE="$(date +%Y-%m-%d)"
412 DATE="$(date +%Y-%m-%d)"
413
413
414 # Prepare image file
414 # Prepare image file
415 if [ "$ENABLE_SPLITFS" = true ] ; then
415 if [ "$ENABLE_SPLITFS" = true ] ; then
416 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" bs=512 count=${TABLE_SECTORS}
416 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" bs=512 count=${TABLE_SECTORS}
417 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS}
417 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS}
418 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-root.img" bs=512 count=${TABLE_SECTORS}
418 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-root.img" bs=512 count=${TABLE_SECTORS}
419 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
419 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
420
420
421 # Write firmware/boot partition tables
421 # Write firmware/boot partition tables
422 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" 2> /dev/null <<EOM
422 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" 2> /dev/null <<EOM
423 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
423 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
424 EOM
424 EOM
425
425
426 # Write root partition table
426 # Write root partition table
427 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-debian-${RELEASE}-root.img" 2> /dev/null <<EOM
427 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-debian-${RELEASE}-root.img" 2> /dev/null <<EOM
428 ${TABLE_SECTORS},${ROOT_SECTORS},83
428 ${TABLE_SECTORS},${ROOT_SECTORS},83
429 EOM
429 EOM
430
430
431 # Setup temporary loop devices
431 # Setup temporary loop devices
432 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}-frmw.img)"
432 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}-frmw.img)"
433 ROOT_LOOP="$(losetup -o 1M -f --show $BASEDIR/${DATE}-debian-${RELEASE}-root.img)"
433 ROOT_LOOP="$(losetup -o 1M -f --show $BASEDIR/${DATE}-debian-${RELEASE}-root.img)"
434 else # ENABLE_SPLITFS=false
434 else # ENABLE_SPLITFS=false
435 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=${TABLE_SECTORS}
435 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=${TABLE_SECTORS}
436 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=0 seek=${IMAGE_SECTORS}
436 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=0 seek=${IMAGE_SECTORS}
437
437
438 # Write partition table
438 # Write partition table
439 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-debian-${RELEASE}.img" 2> /dev/null <<EOM
439 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-debian-${RELEASE}.img" 2> /dev/null <<EOM
440 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
440 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
441 ${ROOT_OFFSET},${ROOT_SECTORS},83
441 ${ROOT_OFFSET},${ROOT_SECTORS},83
442 EOM
442 EOM
443
443
444 # Setup temporary loop devices
444 # Setup temporary loop devices
445 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
445 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
446 ROOT_LOOP="$(losetup -o 65M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
446 ROOT_LOOP="$(losetup -o 65M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
447 fi
447 fi
448
448
449 if [ "$ENABLE_CRYPTFS" = true ] ; then
449 if [ "$ENABLE_CRYPTFS" = true ] ; then
450 # Create dummy ext4 fs
450 # Create dummy ext4 fs
451 mkfs.ext4 "$ROOT_LOOP"
451 mkfs.ext4 "$ROOT_LOOP"
452
452
453 # Setup password keyfile
453 # Setup password keyfile
454 echo -n ${CRYPTFS_PASSWORD} > .password
454 echo -n ${CRYPTFS_PASSWORD} > .password
455 chmod 600 .password
455
456
456 # Initialize encrypted partition
457 # Initialize encrypted partition
457 echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password
458 echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password
458
459
459 # Open encrypted partition and setup mapping
460 # Open encrypted partition and setup mapping
460 cryptsetup luksOpen "${ROOT_LOOP}" -d .password "${CRYPTFS_MAPPING}"
461 cryptsetup luksOpen "${ROOT_LOOP}" -d .password "${CRYPTFS_MAPPING}"
461
462
462 # Secure delete password keyfile
463 # Secure delete password keyfile
463 shred -zu .password
464 shred -zu .password
464
465
465 # Update temporary loop device
466 # Update temporary loop device
466 ROOT_LOOP="/dev/mapper/${CRYPTFS_MAPPING}"
467 ROOT_LOOP="/dev/mapper/${CRYPTFS_MAPPING}"
467
468
468 # Wipe encrypted partition (encryption cipher is used for randomness)
469 # Wipe encrypted partition (encryption cipher is used for randomness)
469 dd if=/dev/zero of="${ROOT_LOOP}" bs=512 count=$(blockdev --getsz "${ROOT_LOOP}")
470 dd if=/dev/zero of="${ROOT_LOOP}" bs=512 count=$(blockdev --getsz "${ROOT_LOOP}")
470 fi
471 fi
471
472
472 # Build filesystems
473 # Build filesystems
473 mkfs.vfat "$FRMW_LOOP"
474 mkfs.vfat "$FRMW_LOOP"
474 mkfs.ext4 "$ROOT_LOOP"
475 mkfs.ext4 "$ROOT_LOOP"
475
476
476 # Mount the temporary loop devices
477 # Mount the temporary loop devices
477 mkdir -p "$BUILDDIR/mount"
478 mkdir -p "$BUILDDIR/mount"
478 mount "$ROOT_LOOP" "$BUILDDIR/mount"
479 mount "$ROOT_LOOP" "$BUILDDIR/mount"
479
480
480 mkdir -p "$BUILDDIR/mount/boot/firmware"
481 mkdir -p "$BUILDDIR/mount/boot/firmware"
481 mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware"
482 mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware"
482
483
483 # Copy all files from the chroot to the loop device mount point directory
484 # Copy all files from the chroot to the loop device mount point directory
484 rsync -a "$R/" "$BUILDDIR/mount/"
485 rsync -a "$R/" "$BUILDDIR/mount/"
485
486
486 # Unmount all temporary loop devices and mount points
487 # Unmount all temporary loop devices and mount points
487 cleanup
488 cleanup
488
489
489 # Create block map file(s) of image(s)
490 # Create block map file(s) of image(s)
490 if [ "$ENABLE_SPLITFS" = true ] ; then
491 if [ "$ENABLE_SPLITFS" = true ] ; then
491 # Create block map files for "bmaptool"
492 # Create block map files for "bmaptool"
492 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img"
493 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img"
493 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}-root.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}-root.img"
494 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}-root.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}-root.img"
494
495
495 # Image was successfully created
496 # Image was successfully created
496 echo "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
497 echo "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
497 echo "$BASEDIR/${DATE}-debian-${RELEASE}-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
498 echo "$BASEDIR/${DATE}-debian-${RELEASE}-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
498 else
499 else
499 # Create block map file for "bmaptool"
500 # Create block map file for "bmaptool"
500 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}.img"
501 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}.img"
501
502
502 # Image was successfully created
503 # Image was successfully created
503 echo "$BASEDIR/${DATE}-debian-${RELEASE}.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
504 echo "$BASEDIR/${DATE}-debian-${RELEASE}.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
504 fi
505 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant