From 9aa73f1877b62355a7589150c2c558529f343cba Mon Sep 17 00:00:00 2001 From: emmett1 Date: Sun, 2 Dec 2018 08:19:43 +0800 Subject: [PATCH] updated --- 01-toolchain | 19 +++++++++++++++++++ 02-lfs-base | 5 +++++ 03-mklfsiso | 5 +++++ toolchain/02-gcc-pass1 | 3 ++- toolchain/07-gcc-pass2 | 3 ++- toolchain/functions | 13 ------------- 6 files changed, 33 insertions(+), 15 deletions(-) diff --git a/01-toolchain b/01-toolchain index 86d4993..65b96f8 100755 --- a/01-toolchain +++ b/01-toolchain @@ -1,7 +1,26 @@ #!/bin/bash -e +if [ $(id -u) = 0 ]; then + echo "$0 script need to run as regular user!" + exit 1 +fi + source $(dirname $0)/toolchain/functions +if [ "$1" != "fetch" ]; then + if [ ! -d $LFS/tools ]; then + sudo mkdir -pv $LFS/tools + fi + + if [ ! -w $LFS ]; then + sudo chown -Rv $USER:$USER $LFS + fi + + if [ ! -L /tools ] || [ $(realpath /tools) != $LFS/tools ]; then + sudo ln -svf $LFS/tools / + fi +fi + for script in $(ls toolchain | grep ^[0-9]); do if [ "$1" = "fetch" ]; then $(dirname $0)/toolchain/$script "$1" diff --git a/02-lfs-base b/02-lfs-base index f026dd6..b2f5980 100755 --- a/02-lfs-base +++ b/02-lfs-base @@ -1,5 +1,10 @@ #!/bin/bash +if [ $(id -u) != 0 ]; then + echo "$0 script need to run as root!" + exit 1 +fi + LFS=/mnt/lfs lfs_dirs() { diff --git a/03-mklfsiso b/03-mklfsiso index 98c2f70..f2ac473 100755 --- a/03-mklfsiso +++ b/03-mklfsiso @@ -1,5 +1,10 @@ #!/bin/bash +if [ $(id -u) != 0 ]; then + echo "$0 script need to run as root!" + exit 1 +fi + trap "exit 1" SIGHUP SIGINT SIGQUIT SIGTERM LFSVERSIOM=8.3 diff --git a/toolchain/02-gcc-pass1 b/toolchain/02-gcc-pass1 index f891b28..9f16d99 100755 --- a/toolchain/02-gcc-pass1 +++ b/toolchain/02-gcc-pass1 @@ -12,7 +12,8 @@ SRC=${SRC:-$(dirname $0)/src} NAME=gcc VERSION=${GCC_VER} -fetch "http://www.mpfr.org/mpfr-$MPFR_VER/mpfr-$MPFR_VER.tar.xz" $SRC +fetch "http://ftp.osuosl.org/pub/lfs/lfs-packages/8.3/mpfr-$MPFR_VER.tar.xz" $SRC +#fetch "http://www.mpfr.org/mpfr-$MPFR_VER/mpfr-$MPFR_VER.tar.xz" $SRC fetch "https://ftp.gnu.org/gnu/mpc/mpc-$MPC_VER.tar.gz" $SRC fetch "http://ftp.gnu.org/gnu/gmp/gmp-$GMP_VER.tar.xz" $SRC fetch "http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.xz" $SRC diff --git a/toolchain/07-gcc-pass2 b/toolchain/07-gcc-pass2 index a0b3ab9..2c94513 100755 --- a/toolchain/07-gcc-pass2 +++ b/toolchain/07-gcc-pass2 @@ -12,7 +12,8 @@ SRC=${SRC:-$(dirname $0)/src} NAME=gcc VERSION=${GCC_VER} -fetch "http://www.mpfr.org/mpfr-$MPFR_VER/mpfr-$MPFR_VER.tar.xz" $SRC +fetch "http://ftp.osuosl.org/pub/lfs/lfs-packages/8.3/mpfr-$MPFR_VER.tar.xz" $SRC +#fetch "http://www.mpfr.org/mpfr-$MPFR_VER/mpfr-$MPFR_VER.tar.xz" $SRC fetch "https://ftp.gnu.org/gnu/mpc/mpc-$MPC_VER.tar.gz" $SRC fetch "http://ftp.gnu.org/gnu/gmp/gmp-$GMP_VER.tar.xz" $SRC fetch "http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.xz" $SRC diff --git a/toolchain/functions b/toolchain/functions index d85c718..88ff950 100755 --- a/toolchain/functions +++ b/toolchain/functions @@ -34,16 +34,3 @@ fetch() { fi } - -if [ ! -d $LFS/tools ]; then - sudo mkdir -pv $LFS/tools -fi - -if [ ! -w $LFS ]; then - sudo chown -Rv $USER:$USER $LFS -fi - -if [ ! -L /tools ] || [ $(realpath /tools) != $LFS/tools ]; then - sudo ln -svf $LFS/tools / -fi -