This repository has been archived by the owner on May 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·93 lines (69 loc) · 1.75 KB
/
build.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
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
path=$(dirname $0)
source "$path"/etc/colors.sh
source "$path"/etc/settings.sh
source "$path"/etc/functions.sh
source "$path"/etc/env.sh
clean_sources
clean_logs
exec 7>&1
exec 8>&2
SHELL_PID="$$"
echo -e "${bblack}${white}Constructing a Temporary System${normal}"
BUILDS_DIR="$LFS/alfs/build_tmp_sys"
if [[ ! -d "$BUILDS_DIR" ]]; then
echo -e "${red}Could not found \"$BUILDS_DIR\" directory${normal}"
exit 1
fi
LOG_DIR="$LOG_TMP_SYS_DIR"
for build in "$BUILDS_DIR"/*; do
build_name=$(basename "$build")
LOG=${build_name%%.xml.sh}
LOG="$LOG_DIR"/"$LOG".log
echo -e "${bblack}${yellow}Building: ${lgreen}$build_name${normal}"
echo -e "${bblack}${yellow}Log: ${white}$LOG${normal}"
clean_sources
cd "$LFS/sources"
touch "$LOG"
tail -f "$LOG" --pid="$SHELL_PID" &
PID=$!
echo "$PID" >> "$LOG_DIR"/tails.pid
exec 1>> "$LOG"
exec 2>> "$LOG"
source "$build" || exit 1
kill "$PID"
exec 1>&7
exec 2>&8
cd "$LFS/sources"
clean_sources
done
echo -e "${bblack}${white}Installing Basic System Software${normal}"
BUILDS_DIR="$LFS/alfs/build_sys"
if [[ ! -d "$BUILDS_DIR" ]]; then
echo -e "${red}Could not found \"$BUILDS_DIR\" directory${normal}"
exit 1
fi
LOG_DIR="$LOG_SYS_DIR"
for build in "$BUILDS_DIR"/*; do
build_name=$(basename "$build")
LOG=${build_name%%.xml.sh}
LOG="$LOG_DIR"/"$LOG".log
echo -e "${bblack}${yellow}Building: ${lgreen}$build_name${normal}"
echo -e "${bblack}${yellow}Log: ${white}$LOG${normal}"
clean_sources
cd "$LFS/sources"
touch "$LOG"
tail -f "$LOG" --pid="$SHELL_PID" &
PID=$!
echo "$PID" >> "$LOG_DIR"/tails.pid
exec 1>> "$LOG"
exec 2>> "$LOG"
source "$build" || exit 1
kill "$PID"
exec 1>&7
exec 2>&8
cd "$LFS/sources"
clean_sources
done
echo
echo -e "${bbalck}${white}Well done =)${normal}"