From 912692146712f02b9f319c65d97c74aa130c71ad Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 26 Dec 2023 13:36:10 +0300 Subject: [PATCH] fix --- build.sh | 8 ++++++-- stages/0-download-src.sh | 6 +++--- stages/1-libc.sh | 2 +- stages/3-micro-utils.sh | 2 +- stages/4-host-compiler.sh | 2 +- stages/99-cleanup.sh | 4 ++++ 6 files changed, 16 insertions(+), 8 deletions(-) create mode 100755 stages/99-cleanup.sh diff --git a/build.sh b/build.sh index 638ed27..22bbf2c 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,8 @@ #!/bin/sh +if [ $(id -u) -ne 0 ]; then + echo "Run script without root" > &2 + exit 1 +fi #Add repos in 0-download-src.sh CC=cc @@ -7,7 +11,7 @@ RTFS=$(pwd)/rootfs #Tests for i in tests/*; do if ! env CC=$CC $i; then - echo "Build failed" + echo "Build failed" >&2 exit 1 fi done @@ -21,7 +25,7 @@ mkdir rootfs #Build system for i in stages/*; do if ! env RTFS=$RTFS $i; then - echo "Build failed" + echo "Build failed" >&2 exit 1 fi done diff --git a/stages/0-download-src.sh b/stages/0-download-src.sh index f8f9714..4fa0d35 100755 --- a/stages/0-download-src.sh +++ b/stages/0-download-src.sh @@ -3,11 +3,11 @@ mu_repo="https://git.macaw.me/8nl/micro-utils" ml_repo="git://git.musl-libc.org/musl" cc_repo="git://repo.or.cz/tinycc.git" -echo "* Download micro-utils sources..." +echo "* Download micro-utils sources..." >&2 git clone $mu_repo src -echo "* Download musl sources..." +echo "* Download musl sources..." >&2 git clone $ml_repo libc -echo "* Download tcc sources..." +echo "* Download tcc sources..." >&2 git clone $cc_repo tcc diff --git a/stages/1-libc.sh b/stages/1-libc.sh index 2a4ab87..0064dc4 100755 --- a/stages/1-libc.sh +++ b/stages/1-libc.sh @@ -1,5 +1,5 @@ #!/bin/sh -echo "* Build musl libc" +echo "* Build musl libc" >&2 cd libc diff --git a/stages/3-micro-utils.sh b/stages/3-micro-utils.sh index d0719cd..0ae41f9 100755 --- a/stages/3-micro-utils.sh +++ b/stages/3-micro-utils.sh @@ -18,7 +18,7 @@ mv bin/* $RTFS/bin #Install configs mkdir $RTFS/etc mv configs/* $RTFS/etc -echo " * You need to edit config files in /etc" +echo " * You need to edit config files in /etc" >&2 #Install init system mv $RTFS/bin/init $RTFS/init diff --git a/stages/4-host-compiler.sh b/stages/4-host-compiler.sh index 04a8d3f..ab2b21e 100755 --- a/stages/4-host-compiler.sh +++ b/stages/4-host-compiler.sh @@ -1,5 +1,5 @@ #!/bin/sh -echo "* Build host compiler" +echo "* Build host compiler" >&2 cd tcc diff --git a/stages/99-cleanup.sh b/stages/99-cleanup.sh new file mode 100755 index 0000000..14178c5 --- /dev/null +++ b/stages/99-cleanup.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +rm -rf $RTFS/share +rm -rf libc src tcc