Minor build script cleanup

This commit is contained in:
takeshix 2020-09-09 11:57:24 +02:00
parent 2ac931cf71
commit 92464c069e
4 changed files with 16 additions and 13 deletions

View file

@ -157,20 +157,23 @@ get_version(){
}
lib_create_tmp_dir(){
local tmp_dir=$(mktemp -dt -p ${TMP_DIR} tmpdir.XXXXXX)
local tmp_dir
tmp_dir=$(mktemp -dt -p "${TMP_DIR}" tmpdir.XXXXXX)
echo "$tmp_dir"
}
lib_check_lib_arch(){
lib=$1
local tmp_dir
local output
if [ ! -f "$lib" ];then
echo ""
return
fi
local tmp_dir=$(lib_create_tmp_dir)
tmp_dir=$(lib_create_tmp_dir)
cp "$lib" "$tmp_dir"
bash -c "cd ${tmp_dir}; ar x $(basename ${lib})"
local output=$(find "${tmp_dir}" -name "*.o" -exec file {} \;)
output=$(find "${tmp_dir}" -name "*.o" -exec file {} \;)
if echo "$output" | grep -q "Intel 80386";then
echo "Arch of ${lib} is x86" >&2
echo "x86"
@ -259,7 +262,7 @@ lib_build_ncurses(){
CMD="CFLAGS=\"${GCC_OPTS}\" "
CMD+="CXXFLAGS=\"${GXX_OPTS}\" "
CMD+="./configure --host=$(get_host_triple) --disable-shared --enable-static"
if [ "$CURRENT_ARCH"!="x86" -a "$CURRENT_ARCH"!="x86_64" ];then
if [ "$CURRENT_ARCH" != "x86" ] && [ "$CURRENT_ARCH" != "x86_64" ];then
CMD+=" --with-build-cc=/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc"
fi
eval "$CMD"

View file

@ -65,8 +65,8 @@ build_gdb() {
main() {
build_gdb
if [ ! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdb" -o \
! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdbserver/gdbserver" ];then
if [ ! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdb" ] || \
[ ! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdbserver/gdbserver" ];then
echo "[-] Building GDB ${CURRENT_ARCH} failed!"
exit 1
fi

View file

@ -36,9 +36,9 @@ build_nmap() {
main() {
lib_build_openssl
build_nmap
if [ ! -f "${BUILD_DIRECTORY}/nmap/nmap" -o \
! -f "${BUILD_DIRECTORY}/nmap/ncat/ncat" -o \
! -f "${BUILD_DIRECTORY}/nmap/nping/nping" ];then
if [ ! -f "${BUILD_DIRECTORY}/nmap/nmap" ] || \
[ ! -f "${BUILD_DIRECTORY}/nmap/ncat/ncat" ] || \
[ ! -f "${BUILD_DIRECTORY}/nmap/nping/nping" ];then
echo "[-] Building Nmap ${CURRENT_ARCH} failed!"
exit 1
fi
@ -63,7 +63,7 @@ main() {
fi
cd "${BUILD_DIRECTORY}/nmap"
make install
cp -r /usr/local/share/nmap/* $NMAP_DIR
cp -r /usr/local/share/nmap/* "$NMAP_DIR"
echo "[+] Copied data to Nmap data dir"
}

View file

@ -33,8 +33,8 @@ main() {
lib_build_openssl
lib_build_zlib
build_openssh
if [ ! -f "${BUILD_DIRECTORY}/openssh-portable/ssh" -o \
! -f "${BUILD_DIRECTORY}/openssh-portable/sshd" ];then
if [ ! -f "${BUILD_DIRECTORY}/openssh-portable/ssh" ] || \
[ ! -f "${BUILD_DIRECTORY}/openssh-portable/sshd" ];then
echo "[-] Building OpenSSH ${CURRENT_ARCH} failed!"
exit 1
fi
@ -43,7 +43,7 @@ main() {
cp "${BUILD_DIRECTORY}/openssh-portable/sshd" "${OUTPUT_DIRECTORY}/sshd${OPENSSH_VERSION}"
echo "[+] Finished building OpenSSH ${CURRENT_ARCH}"
OPENSSH_VERSION=$(echo $OPENSSH_VERSION | sed 's/-//')
OPENSSH_VERSION=$(echo "$OPENSSH_VERSION" | sed 's/-//')
echo ::set-output name=PACKAGED_NAME::"${OPENSSH_VERSION}"
echo ::set-output name=PACKAGED_NAME_PATH::"/output/*"
}