misc: move some scripts from src/stub/scripts to misc/scripts
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#! /usr/bin/env bash
|
||||
## vim:set ts=4 sw=4 et:
|
||||
set -e; set -o pipefail
|
||||
|
||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||
|
||||
[[ -z $1 ]] || cd "$1" || exit 1
|
||||
|
||||
find . \
|
||||
-type d -name '.git' -prune -o \
|
||||
-type d -name '.hg' -prune -o \
|
||||
-type d -name 'build*' -prune -o \
|
||||
-type d -name 'tmp*' -prune -o \
|
||||
-type d -name 'vendor' -prune -o \
|
||||
-type f -iname '*.bat' -prune -o \
|
||||
-type f -iname '*.exe' -prune -o \
|
||||
-type f -iname '*.o' -prune -o \
|
||||
-type f -iname '*.obj' -prune -o \
|
||||
-type f -iname '*.out' -prune -o \
|
||||
-type f -iname '*.pdf' -prune -o \
|
||||
-type f -iname '*.swp' -prune -o \
|
||||
-type f -print0 | \
|
||||
LC_ALL=C sort -z | xargs -0r perl -n -e '
|
||||
#print("$ARGV\n");
|
||||
if (m,[\x00\x01\x02\x7f\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
|
||||
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
|
||||
if (m,([ \t]+)$,) {
|
||||
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files
|
||||
if ($1 ne " " || $ARGV !~ m,\.md$,) {
|
||||
print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1);
|
||||
}
|
||||
}
|
||||
if (m,\t,) {
|
||||
if ($ARGV =~ m,(^|/)(gnu|m)?make(file|vars),i) { }
|
||||
elsif ($ARGV =~ m,/tmp/.*\.(disasm|dump)$,) { }
|
||||
elsif ($ARGV =~ m,/src/stub/src/arch/.*/lzma\w+\.S$,) { }
|
||||
else { print "ERROR: hard TAB detected $ARGV: $_"; exit(1); }
|
||||
}
|
||||
' || exit 1
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#! /usr/bin/env bash
|
||||
## vim:set ts=4 sw=4 et:
|
||||
set -e; set -o pipefail
|
||||
|
||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||
|
||||
[[ -z $1 ]] || cd "$1" || exit 1
|
||||
[[ -d .git ]] || exit 1
|
||||
|
||||
git ls-files --full-name -z | perl -0 -n -e '
|
||||
s,^,./,;
|
||||
if (m,^\./src/lzma-sdk(\0|$),) { }
|
||||
elsif (m,^\./vendor/,) { }
|
||||
elsif (m,\.bat(\0|$),) { }
|
||||
elsif (m,\.exe(\0|$),) { }
|
||||
else { print; }
|
||||
' | LC_ALL=C sort -z | xargs -0r perl -n -e '
|
||||
#print("$ARGV\n");
|
||||
if (m,[\x00\x01\x02\x7f\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
|
||||
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
|
||||
if (m,([ \t]+)$,) {
|
||||
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files
|
||||
if ($1 ne " " || $ARGV !~ m,\.md$,) {
|
||||
print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1);
|
||||
}
|
||||
}
|
||||
if (m,\t,) {
|
||||
if ($ARGV =~ m,(^|/)(gnu|m)?make(file|vars),i) { }
|
||||
elsif ($ARGV =~ m,/tmp/.*\.(disasm|dump)$,) { }
|
||||
elsif ($ARGV =~ m,/src/stub/src/arch/.*/lzma\w+\.S$,) { }
|
||||
else { print "ERROR: hard TAB detected $ARGV: $_"; exit(1); }
|
||||
}
|
||||
' || exit 1
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#! /usr/bin/env bash
|
||||
## vim:set ts=4 sw=4 et:
|
||||
set -e; set -o pipefail
|
||||
|
||||
# "Gofmt's style is nobody's favourite, but gofmt is everybody's favourite." Rob Pike
|
||||
|
||||
# NOTE: we are using clang-format-10.0.1 from upx-stubtools
|
||||
# see https://github.com/upx/upx-stubtools/releases
|
||||
|
||||
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
|
||||
UPX_CLANG_FORMAT="$HOME/local/bin/bin-upx/clang-format-10.0.1"
|
||||
fi
|
||||
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
|
||||
UPX_CLANG_FORMAT="$HOME/.local/bin/bin-upx/clang-format-10.0.1"
|
||||
fi
|
||||
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
|
||||
UPX_CLANG_FORMAT="$HOME/bin/bin-upx/clang-format-10.0.1"
|
||||
fi
|
||||
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
|
||||
echo "ERROR: $0: cannot find clang-format-10.0.1"
|
||||
echo "ERROR: $0: please visit https://github.com/upx/upx-stubtools"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# NOTE: we use .clang-format config from upx.git/.clang-format
|
||||
|
||||
#echo $UPX_CLANG_FORMAT
|
||||
exec "$UPX_CLANG_FORMAT" -style=file "$@"
|
||||
exit 1
|
||||
Reference in New Issue
Block a user