-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlfsbuilder
executable file
·84 lines (62 loc) · 1.7 KB
/
lfsbuilder
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
82
83
84
#!/bin/bash
. config.sh
. lib/ui.sh
. lib/functions.sh
. lib/builder.sh
_init-builder
_before(){
sudo rm -rf "${FOLDER_TMP}"
mkdir -p "${FOLDER_TMP}"
}
_after() {
sudo rm -rf "${FOLDER_TMP}"
}
init() {
_before
mkdir -p "${FOLDER_BUILD}/${HOST_BOX_NAME}"
mkdir -p "${FOLDER_BUILD}/${CLIENT_BOX_NAME}"
cp -r ${FOLDER_ROOT}/src/host/* ${FOLDER_TMP}/ >/dev/null 2>&1
cd "${FOLDER_TMP}"
_make-host-installer-iso
mv -f "${HOST_FOLDER_ISO}/custom.iso" "${FOLDER_BUILD}/host-installer.iso"
Echo ok "Done"
_after
}
make-host() {
if promptyn "This will overwrite the existing virtual machines, are you sure?"; then
# make vbox
_make-host-vbox
# make base-box
vagrant package --base "${HOST_BOX_NAME}" --output "${FOLDER_BUILD}/${HOST_BOX_NAME}.box"
set +o errexit
vagrant box remove "${HOST_BOX_NAME}" >/dev/null 2>&1
set -o errexit
# copy/add base-box to vagrant
vagrant box add "${HOST_BOX_NAME}" "${FOLDER_BUILD}/${HOST_BOX_NAME}.box"
# remove vbox
_unmake-host-vbox
rm -rf "${FOLDER_BUILD}/${HOST_BOX_NAME}"
# remove base-box
rm "${FOLDER_BUILD}/${HOST_BOX_NAME}.box"
Echo ok "Done"
fi
}
start-host() {
# make vagrant
mkdir -p "${FOLDER_BUILD}/${HOST_BOX_NAME}"
cp -rf ${FOLDER_ROOT}/src/host-vagrant/* "${FOLDER_BUILD}/${HOST_BOX_NAME}"
# start vagrant
cd "${FOLDER_BUILD}/${HOST_BOX_NAME}"
vagrant up
Echo ok "Done"
vagrant ssh
}
clean() {
VBoxManage unregistervm lfs-host
rm -rf build
rm -rf .tmp
}
$*
# make-host-installer
# make-virtual-machines
# start-host-installer