Skip to content

Commit

Permalink
fixes for 10.1 64bit
Browse files Browse the repository at this point in the history
  • Loading branch information
KeithDHedger committed Apr 28, 2021
1 parent 1f2785b commit fb042fc
Show file tree
Hide file tree
Showing 9 changed files with 6,727 additions and 84 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ wget-list*
LFSBootCD*
root_tree32/
root_tree64/
xtrasanyarch/usr/bin/PkgVersions
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

VERSION=9.0
VERSION=10.1
TOPDIR=$(shell pwd)
ISODEPS=$(shell find $(TOPDIR)/cdtree -not -name "\.*")
BOOTCDNAME=LFSBootCD-$(VERSION).iso
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ You MAY need the git lfs plugin available here:
https://git-lfs.github.com/

All commands marked with * MUST be run as root to preserve permissions ( don't type the *! ).
Remove source archives as well.
*make clean

This doesn't remove source files/archives.
Expand Down
60 changes: 42 additions & 18 deletions getSources
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/bin/bash
#!/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="9.0"
LFSVERSION="10.1"
LFSGITVERSION="$LFSVERSION"
#LFSGITVERSION="dev"

SYSTEMSOURCE=cdtree/LFS/LFSSourceArchives/$LFSVERSION/SYSTEM
NETSOURCE=cdtree/LFS/LFSSourceArchives/$LFSVERSION/NET
SYSSOURCE=cdtree/LFS/LFSSourceArchives/$LFSVERSION/SYS
WGET_VERS=1.20.3
WGET_VERS=1.21.1

WGETTAR="https://ftp.gnu.org/gnu/wget/wget-$WGET_VERS.tar.gz"
UNZIPTAR="http://downloads.sourceforge.net/infozip/unzip60.tar.gz"
Expand All @@ -26,41 +29,51 @@ LFSPKG="https://github.com/KeithDHedger/LFSPkg/archive/master.zip"
mkdir -vp cdtree/LFS $NETSOURCE $SYSSOURCE $SYSTEMSOURCE||true

if [ ! -e $SYSTEMSOURCE/gotsystemsources ];then
wget http://www.linuxfromscratch.org/lfs/view/$LFSVERSION/wget-list
wget http://www.linuxfromscratch.org/lfs/view/$LFSVERSION/md5sums
wget https://www.linuxfromscratch.org/lfs/view/$LFSVERSION/wget-list||true
. xtrasanyarch/usr/bin/RunSeds
wget https://www.linuxfromscratch.org/lfs/view/$LFSVERSION/md5sums||true
mv md5sums $SYSTEMSOURCE
wget -i wget-list -c -P $SYSTEMSOURCE
wget -nc -i wget-list -c -P $SYSTEMSOURCE||true
rm wget-list
wget https://www.linuxfromscratch.org/lfs/view/systemd/wget-list||true
wget https://www.linuxfromscratch.org/lfs/view/systemd/md5sums||true
wget -nc -i wget-list -c -P $SYSTEMSOURCE||true
mv md5sums ${SYSTEMSOURCE}/md5sumsd

#wget/unzip from the blfs book I prefer to make this as part of the main system
wget -c "$WGETTAR" -P $NETSOURCE
wget -c "$UNZIPTAR" -P $SYSSOURCE
wget -c "$WGETTAR" -P $NETSOURCE||true
wget -c "$UNZIPTAR" -P $SYSSOURCE||true

touch $SYSTEMSOURCE/gotsystemsources
rm wget-list

pushd $SYSTEMSOURCE
if ! md5sum -c md5sums;then
echo "WARNING ... md5 hashes did NOT match, Exiting ..."
exit 1
fi
if ! md5sum -c md5sumsd;then
echo "WARNING ... md5 hashes did NOT match, Exiting ..."
exit 1
fi
rm md5sumsd md5sums
popd

fi

if [ ! -e cdtree/LFS/gottools ];then
wget -c "$TOOLS32TAR" -P cdtree/LFS
wget -c "$TOOLS64TAR" -P cdtree/LFS
wget -c "$TOOLS64SYTEMDTAR" -P cdtree/LFS
# 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
wget -c "$LFSPKGBUILDS"
unzip ${LFSGITVERSION}.zip
mv LFSPkgBuilds-${LFSGITVERSION} LFSPkgBuilds
rm -r LFSPkgBuilds/.gitignore ${LFSGITVERSION}.zip
cp -r ../../LFSScripts/BuildFileSystem LFSPkgBuilds/LFSScripts
#wget -c "$LFSPKGBUILDS"
#unzip ${LFSGITVERSION}.zip
#mv LFSPkgBuilds-${LFSGITVERSION} LFSPkgBuilds
#rm -r LFSPkgBuilds/.gitignore ${LFSGITVERSION}.zip
git clone https://github.com/KeithDHedger/LFSPkgBuilds.git --branch 10.1 --single-branch
pushd LFSPkgBuilds/LFSPkgBuildScripts/admin/LFSPkg
wget -c $LFSPKG
unzip master.zip
Expand All @@ -70,5 +83,16 @@ if [ ! -e cdtree/LFS/gotpkgbuilds ];then
popd
fi

(
LFSVERSION=$LFSVERSION xtrasanyarch/usr/bin/getversions
cp ./PkgVersions cdtree/LFS/LFSPkgBuilds/LFSScripts/LFSInitBuild
mv ./PkgVersions cdtree/LFS/LFSPkgBuilds/LFSScripts/SysVBuild
rm wget-list
LFSVERSION="systemd" xtrasanyarch/usr/bin/getversions
mv ./PkgVersions cdtree/LFS/LFSPkgBuilds/LFSScripts/SystemDBuild
rm wget-list||true
rm cdtree/LFS/LFSPkgBuilds/LFSPkgBuildScripts/kernel/PkgVersions||true
rm cdtree/LFS/LFSPkgBuilds/LFSPkgBuildScripts/system/PkgVersions||true
)||true
exit 0

92 changes: 63 additions & 29 deletions xtrasanyarch/usr/bin/LFSSetUp
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ readWithDefault ()
fi
}

case $(uname -m) in
x86_64)
LIBDIRSUFFIX=64
LFSNAME=${LFSNAME:-"LFS9064"}
;;
*)
LIBDIRSUFFIX=""
LFSNAME=${LFSNAME:-"LFS9032"}
;;
esac

PIBUILD=0
USESYSTEMD=0

Expand All @@ -58,17 +47,37 @@ LFS=${LFS:-"/mnt/LFS"}
readWithDefault "LFS" "Enter Mountpoint For LFS"

#LFS Version
LFSVERSION=${LFSVERSION:-9.0}
LFSVERSION=${LFSVERSION:-10.1}
readWithDefault "LFSVERSION" "Enter Version"

case $(uname -m) in
x86_64)
LIBDIRSUFFIX=64
LFSNAME=${LFSNAME:-"LFS${LFSVERSION//./}64"}
;;
*)
LIBDIRSUFFIX=""
LFSNAME=${LFSNAME:-"LFS${LFSVERSION//./}32"}
;;
esac

#Computer name
readWithDefault "LFSNAME" "Enter Hostname"

#cp files etc
cp -r ${CDROMMOUNT}/LFS/LFSPkgBuilds ${LFS}
ln -sfv LFSPkgBuilds/LFSPkgBuildScripts .

#LFS init type eithe bbinit or sysvinit
INITTYPE=${INITTYPE:-"sysvinit"}
readWithDefault "INITTYPE" "Enter Init Type (LFSInit|bbinit|systemd|sysvinit))"
readWithDefault "INITTYPE" "Enter Init Type (LFSInit|systemd|sysvinit))"
if [ "$INITTYPE" = "systemd" ];then
USESYSTEMD=1
. ${LFS}/LFSPkgBuilds/LFSScripts/SystemDBuild/PkgVersions
KERNELVERSION=${KERNELVERSION:-$linux_version}
else
. ${LFS}/LFSPkgBuilds/LFSScripts/SysVBuild/PkgVersions
KERNELVERSION=${KERNELVERSION:-$linux_version}
fi

#libdir suffix
Expand All @@ -88,7 +97,6 @@ readWithDefault "SOURCEARCHIVES" "Enter Folder For Source Archives"

#kernal version
#if the kernel version you want to use is not the same as the book you will have to manually download the source to $SOURCEARCHIVES
KERNELVERSION=${KERNELVERSION:-"5.2.8"}
readWithDefault "KERNELVERSION" "Enter Kernel Version"

#keyboard
Expand All @@ -114,11 +122,11 @@ LANGUAGE=${LANGUAGE:-$LANG}
readWithDefault "LANGUAGE" "Enter Language"

#network
IP="192.168.1.1"$(echo $ROOTDEV|sed 's/^[a-zA-Z\/]*//')
IP=${IP:-"$(ifconfig |grep "inet addr"|head -n1|awk -F: '{print $2}'|awk '{print $1}'|sed 's/\(.*\)\..*$/\1/').$(echo $ROOTDEV|sed 's/^[a-zA-Z\/]*//')"}
readWithDefault "IP" "Enter IP"

#Set up the network
GATEWAY=${GATEWAY:-"192.168.1.254"}
GATEWAY=${GATEWAY:-"$(route |grep default|awk '{print $2}')"}
readWithDefault "GATEWAY" "Enter Gateway IP"

SUBNET=${SUBNET:-"255.255.255.0"}
Expand Down Expand Up @@ -161,28 +169,32 @@ if [ $SUMMARY = "n" ];then
exit 1
fi

#cp files etc
cp -r ${CDROMMOUNT}/LFS/LFSPkgBuilds ${LFS}
ln -sfv LFSPkgBuilds/LFSPkgBuildScripts .
ln -sfv LFSPkgBuilds/LFSScripts .

mkdir -p ${LFS}/tools
pushd ${LFS}/tools
pushd ${LFS}
mkdir -vp ${LFS}/${SOURCEARCHIVES}/KERNEL
mkdir -vp "${LFS}/${SOURCEARCHIVES}" "${LFS}/$BUILTPACKAGES"
case $(uname -m) in
*64)
if [ $USESYSTEMD -eq 1 ];then
tar -xvf ${CDROMMOUNT}/LFS/tools-systemd-${LFSVERSION}_64.tar.bz2
else
tar -xvf ${CDROMMOUNT}/LFS/tools-${LFSVERSION}_64.tar.bz2
fi
tar -xvf ${CDROMMOUNT}/LFS/tools-${LFSVERSION}_64.tar.bz2
;;
*)
tar -xvf ${CDROMMOUNT}/LFS/tools-${LFSVERSION}_32.tar.bz2
;;
esac

if [ "$USESYSTEMD" -eq 0 ];then
ln -snvf LFSPkgBuilds/LFSScripts/SysVBuild LFSScripts
ln -snvf ../../../LFSScripts/PkgVersions LFSPkgBuilds/LFSPkgBuildScripts/system/PkgVersions
else
if [ "$INITTYPE" = "LFSInit" ];then
ln -snvf LFSPkgBuilds/LFSScripts/LFSInitBuild LFSScripts
ln -snvf ../../../LFSScripts/PkgVersions LFSPkgBuilds/LFSPkgBuildScripts/kernel/PkgVersions
else
ln -snvf LFSPkgBuilds/LFSScripts/SystemDBuild LFSScripts
ln -snvf ../../../LFSScripts/PkgVersions LFSPkgBuilds/LFSPkgBuildScripts/kernel/PkgVersions
fi
fi
popd

mkdir -vp "${LFS}/$SOURCEARCHIVES" "${LFS}/$BUILTPACKAGES"
cp -rv ${CDROMMOUNT}/LFS/LFSSourceArchives/${LFSVERSION}/* ${LFS}/$SOURCEARCHIVES

#set kernel version in build scripts
Expand All @@ -191,6 +203,11 @@ sed -ri 's/^VERSION="[0-9]+.[0-9]+.[0-9]+"/VERSION="'"${KERNELVERSION}"'"/' ${LF

ln -svf system-${INITTYPE}-meta.LFSBuild ${LFS}/${BUILDSCRIPTS}/system/system-meta/system-meta.LFSBuild

pushd ${LFS}/${SOURCEARCHIVES}/KERNEL
ln -sv ../SYSTEM/linux-$KERNELVERSION.tar.xz linux-$KERNELVERSION.tar.xz
ln -svfn ../../../LFSScripts/PkgVersions
popd

cat > $LFS/LFSScripts/SystemData.local << EOF
CDROMMOUNT=$CDROMMOUNT
Expand Down Expand Up @@ -235,6 +252,23 @@ PIBUILD=$PIBUILD
LANG=$LANGUAGE
EOF

rm ${LFS}/etc/fstab
cat > ${LFS}/etc/fstab << EOF
# Begin /etc/fstab
#file system mount-point type options dump fsck order
$ROOTDEV / $ROOTFSTYPE defaults 1 1
$SWAP swap swap pri=1 0 0
proc /proc proc nosuid,noexec,nodev 0 0
sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
# End /etc/fstab
EOF

cat > ${LFS}/${BUILDSCRIPTS}/system/grub/grub.cfg << EOF
# Begin /boot/grub/grub.cfg
Expand Down
5 changes: 5 additions & 0 deletions xtrasanyarch/usr/bin/RunSeds
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -e

#©keithhedger Sat 24 Apr 13:33:18 BST 2021 [email protected]

sed -i 's|http://www.linuxfromscratch.org/patches/lfs/10.1/\([[:alnum:]][[:alnum:]]*\)\-\(.*\)|https://www.linuxfromscratch.org/patches/downloads/\1/\1-\2|g' wget-list
49 changes: 49 additions & 0 deletions xtrasanyarch/usr/bin/getversions
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash -e

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=${LFSVERSION:-"10.1"}

rm wget-list||true
wget "https://www.linuxfromscratch.org/lfs/view/$LFSVERSION/wget-list"
:>"./PkgVersions"

while read
do
case $REPLY in
*html*)
echo "ignoring $REPLY ..."
;;
*.patch)
echo "ignoring $REPLY ..."
;;
*tzdata*)
basename "${REPLY,,}"|sed 's/\([[:alpha:]]*\)\([[:digit:]]*\).*/\1_version=\2/' >> "./PkgVersions"
basename "${REPLY,,}"|sed 's/.*[0-9]\(.\).*/tzdata_minor_rev=\1/' >> "./PkgVersions"
basename "${REPLY,,}"|sed 's/\([[:alpha:]]*\)[[:digit:]]*..\(tar\..*\)*/\1_arctype=\2/' >> "./PkgVersions"
;;
*openssl*)
basename "${REPLY,,}"|sed 's/.\.tar\..*$//'|sed 's/\(.*\)-\(.*\)/\1_version=\2/' >> "./PkgVersions"
echo $REPLY|sed 's|.*\(.\)\.tar.*|openssl_minor_rev=\1|' >> "./PkgVersions"
basename "${REPLY,,}"|sed 's/\(.*\)-.*\(tar\..*\)/\1_arctype=\2/'|tr "-" "_" >> "./PkgVersions"
;;
*expect*)
basename "${REPLY,,}"|sed 's/expect\([0-9.]*\)\.tar\..*/expect_version=\1/' >> "./PkgVersions"
basename "${REPLY,,}"|sed 's/\([[:alpha:]]*\).*\.\(tar\..*\)/\1_arctype=\2/' >> "./PkgVersions"
;;
*tcl*)
basename "${REPLY,,}"|sed 's/tcl\([0-9]*\)/tcl_version=\1/'|sed 's/-src.*//' >> "./PkgVersions"
basename "${REPLY,,}"|sed 's/.*src\.\(tar\..*\)/tcl_arctype=\1/' >> "./PkgVersions"
;;
*)
basename "${REPLY,,}"|sed 's/\.tar\..*$//'|sed 's/\(.*\)-\(.*\)/\1_version=\2/'|tr "-" "_" >> "./PkgVersions"
basename "${REPLY,,}"|sed 's/\(.*\)-.*\(tar\..*\)/\1_arctype=\2/'|tr "-" "_" >> "./PkgVersions"
;;
esac
done < <(cat wget-list)

. $(dirname $0)/RunSeds
Loading

0 comments on commit fb042fc

Please sign in to comment.