-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
78 lines (56 loc) · 1.66 KB
/
start.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
#!/bin/bash
./version-check.sh
[ "$?" == "1" ]; exit 1 || rm -f a.out
sudo apt install binutils bison gawk gcc m4 make patch texinfo build-essential -y
export LFS=/mnt/LFS
export LFS_TGT=x86_64-kawsar-linux-gnu
export LFS_DISK=/dev/sdb
if ! grep -q "$LFS" /proc/mounts; then
source setupdisk.sh "$LFS_DISK"
sudo mkdir -pv "$LFS"
sudo mount "${LFS_DISK}2" "$LFS"
sudo chown -v lfs "$LFS"
fi
mkdir -pv $LFS/sources
chmod -v a+wt $LFS/sources
mkdir -pv $LFS/tools
mkdir -pv $LFS/{etc,var,boot} $LFS/usr/{bin,lib,sbin}
chown -v lfs $LFS/{usr{,/*},var,etc,tools}
for i in bin lib sbin; do
sudo ln -sv usr/$i $LFS/$i
done
case $(uname -m) in
x86_64) mkdir -pv $LFS/lib64 ;;
esac
cp -rf *.sh md5sums wget-list Chapter* $LFS/sources
cd "$LFS/sources"
export PATH="$LFS/tools/bin:$PATH"
source $LFS/sources/download.sh
#CPU Core
export MAKEFLAGS='-j8'
for p in binutils gcc linux glibc; do
source packageinstall.sh 5 ${p}
done
pushd "$LFS/gcc"
source $LFS/sources/Chapter5/libstc.sh
popd
for p in m4 ncurses bash coreutils diffutils file findutils gawk grep gzip make patch sed tar xz binutils gcc; do
source packageinstall.sh 6 ${p}
done
chmod ugo+x preparechroot.sh
chmod ugo+x insidechroot.sh
chmod ugo+x insidechroot2.sh
sudo ./preparechroot.sh "$LFS"
echo "Entering CHROOT Environment..."
sleep 3
for script in "/sources/insidechroot.sh" "/sources/insidechroot2.sh"; do
echo "RUNNING $script IN CHROOT!"
sleep 3
sudo chroot "$LFS" /usr/bin/env \
HOME=/root \
TERM="$TERM" \
PS1='(lfs chroot) \u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
TESTERUID=$UID \
/bin/bash --login +h -c "$script"
done