-
Notifications
You must be signed in to change notification settings - Fork 310
/
Copy path15_generate_image.sh
executable file
·63 lines (49 loc) · 1.9 KB
/
15_generate_image.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
set -e
# Load common properties and functions in the current script.
. ./common.sh
echo "*** GENERATE IMAGE BEGIN ***"
# Prepare the work area.
rm -f $SRC_DIR/mll_image.tgz
rm -rf $WORK_DIR/mll_image
mkdir -p $WORK_DIR/mll_image
if [ -d $ROOTFS ] ; then
# Copy the rootfs.
cp -r $ROOTFS/* \
$WORK_DIR/mll_image
else
echo "Cannot continue - rootfs is missing."
exit 1
fi
if [ -d $OVERLAY_ROOTFS ] && \
[ ! "`ls -A $OVERLAY_ROOTFS`" = "" ] ; then
echo "Merging overlay software in image."
# Copy the overlay content.
# With '--remove-destination' all possibly existing soft links in
# $WORK_DIR/mll_image will be overwritten correctly.
cp -r --remove-destination $OVERLAY_ROOTFS/* \
$WORK_DIR/mll_image
cp -r --remove-destination $SRC_DIR/minimal_overlay/rootfs/* \
$WORK_DIR/mll_image
else
echo "MLL image will have no overlay software."
fi
cd $WORK_DIR/mll_image
# Generate the image file (ordinary 'tgz').
tar -zcf $SRC_DIR/mll_image.tgz *
cat << CEOF
##################################################################
# #
# Minimal Linux Live image 'mll_image.tgz' has been generated. #
# #
# You can import the MLL image in Docker like this: #
# #
# docker import mll_image.tgz minimal-linux-live:latest #
# #
# Then you can run MLL shell in Docker container like this: #
# #
# docker run -it minimal-linux-live /bin/sh #
# #
##################################################################
CEOF
echo "*** GENERATE IMAGE END ***"