From b204bdd8d9258103102e8a1d9d751c4abc477835 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 7 Dec 2014 14:36:47 +0100 Subject: [PATCH] This commit was long overdue --- astronaut/astronaut | 36 +++++++++++++++---- astronaut/hello.sat | 2 +- tools/mktools | 9 +++-- tools/prepchroot | 26 ++++++++++---- tools/satellites/binutils-1.sat | 8 +---- .../extrafiles/busybox/busybox.config | 6 ++-- tools/satellites/gawk.sat | 12 +++++++ tools/satellites/m4.sat | 12 +++++++ 8 files changed, 86 insertions(+), 25 deletions(-) create mode 100644 tools/satellites/gawk.sat create mode 100644 tools/satellites/m4.sat diff --git a/astronaut/astronaut b/astronaut/astronaut index 3bd2c8b..053618e 100755 --- a/astronaut/astronaut +++ b/astronaut/astronaut @@ -8,6 +8,7 @@ dir_source="$PWD/source" dir_install="$PWD/install" cmd_download="curl -#L -o {dst} {src}" cmd_extract="tar xf {src}" +enable_movedirs=true enable_check=true if [ -f /etc/astronaut.conf ]; then . /etc/astronaut.conf @@ -17,13 +18,15 @@ fi show_help() { echo "This astronaut will help you build some satellites. Just describe what he's got to do in a satellite file. -Usage: $0 [-s ] [-b ] [-i ] [-cC] +Usage: $0 [-sbi ] [-cCmM] -s Set source directory -b Set build directory [WARNING: Will be deleted before build] -i Set install directory -c Enable package checking --C Disable package checking" +-C Disable package checking +-m Enable moving directories to match custom tree +-M Disable moving directories to match custom tree" } msg() { @@ -36,7 +39,7 @@ exiterr() { } # Gather info -while getopts "h?s:b:i:cC" opt; do +while getopts "h?s:b:i:cCmM" opt; do case "$opt" in h|\?) show_help @@ -55,10 +58,16 @@ while getopts "h?s:b:i:cC" opt; do dir_install="$(realpath "$OPTARG")" ;; c) - enable_checking=true + enable_check=true ;; C) - enable_checking=false + enable_check=false + ;; + m) + enable_movedirs=true + ;; + M) + enable_movedirs=false ;; esac done @@ -135,7 +144,7 @@ extrafile() { } do_check() { - if [ "$enable_check" = true ]; then + if $enable_check; then if [ "$1" ]; then $@ else @@ -153,3 +162,18 @@ mkdir -p "$dir_install" cd "$dir_build" . "$satellite" + +if $enable_movedirs; then + if [ "$(uname -m)" == "x86_64" ]; then + if [ -d "$dir_install/lib64" ]; then + mkdir -p "$dir_install/lib" + mv $(find "$dir_install/lib64/" -maxdepth 1 -mindepth 1) "$dir_install/lib" + rmdir "$dir_install/lib64" + fi + if [ -d "$dir_install/usr/lib64" ]; then + mkdir -p "$dir_install/usr/lib" + mv $(find "$dir_install/usr/lib64/" -maxdepth 1 -mindepth 1) "$dir_install/usr/lib" + rmdir "$dir_install/usr/lib64" + fi + fi +fi diff --git a/astronaut/hello.sat b/astronaut/hello.sat index 7c53bb8..afdeffc 100644 --- a/astronaut/hello.sat +++ b/astronaut/hello.sat @@ -26,7 +26,7 @@ extract "$name-$version.tar.gz" \ # "MD5SUM" # Copy local file to build directory. Path relative to the location of the satellite file -#extrafile "Herpaderp.txt" +#extrafile "Herpaderp.txt" # Compilation instructions cd "$name-$version" diff --git a/tools/mktools b/tools/mktools index ce5c344..820220b 100755 --- a/tools/mktools +++ b/tools/mktools @@ -39,11 +39,13 @@ envrun() { } astrobuild() { - envrun astronaut -i "$rocket" "$satellite_dir/$1.sat" + envrun astronaut -M -i "$rocket" "$satellite_dir/$1.sat" } +mkdir -p "$rocket/tools/lib" +ln -sf lib "$rocket/tools/lib64" + # List of packages to build -mkdir -p "$rocket/tools" # Toolchain astrobuild "binutils-1" @@ -57,7 +59,10 @@ astrobuild "gcc-2" # Utilities astrobuild "busybox" astrobuild "bash" +astrobuild "gawk" astrobuild "make" +astrobuild "m4" + astrobuild "perl" astrobuild "openssl" astrobuild "ca-certificates" diff --git a/tools/prepchroot b/tools/prepchroot index 1440661..eed814a 100755 --- a/tools/prepchroot +++ b/tools/prepchroot @@ -24,13 +24,27 @@ mknod -m 600 "$rocket/dev/console" c 5 1 2> /dev/null || true mknod -m 666 "$rocket/dev/null" c 1 3 2> /dev/null || true echo "Creating directories" -install -dm755 "$rocket/root" -mkdir -p "$rocket/etc/ssl" "$rocket/bin" "$rocket/usr/pkg" "$rocket/usr/sat" +install -dm750 "$rocket/root" +install -dm1777 "$rocket/tmp" +mkdir -p "$rocket/etc" "$rocket/usr/pkg" "$rocket/usr/sat" +if [ "$(uname -m)" == "x86_64" ]; then + ln -sf lib "$rocket/lib64" + ln -sf lib "$rocket/usr/lib64" +fi -echo "Moving temporary things into place" -ln -sf /tools/bin/sh "$rocket/bin/sh" -ln -sf /tools/bin/bash "$rocket/bin/bash" -ln -sf /tools/lib/ssl/certs "$rocket/etc/ssl/certs" +echo "Creating temporary symlinks" +mkdir -p "$rocket/usr/pkg/tmp-coreutils/bin" +ln -sf ../../../../tools/bin/sh "$rocket/usr/pkg/tmp-coreutils/bin/sh" +ln -sf ../../../../tools/bin/pwd "$rocket/usr/pkg/tmp-coreutils/bin/pwd" +mkdir -p "$rocket/usr/pkg/tmp-bash/bin" +ln -sf ../../../../tools/bin/bash "$rocket/usr/pkg/tmp-bash/bin/bash" +mkdir -p "$rocket/usr/pkg/tmp-ca-certificates/etc/ssl" +ln -sf ../../../../../tools/lib/ssl/certs "$rocket/usr/pkg/tmp-ca-certificates/etc/ssl/certs" +mkdir -p "$rocket/usr/pkg/tmp-gcc/usr/lib" +ln -sf ../../../../../tools/lib/libgcc_s.so "$rocket/usr/pkg/tmp-gcc/usr/lib/libgcc_s.so" +ln -sf ../../../../../tools/lib/libgcc_s.so.1 "$rocket/usr/pkg/tmp-gcc/usr/lib/libgcc_s.so.1" +ln -sf ../../../../../tools/lib/libstdc++.so "$rocket/usr/pkg/tmp-gcc/usr/lib/libstdc++.so" +ln -sf ../../../../../tools/lib/libstdc++.so.6 "$rocket/usr/pkg/tmp-gcc/usr/lib/libstdc++.so.6" echo "Creating users and groups" echo 'root:x:0:0:root:/root:/bin/sh' > "$rocket/etc/passwd" diff --git a/tools/satellites/binutils-1.sat b/tools/satellites/binutils-1.sat index c1a7dd4..ef6edd7 100644 --- a/tools/satellites/binutils-1.sat +++ b/tools/satellites/binutils-1.sat @@ -14,12 +14,6 @@ mkdir "$name-build"; cd "$name-build" --disable-nls \ --disable-werror -make - -case $(uname -m) in - x86_64) mkdir "$dir_install/tools/lib" && ln -s lib "$dir_install/tools/lib64" ;; -esac - -make DESTDIR="$dir_install" install +make; make DESTDIR="$dir_install" install # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/tools/satellites/extrafiles/busybox/busybox.config b/tools/satellites/extrafiles/busybox/busybox.config index 6950e8d..7c00925 100644 --- a/tools/satellites/extrafiles/busybox/busybox.config +++ b/tools/satellites/extrafiles/busybox/busybox.config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Busybox version: 1.22.1 -# Tue Nov 18 22:48:33 2014 +# Sun Dec 7 14:30:18 2014 # CONFIG_HAVE_DOT_CONFIG=y @@ -150,7 +150,7 @@ CONFIG_FEATURE_SEAMLESS_GZ=y # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set # CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set -# CONFIG_GZIP is not set +CONFIG_GZIP=y # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set CONFIG_GZIP_FAST=0 # CONFIG_LZOP is not set @@ -158,7 +158,7 @@ CONFIG_GZIP_FAST=0 # CONFIG_RPM is not set # CONFIG_RPM2CPIO is not set CONFIG_TAR=y -# CONFIG_FEATURE_TAR_CREATE is not set +CONFIG_FEATURE_TAR_CREATE=y CONFIG_FEATURE_TAR_AUTODETECT=y CONFIG_FEATURE_TAR_FROM=y CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y diff --git a/tools/satellites/gawk.sat b/tools/satellites/gawk.sat new file mode 100644 index 0000000..d4f8238 --- /dev/null +++ b/tools/satellites/gawk.sat @@ -0,0 +1,12 @@ +name=gawk +version=4.1.1 + +dlextract "http://ftp.gnu.org/gnu/gawk/gawk-4.1.1.tar.xz" \ + "a2a26543ce410eb74bc4a508349ed09a" + +cd "$name-$version" + +./configure --prefix=/tools +make; make DESTDIR="$dir_install" install + +# vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/tools/satellites/m4.sat b/tools/satellites/m4.sat new file mode 100644 index 0000000..1378fc4 --- /dev/null +++ b/tools/satellites/m4.sat @@ -0,0 +1,12 @@ +name=m4 +version=1.4.17 + +dlextract "http://ftp.gnu.org/gnu/$name/$name-$version.tar.xz" \ + "12a3c829301a4fd6586a57d3fcf196dc" + +cd "$name-$version" + +./configure --prefix=/tools +make; make DESTDIR="$dir_install" install + +# vim:set tabstop=4 shiftwidth=4 syntax=sh et: