-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun.sh
executable file
·64 lines (51 loc) · 1.32 KB
/
run.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
#!/bin/bash
# using : setup box and use it to setup gnu/linux system
# params :
# $1
# box: enter container environemnt under lfs user
# tmp-sys: enter virtual-kernel.temporary-system under root user
# sys: enter virtual-kernel.system under root user
# "other": run setup imediately
# author : [email protected]
# bash options
set -e
# script.verify
./script.verify.sh
# enssential-dir.mkdir
mkdir -vp log tmp disk
# libs
source config.sh
source util.sh
# variables
task_name="lfs"
lfs_disk_path="disk/$lfs_disk_file"
script_dir=$(realpath ./script)
# log-file.clear
clear_log
log "$task_name.start" 0
# host.pack.setup
./host.pack.setup.sh
# host.fs.setup
./host.fs.setup.sh
# box.setup
log "$task_name.box.setup.start" 0
cd box
docker build -t $docker_name ./
log "$task_name.box.setup.finish" $?
cd ..
# box.active
# mount hard disk use to build lfs into docker
# $root:root is mean <host-file-system>:<docker-file-system>
# transfer control to /lfs-script/box.entry.sh
log "$task_name.box.start" 0
docker run -ti --privileged \
-v "$root":"$root" \
-v "$script_dir":"$docker_script_dir" "$docker_name" \
bash /lfs-script/box.entry.sh "$@"
log "$task_name.box.finish" $?
# file-system.umount
sudo umount /mnt/lfs
log "lfs-disk.umount" $?
# successfull
log "$task_name.finish" $?
exit 0