Skip to content

Instantly share code, notes, and snippets.

@josephabrahams
Last active March 9, 2023 12:15
Show Gist options
  • Save josephabrahams/45214de199175055078b to your computer and use it in GitHub Desktop.
Save josephabrahams/45214de199175055078b to your computer and use it in GitHub Desktop.
Linux From Scratch Ubuntu 14.04 Host System Requirements Install Script
#!/usr/bin/env bash
# Install missing Linux From Scratch Host System Requirements for Ubuntu 14.04
if [ ! $(whoami) == "root" ]; then
echo "Please run as root!"
exit 1
fi
# symlink sh to bash
ln -fsv /bin/bash /bin/sh
# install missing apt-get packages
apt-get install build-essential bison gawk
# download packages that need to be compiled
mkdir -pv /tmp/lfs
wget -P /tmp/lfs http://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.xz
wget -P /tmp/lfs http://www.mpfr.org/mpfr-3.1.2/mpfr-3.1.2.tar.xz
wget -P /tmp/lfs http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.gz
# check md5sums
md5sums=$(cat <<EOF
e5fe367801ff067b923d1e6a126448aa /tmp/lfs/gmp-5.1.3.tar.xz
68fadff3358fb3e7976c7a398a0af4c3 /tmp/lfs/mpc-1.0.2.tar.gz
e3d203d188b8fe60bb6578dd3152e05c /tmp/lfs/mpfr-3.1.2.tar.xz
EOF
)
echo "$md5sums" | md5sum -c --quiet
if [ ! 0 -eq $? ]; then
echo "Aborting"
exit 1
fi
# install GMP
tar -C /tmp/lfs -Jxvf /tmp/lfs/gmp-5.1.3.tar.xz
cd /tmp/lfs/gmp-5.1.3; ./configure --prefix=/usr
make
make install
# install MPFR
tar -C /tmp/lfs -Jxvf /tmp/lfs/mpfr-3.1.2.tar.xz
cd /tmp/lfs/mpfr-3.1.2; ./configure --prefix=/usr
make
make install
# install MPC
tar -C /tmp/lfs -zxvf /tmp/lfs/mpc-1.0.2.tar.gz
cd /tmp/lfs/mpc-1.0.2; ./configure --prefix=/usr
make
make install
# clean up
rm -rf /tmp/lfs
echo "Done"
@josephabrahams
Copy link
Author

@zenmiser
Copy link

Thank you for this. I added texinfo after gawk on line 13 on my setup because linux mint 17.3 lacked makeinfo package. I am truly grateful for this. Good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment