-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildrun.sh
executable file
·83 lines (48 loc) · 1.41 KB
/
buildrun.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# Globals to control the build process
HOSTNAME="esi"
BUILD_DIR="rootfs"
IMAGE="hdd.img"
USE_LOCAL_REPO="false"
LOCAL_REPO="http://localhost:8778/deian/amd64 /"
PACKAGES_FILE="conf/packages"
INCLUDE_PACKAGES=""
KEEP_DEBOOTSTRAP_DIR="true"
DEBOOTSTRAP_VERBOSE="true"
IMAGE_SIZE=0
ROOTFS_SIZE="" # Please, don't set this
LOOP_DEV=""
MOUNT_DIR="/tmp/mnt/"
GENERATE_VBOX_VDI="false"
##### build process #####
. core/_stderr.sh
[ "$(id -u)" -ne 0 ] && fatal "${0##*\/} must be run as root(0)"
[ $# -ne 1 ] && fatal "rootfs dir is not specified !"
BUILD_DIR="$1"
BUILD_DIR=${BUILD_DIR%%/}
info "Starting build process"
for script in core/_*.sh; do
[ ! -x "${script}" ] && chmod u+x "${script}";
. "${script}";
done
include_packages SYS_PACKAGES BASE_PACKAGES NET_PACKAGES GUI_PACKAGES
if ! check_build_dir; then
fatal "Build directory does not exist!"
fi
info "Preparing build dir"
if [ "$(ls -A ${BUILD_DIR} )" ]; then
fatal "Build directory is not empty, removing its content is required!"
#empty_build_dir #we maybe need a confirmation input before applying this!
fi
if [[ "${USE_LOCAL_REPO}" == "true" ]]; then
spinup_local_repo;
fi
debootstrap_rootfs
generate_system_image
create_partitions
copy_rootfs_sysimg
if [[ "${GENERATE_VBOX_VDI}" == "true" ]]; then
info "Using VBoxManage to generate VDI image from RAW image ..."
generate_vbox_vdi;
fi
finish_installation