Minor build script cleanup
This commit is contained in:
parent
2ac931cf71
commit
92464c069e
4 changed files with 16 additions and 13 deletions
11
build/lib.sh
11
build/lib.sh
|
@ -157,20 +157,23 @@ get_version(){
|
||||||
}
|
}
|
||||||
|
|
||||||
lib_create_tmp_dir(){
|
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"
|
echo "$tmp_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
lib_check_lib_arch(){
|
lib_check_lib_arch(){
|
||||||
lib=$1
|
lib=$1
|
||||||
|
local tmp_dir
|
||||||
|
local output
|
||||||
if [ ! -f "$lib" ];then
|
if [ ! -f "$lib" ];then
|
||||||
echo ""
|
echo ""
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
local tmp_dir=$(lib_create_tmp_dir)
|
tmp_dir=$(lib_create_tmp_dir)
|
||||||
cp "$lib" "$tmp_dir"
|
cp "$lib" "$tmp_dir"
|
||||||
bash -c "cd ${tmp_dir}; ar x $(basename ${lib})"
|
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
|
if echo "$output" | grep -q "Intel 80386";then
|
||||||
echo "Arch of ${lib} is x86" >&2
|
echo "Arch of ${lib} is x86" >&2
|
||||||
echo "x86"
|
echo "x86"
|
||||||
|
@ -259,7 +262,7 @@ lib_build_ncurses(){
|
||||||
CMD="CFLAGS=\"${GCC_OPTS}\" "
|
CMD="CFLAGS=\"${GCC_OPTS}\" "
|
||||||
CMD+="CXXFLAGS=\"${GXX_OPTS}\" "
|
CMD+="CXXFLAGS=\"${GXX_OPTS}\" "
|
||||||
CMD+="./configure --host=$(get_host_triple) --disable-shared --enable-static"
|
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"
|
CMD+=" --with-build-cc=/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc"
|
||||||
fi
|
fi
|
||||||
eval "$CMD"
|
eval "$CMD"
|
||||||
|
|
|
@ -65,8 +65,8 @@ build_gdb() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
build_gdb
|
build_gdb
|
||||||
if [ ! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdb" -o \
|
if [ ! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdb" ] || \
|
||||||
! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdbserver/gdbserver" ];then
|
[ ! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdbserver/gdbserver" ];then
|
||||||
echo "[-] Building GDB ${CURRENT_ARCH} failed!"
|
echo "[-] Building GDB ${CURRENT_ARCH} failed!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -36,9 +36,9 @@ build_nmap() {
|
||||||
main() {
|
main() {
|
||||||
lib_build_openssl
|
lib_build_openssl
|
||||||
build_nmap
|
build_nmap
|
||||||
if [ ! -f "${BUILD_DIRECTORY}/nmap/nmap" -o \
|
if [ ! -f "${BUILD_DIRECTORY}/nmap/nmap" ] || \
|
||||||
! -f "${BUILD_DIRECTORY}/nmap/ncat/ncat" -o \
|
[ ! -f "${BUILD_DIRECTORY}/nmap/ncat/ncat" ] || \
|
||||||
! -f "${BUILD_DIRECTORY}/nmap/nping/nping" ];then
|
[ ! -f "${BUILD_DIRECTORY}/nmap/nping/nping" ];then
|
||||||
echo "[-] Building Nmap ${CURRENT_ARCH} failed!"
|
echo "[-] Building Nmap ${CURRENT_ARCH} failed!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -63,7 +63,7 @@ main() {
|
||||||
fi
|
fi
|
||||||
cd "${BUILD_DIRECTORY}/nmap"
|
cd "${BUILD_DIRECTORY}/nmap"
|
||||||
make install
|
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"
|
echo "[+] Copied data to Nmap data dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ main() {
|
||||||
lib_build_openssl
|
lib_build_openssl
|
||||||
lib_build_zlib
|
lib_build_zlib
|
||||||
build_openssh
|
build_openssh
|
||||||
if [ ! -f "${BUILD_DIRECTORY}/openssh-portable/ssh" -o \
|
if [ ! -f "${BUILD_DIRECTORY}/openssh-portable/ssh" ] || \
|
||||||
! -f "${BUILD_DIRECTORY}/openssh-portable/sshd" ];then
|
[ ! -f "${BUILD_DIRECTORY}/openssh-portable/sshd" ];then
|
||||||
echo "[-] Building OpenSSH ${CURRENT_ARCH} failed!"
|
echo "[-] Building OpenSSH ${CURRENT_ARCH} failed!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -43,7 +43,7 @@ main() {
|
||||||
cp "${BUILD_DIRECTORY}/openssh-portable/sshd" "${OUTPUT_DIRECTORY}/sshd${OPENSSH_VERSION}"
|
cp "${BUILD_DIRECTORY}/openssh-portable/sshd" "${OUTPUT_DIRECTORY}/sshd${OPENSSH_VERSION}"
|
||||||
echo "[+] Finished building OpenSSH ${CURRENT_ARCH}"
|
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::"${OPENSSH_VERSION}"
|
||||||
echo ::set-output name=PACKAGED_NAME_PATH::"/output/*"
|
echo ::set-output name=PACKAGED_NAME_PATH::"/output/*"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue