-
Notifications
You must be signed in to change notification settings - Fork 7
/
getSources
executable file
·82 lines (66 loc) · 2.65 KB
/
getSources
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
#!/bin/bash -e
#©keithhedger Wed 14 Jun 19:51:12 BST 2017 [email protected]
RED='\e[1;31m'
GREEN='\e[1;32m'
NORMAL='\e[0;0m'
trap 'echo -e "$0 ${RED}FAILED${NORMAL} at line ${GREEN}${LINENO}${NORMAL}"' ERR
LFSVERSION="10.1"
LFSGITVERSION="$LFSVERSION"
SYSTEMSOURCE=cdtree/LFS/LFSSourceArchives/$LFSVERSION/SYSTEM
NETSOURCE=cdtree/LFS/LFSSourceArchives/$LFSVERSION/NET
SYSSOURCE=cdtree/LFS/LFSSourceArchives/$LFSVERSION/SYS
WGET_VERS=1.21.1
#other mirrors are available here:
#https://www.linuxfromscratch.org/mirrors.html#files
LFSSOURCES="https://lfs.gnlug.org/pub/lfs/lfs-packages/10.1/"
WGETTAR="https://ftp.gnu.org/gnu/wget/wget-$WGET_VERS.tar.gz"
UNZIPTAR="http://downloads.sourceforge.net/infozip/unzip60.tar.gz"
TOOLS32TAR="https://github.com/KeithDHedger/LFSBootCD/releases/download/${LFSGITVERSION}/tools-${LFSGITVERSION}_32.tar.bz2"
TOOLS64TAR="https://github.com/KeithDHedger/LFSBootCD/releases/download/${LFSGITVERSION}/tools-${LFSGITVERSION}_64.tar.bz2"
LFSPKGBUILDS="https://github.com/KeithDHedger/LFSPkgBuilds/archive/${LFSGITVERSION}.zip"
#Or:
#git clone --single-branch --branch ${LFSGITVERSION} https://github.com/KeithDHedger/LFSPkgBuilds
LFSPKG="https://github.com/KeithDHedger/LFSPkg/archive/master.zip"
mkdir -vp cdtree/LFS $NETSOURCE $SYSSOURCE ${SYSTEMSOURCE}||true
if [ ! -e $SYSTEMSOURCE/gotsystemsources ];then
pushd ${SYSTEMSOURCE}
wget -c -r -l1 -nH --reject="index.html*" --cut-dirs=4 "$LFSSOURCES"
popd
#wget/unzip from the blfs book I prefer to make this as part of the main system
wget -c "$WGETTAR" -P $NETSOURCE||true
wget -c "$UNZIPTAR" -P $SYSSOURCE||true
touch $SYSTEMSOURCE/gotsystemsources
pushd $SYSTEMSOURCE
if ! md5sum -c md5sums;then
echo "WARNING ... md5 hashes did NOT match, Exiting ..."
exit 1
fi
rm md5sums
popd
fi
if [ ! -e cdtree/LFS/gottools ];then
wget -c "$TOOLS32TAR" -P cdtree/LFS
wget -c "$TOOLS64TAR" -P cdtree/LFS
touch cdtree/LFS/gottools
fi
if [ ! -e cdtree/LFS/gotpkgbuilds ];then
pushd cdtree/LFS
git clone https://github.com/KeithDHedger/LFSPkgBuilds.git --branch 10.1 --single-branch
pushd LFSPkgBuilds/LFSPkgBuildScripts/admin/LFSPkg
wget -c $LFSPKG
unzip master.zip
rm master.zip
popd
touch gotpkgbuilds
popd
fi
(
LFSVERSION=$LFSVERSION xtrasanyarch/usr/bin/getversions
cp ./PkgVersions cdtree/LFS/LFSPkgBuilds/LFSScripts/LFSInitBuild
mv ./PkgVersions cdtree/LFS/LFSPkgBuilds/LFSScripts/SysVBuild
LFSVERSION="systemd" xtrasanyarch/usr/bin/getversions
mv ./PkgVersions cdtree/LFS/LFSPkgBuilds/LFSScripts/SystemDBuild
rm cdtree/LFS/LFSPkgBuilds/LFSPkgBuildScripts/kernel/PkgVersions||true
rm cdtree/LFS/LFSPkgBuilds/LFSPkgBuildScripts/system/PkgVersions||true
)||true
exit 0