-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path15-file.sh
executable file
·57 lines (53 loc) · 1.91 KB
/
15-file.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
#!/bin/bash
# QQ群:111601117、钉钉群:35948877
source `dirname ${BASH_SOURCE[0]}`/lfs.sh
# 配置LFS用户编译任务
if [ "$USER" != "lfs" ]; then
cp "$LFS_PROJECT/`basename ${BASH_SOURCE[0]}`" /home/lfs/build.sh
cp "$LFS_PROJECT/lfs.sh" /home/lfs/
cp "$LFS_PROJECT/lfs.conf" /home/lfs/
chown lfs:lfs /home/lfs/build.sh
chown lfs:lfs /home/lfs/lfs.sh
chown lfs:lfs /home/lfs/lfs.conf
[ ! -e /etc/bash.bashrc ] || mv -v /etc/bash.bashrc /etc/bash.bashrc.NOUSE
su - lfs
[ ! -e /etc/bash.bashrc.NOUSE ] || mv -v /etc/bash.bashrc.NOUSE /etc/bash.bashrc
rm -f /home/lfs/build.sh
rm -f /home/lfs/lfs.sh
rm -f /home/lfs/lfs.conf
exit
fi
# 来自lfs用户的调用
pushd $LFS/sources/$(getConf LFS_VERSION)
PKG_NAME=file
PKG_PATH=$(find stage2 -maxdepth 1 -type d -name "$PKG_NAME-*")
if [ -z $PKG_PATH ]; then
tar -xpvf $(find . -maxdepth 1 -type f -name "$PKG_NAME-*.tar.*") --directory stage2
PKG_PATH=$(find stage2 -maxdepth 1 -type d -name "$PKG_NAME-*")
fi
if [ ! -f $PKG_PATH/_BUILD_DONE ]; then
pushd $PKG_PATH
# 宿主系统 file 命令的版本必须和正在构建的软件包相同
mkdir build
pushd build
../configure --disable-bzlib \
--disable-libseccomp \
--disable-xzlib \
--disable-zlib
make
popd
sleep 5
# 编译
./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess)
make FILE_COMPILE=$(pwd)/build/src/file && make DESTDIR=$LFS install
if [ $? = 0 ]; then
# 移除对交叉编译有害的 libtool 档案文件
rm -v $LFS/usr/lib/libmagic.la
touch _BUILD_DONE
else
pwd
exit 1
fi
popd
fi
popd