Add in sig build script and fix integer rounding for green slime and future enemies that have a non-integer scale
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
15c246689f
commit
21760fbbbc
8
.gitignore
vendored
8
.gitignore
vendored
@ -9,6 +9,7 @@
|
|||||||
*.user
|
*.user
|
||||||
*.userosscache
|
*.userosscache
|
||||||
*.sln.docstates
|
*.sln.docstates
|
||||||
|
emsdk
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
*.userprefs
|
*.userprefs
|
||||||
@ -360,4 +361,9 @@ MigrationBackup/
|
|||||||
.ionide/
|
.ionide/
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
# Fody - auto-generated XML schema
|
||||||
FodyWeavers.xsd
|
FodyWeavers.xsd
|
||||||
|
Crawler/Crawler.html
|
||||||
|
Crawler/Crawler.data
|
||||||
|
Crawler/Crawler.js
|
||||||
|
Crawler/Crawler.wasm
|
||||||
|
Crawler/pixelGameEngine_wasm.o
|
||||||
|
34
Crawler/C++/scripts/build.sh
Executable file
34
Crawler/C++/scripts/build.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#Compiles the entire program then runs it, producing an executable. If the "test" argument is included, will try and run tests too (in the test folder). If the "full" argument is included, it will recopmile the PixelGameEngine (should it change)
|
||||||
|
#C++
|
||||||
|
printf "Running program...\n\n\n"
|
||||||
|
output=$(dpkg -l | grep libx11-dev)
|
||||||
|
if [[ -z $output ]]
|
||||||
|
then
|
||||||
|
sudo apt install libx11-dev libpulse-dev mesa-common-dev libpng-dev libstdc++-12-dev
|
||||||
|
fi
|
||||||
|
if [ ! -f "pixelGameEngine.o" ]
|
||||||
|
then
|
||||||
|
printf "Pixel Game Engine compile object missing. Compiling for the first time..."
|
||||||
|
g++ -c pixelGameEngine.cpp
|
||||||
|
fi
|
||||||
|
if [ "$1" = "test" ]
|
||||||
|
then
|
||||||
|
printf "Running tests...\n"
|
||||||
|
echo "#define TEST_SUITE" > ./test/test.h
|
||||||
|
if g++ $(find . -type f -name "*.cpp" -not -name "pixelGameEngine.cpp") pixelGameEngine.o ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then
|
||||||
|
./${PROJECT_NAME} "$@"
|
||||||
|
fi
|
||||||
|
elif [ "$1" = "full" ]
|
||||||
|
then
|
||||||
|
echo "" > ./test/test.h
|
||||||
|
g++ -c pixelGameEngine.cpp
|
||||||
|
if g++ $(find . -type f -name "*.cpp" -not -path "./test/*" -not -name "pixelGameEngine.cpp") pixelGameEngine.o ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then
|
||||||
|
./${PROJECT_NAME} "$@"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "" > ./test/test.h
|
||||||
|
if g++ $(find . -type f -name "*.cpp" -not -path "./test/*" -not -name "pixelGameEngine.cpp") pixelGameEngine.o ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then
|
||||||
|
./${PROJECT_NAME} "$@"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
printf "\n\n"
|
21
Crawler/C++/scripts/commit.sh
Executable file
21
Crawler/C++/scripts/commit.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#Adds a commit message and pushes project to github repository.
|
||||||
|
#C++
|
||||||
|
COMMIT_MESSAGE="$*"
|
||||||
|
FIRST_LINE=true
|
||||||
|
while IFS= read -r line
|
||||||
|
do
|
||||||
|
if [ "$FIRST_LINE" = true ]; then
|
||||||
|
COMMIT_MESSAGE+="
|
||||||
|
|
||||||
|
Co-authored-by: $line"
|
||||||
|
FIRST_LINE=false
|
||||||
|
else
|
||||||
|
COMMIT_MESSAGE+="
|
||||||
|
Co-authored-by: $line"
|
||||||
|
fi
|
||||||
|
done < utils/.coauthors
|
||||||
|
git config --global credential.helper store
|
||||||
|
git add -u
|
||||||
|
git add *
|
||||||
|
git commit -m "$COMMIT_MESSAGE"
|
||||||
|
git push
|
22
Crawler/C++/scripts/debug.sh
Executable file
22
Crawler/C++/scripts/debug.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#Compiles the entire program with debug flags then runs it in gdb. If the "test" argument is included, will try and run tests too (in the test folder)
|
||||||
|
#C++
|
||||||
|
printf "Running program...\n\n\n"
|
||||||
|
output=$(dpkg -l | grep libx11-dev)
|
||||||
|
if [[ -z $output ]]
|
||||||
|
then
|
||||||
|
sudo apt install libx11-dev libpulse-dev mesa-common-dev libpng-dev libstdc++-12-dev
|
||||||
|
fi
|
||||||
|
if [ "$1" = "test" ]
|
||||||
|
then
|
||||||
|
printf "Running tests...\n"
|
||||||
|
echo "#define TEST_SUITE" > ./test/test.h
|
||||||
|
if g++ $(find . -type f -name "*.cpp") -g ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then
|
||||||
|
gdb ./${PROJECT_NAME} "$@"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "" > ./test/test.h
|
||||||
|
if g++ $(find . -type f -name "*.cpp" -not -path "./test/*") -g ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then
|
||||||
|
gdb ./${PROJECT_NAME} "$@"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
printf "\n\n"
|
7
Crawler/C++/scripts/filelist
Normal file
7
Crawler/C++/scripts/filelist
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
build.sh
|
||||||
|
commit.sh
|
||||||
|
debug.sh
|
||||||
|
lines.sh
|
||||||
|
release.sh
|
||||||
|
temp
|
||||||
|
web.sh
|
14
Crawler/C++/scripts/lines.sh
Executable file
14
Crawler/C++/scripts/lines.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#Returns the line counts of your project.
|
||||||
|
#C++
|
||||||
|
shopt -s extglob
|
||||||
|
ls -1 @(*.h|*.cpp) > temp
|
||||||
|
while read a; do
|
||||||
|
if [ "$a" != "pixelGameEngine.h" ] && [ "$a" != "soundwaveEngine.h" ] && [ "$a" != "splash.h" ];
|
||||||
|
then
|
||||||
|
echo -e "$a\n" >> temp2
|
||||||
|
fi
|
||||||
|
done < temp
|
||||||
|
wc -l $(cat temp2)
|
||||||
|
|
||||||
|
rm temp
|
||||||
|
rm temp2
|
7
Crawler/C++/scripts/md5
Normal file
7
Crawler/C++/scripts/md5
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
build.sh:c073187e65d0e23aa77aa94af4ec6382 -
|
||||||
|
commit.sh:1af81bf417dfb932284d8a14fdd10657 -
|
||||||
|
debug.sh:8125f303032b6cbc137223df63d10096 -
|
||||||
|
lines.sh:3b907786f7fc9204025993016c9080de -
|
||||||
|
release.sh:b1ce8461a303e8e7aa9ed74259db3873 -
|
||||||
|
temp:d41d8cd98f00b204e9800998ecf8427e -
|
||||||
|
web.sh:dd7eec9825587db99063877da2839506 -
|
20
Crawler/C++/scripts/release.sh
Executable file
20
Crawler/C++/scripts/release.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#Creates a release build that focuses on high runtime performance. Use "full" argument to completely rebuild PGE.
|
||||||
|
#C++
|
||||||
|
printf "Running program...\n\n\n"
|
||||||
|
output=$(dpkg -l | grep libx11-dev)
|
||||||
|
if [[ -z $output ]]
|
||||||
|
then
|
||||||
|
sudo apt install libx11-dev libpulse-dev mesa-common-dev libpng-dev libstdc++-12-dev
|
||||||
|
fi
|
||||||
|
if [ "$1" == "full" ]; then
|
||||||
|
rm "pixelGameEngine.o"
|
||||||
|
fi
|
||||||
|
if [ ! -f "pixelGameEngine.o" ]
|
||||||
|
then
|
||||||
|
printf "Pixel Game Engine compile object missing. Compiling for the first time..."
|
||||||
|
g++ -c pixelGameEngine.cpp
|
||||||
|
fi
|
||||||
|
if g++ $(find . -type f -name "*.cpp" -not -path "./test/*" -not -name "pixelGameEngine.cpp") pixelGameEngine.o ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then
|
||||||
|
./${PROJECT_NAME} "$@"
|
||||||
|
fi
|
||||||
|
printf "\n\n"
|
0
Crawler/C++/scripts/temp
Normal file
0
Crawler/C++/scripts/temp
Normal file
46
Crawler/C++/scripts/web.sh
Executable file
46
Crawler/C++/scripts/web.sh
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#Compiles emscripten instance of this project for the web. Use "full" argument if your PGE has to be completely rebuilt. Use "headless" argument for a headless version.
|
||||||
|
#C++
|
||||||
|
output=$(dpkg -l | grep libx11-dev)
|
||||||
|
if [[ -z $output ]]
|
||||||
|
then
|
||||||
|
sudo apt install libx11-dev libpulse-dev mesa-common-dev libpng-dev libstdc++-12-dev
|
||||||
|
fi
|
||||||
|
if [[ "$1" == "full" || "$2" == "full" ]]; then
|
||||||
|
rm "pixelGameEngine_wasm.o"
|
||||||
|
fi
|
||||||
|
source ../emsdk/emsdk_env.sh
|
||||||
|
if [ ! -f "pixelGameEngine_wasm.o" ]
|
||||||
|
then
|
||||||
|
printf "Pixel Game Engine compile object missing. Compiling for the first time..."
|
||||||
|
em++ -std=c++17 -O2 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_SDL_MIXER=2 -s USE_LIBPNG=1 -c pixelGameEngine.cpp -o pixelGameEngine_wasm.o
|
||||||
|
fi
|
||||||
|
if [ -d "assets" ]; then
|
||||||
|
em++ -std=c++17 -O2 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_SDL_MIXER=2 -s USE_LIBPNG=1 $(find . -type f -name "*.cpp" -not -path "./test/*" -not -name "pixelGameEngine.cpp") pixelGameEngine_wasm.o -o ${PROJECT_NAME}.html --preload-file ./assets
|
||||||
|
else
|
||||||
|
em++ -std=c++17 -O2 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_SDL_MIXER=2 -s USE_LIBPNG=1 $(find . -type f -name "*.cpp" -not -path "./test/*" -not -name "pixelGameEngine.cpp") pixelGameEngine_wasm.o -o ${PROJECT_NAME}.html
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp buildtemplate.html ${PROJECT_NAME}.html
|
||||||
|
sed -i "s/_REPLACEME_/$PROJECT_NAME.js/" ${PROJECT_NAME}.html
|
||||||
|
|
||||||
|
if [[ "$1" == "headless" || "$2" == "headless" ]]; then
|
||||||
|
echo "Running as headless web server"
|
||||||
|
emrun --no_browser ${PROJECT_NAME}.html
|
||||||
|
else
|
||||||
|
emrun --serve_after_close ${PROJECT_NAME}.html
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $? -eq 127 ]
|
||||||
|
then
|
||||||
|
echo "Failed to find Emscripten. Running install script."
|
||||||
|
PWD=$(pwd)
|
||||||
|
cd ..
|
||||||
|
git clone https://github.com/emscripten-core/emsdk.git
|
||||||
|
cd emsdk
|
||||||
|
git pull
|
||||||
|
./emsdk install latest
|
||||||
|
./emsdk activate latest
|
||||||
|
source ./emsdk_env.sh
|
||||||
|
cd $PWD
|
||||||
|
echo "Emscripten has been installed. Try running the command again."
|
||||||
|
fi
|
@ -1,6 +1,3 @@
|
|||||||
#define OLC_PGE_APPLICATION
|
|
||||||
#include "olcPixelGameEngine.h"
|
|
||||||
#define OLC_PGEX_TRANSFORMEDVIEW
|
|
||||||
#include "olcPGEX_TransformedView.h"
|
#include "olcPGEX_TransformedView.h"
|
||||||
#include "Crawler.h"
|
#include "Crawler.h"
|
||||||
#include "olcUTIL_Camera2D.h"
|
#include "olcUTIL_Camera2D.h"
|
||||||
@ -252,11 +249,11 @@ void Crawler::RenderWorld(float fElapsedTime){
|
|||||||
std::sort(monstersBefore.begin(),monstersBefore.end(),[](Monster&m1,Monster&m2){return m1.GetPos().y<m2.GetPos().y;});
|
std::sort(monstersBefore.begin(),monstersBefore.end(),[](Monster&m1,Monster&m2){return m1.GetPos().y<m2.GetPos().y;});
|
||||||
std::sort(monstersAfter.begin(),monstersAfter.end(),[](Monster&m1,Monster&m2){return m1.GetPos().y<m2.GetPos().y;});
|
std::sort(monstersAfter.begin(),monstersAfter.end(),[](Monster&m1,Monster&m2){return m1.GetPos().y<m2.GetPos().y;});
|
||||||
for(Monster&m:monstersBefore){
|
for(Monster&m:monstersBefore){
|
||||||
view.DrawPartialDecal(m.GetPos()-vi2d{12,12}*m.GetSizeMult(),m.GetFrame().GetSourceImage()->Decal(),m.GetFrame().GetSourceRect().pos,m.GetFrame().GetSourceRect().size,vf2d(m.GetSizeMult(),m.GetSizeMult()));
|
view.DrawPartialDecal(m.GetPos()-vf2d{12,12}*m.GetSizeMult(),m.GetFrame().GetSourceImage()->Decal(),m.GetFrame().GetSourceRect().pos,m.GetFrame().GetSourceRect().size,vf2d(m.GetSizeMult(),m.GetSizeMult()));
|
||||||
}
|
}
|
||||||
view.DrawPartialDecal(player.GetPos()-vi2d{12,12}*player.GetSizeMult(),player.GetFrame().GetSourceImage()->Decal(),player.GetFrame().GetSourceRect().pos,player.GetFrame().GetSourceRect().size,vf2d(player.GetSizeMult(),player.GetSizeMult()));
|
view.DrawPartialDecal(player.GetPos()-vf2d{12,12}*player.GetSizeMult(),player.GetFrame().GetSourceImage()->Decal(),player.GetFrame().GetSourceRect().pos,player.GetFrame().GetSourceRect().size,vf2d(player.GetSizeMult(),player.GetSizeMult()));
|
||||||
for(Monster&m:monstersAfter){
|
for(Monster&m:monstersAfter){
|
||||||
view.DrawPartialDecal(m.GetPos()-vi2d{12,12}*m.GetSizeMult(),m.GetFrame().GetSourceImage()->Decal(),m.GetFrame().GetSourceRect().pos,m.GetFrame().GetSourceRect().size,vf2d(m.GetSizeMult(),m.GetSizeMult()));
|
view.DrawPartialDecal(m.GetPos()-vf2d{12,12}*m.GetSizeMult(),m.GetFrame().GetSourceImage()->Decal(),m.GetFrame().GetSourceRect().pos,m.GetFrame().GetSourceRect().size,vf2d(m.GetSizeMult(),m.GetSizeMult()));
|
||||||
}
|
}
|
||||||
for(std::vector<DamageNumber>::iterator it=DAMAGENUMBER_LIST.begin();it!=DAMAGENUMBER_LIST.end();++it){
|
for(std::vector<DamageNumber>::iterator it=DAMAGENUMBER_LIST.begin();it!=DAMAGENUMBER_LIST.end();++it){
|
||||||
DamageNumber&dn=*it;
|
DamageNumber&dn=*it;
|
||||||
|
@ -8,6 +8,7 @@ private:
|
|||||||
int hp=100,maxhp=hp;
|
int hp=100,maxhp=hp;
|
||||||
int atk=10;
|
int atk=10;
|
||||||
vf2d pos;
|
vf2d pos;
|
||||||
|
float z;
|
||||||
float moveSpd=1.0f;
|
float moveSpd=1.0f;
|
||||||
float size=1.0f;
|
float size=1.0f;
|
||||||
float attack_range=1.5f;
|
float attack_range=1.5f;
|
||||||
|
75
Crawler/buildtemplate.html
Normal file
75
Crawler/buildtemplate.html
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en-us">
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<title>Emscripten-Generated Code</title>
|
||||||
|
<style>
|
||||||
|
html,body { width: 100%; height: 100%; }
|
||||||
|
body { font-family: arial; margin: 0; padding: 0; background: #000; }
|
||||||
|
|
||||||
|
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
|
||||||
|
div.emscripten_border { border: none; }
|
||||||
|
|
||||||
|
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
|
||||||
|
canvas.emscripten { border: 0px none; background-color: black; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
|
||||||
|
<script type='text/javascript'>
|
||||||
|
var Module = {
|
||||||
|
preRun: [],
|
||||||
|
postRun: [],
|
||||||
|
canvas: (function() {
|
||||||
|
var canvas = document.getElementById('canvas');
|
||||||
|
|
||||||
|
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
|
||||||
|
// application robust, you may want to override this behavior before shipping!
|
||||||
|
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
|
||||||
|
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
})(),
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script async type="text/javascript" src="_REPLACEME_"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
Module.canvas.addEventListener("resize", (e) => {
|
||||||
|
|
||||||
|
var viewWidth = e.detail.width;
|
||||||
|
var viewHeight = e.detail.width / Module._olc_WindowAspectRatio;
|
||||||
|
|
||||||
|
if(viewHeight > e.detail.height)
|
||||||
|
{
|
||||||
|
viewHeight = e.detail.height;
|
||||||
|
viewWidth = e.detail.height * Module._olc_WindowAspectRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update dom attributes
|
||||||
|
Module.canvas.setAttribute("width", viewWidth);
|
||||||
|
Module.canvas.setAttribute("height", viewHeight);
|
||||||
|
|
||||||
|
var top = (e.detail.height - viewHeight) / 2;
|
||||||
|
var left = (e.detail.width - viewWidth) / 2;
|
||||||
|
|
||||||
|
// update styles
|
||||||
|
Module.canvas.style.position = "fixed";
|
||||||
|
Module.canvas.style.top = top.toString() + "px";
|
||||||
|
Module.canvas.style.left = left.toString() + "px";
|
||||||
|
Module.canvas.style.width = "";
|
||||||
|
Module.canvas.style.height = "";
|
||||||
|
|
||||||
|
// trigger PGE update
|
||||||
|
Module._olc_PGE_UpdateWindowSize(viewWidth, viewHeight);
|
||||||
|
|
||||||
|
// ensure canvas has focus
|
||||||
|
Module.canvas.focus();
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
4
Crawler/pixelGameEngine.cpp
Normal file
4
Crawler/pixelGameEngine.cpp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#define OLC_PGE_APPLICATION
|
||||||
|
#include "olcPixelGameEngine.h"
|
||||||
|
#define OLC_PGEX_TRANSFORMEDVIEW
|
||||||
|
#include "olcPGEX_TransformedView.h"
|
6711
Crawler/pixelGameEngine.h
Normal file
6711
Crawler/pixelGameEngine.h
Normal file
File diff suppressed because it is too large
Load Diff
9
Crawler/sig
Executable file
9
Crawler/sig
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
export AUTO_UPDATE=true
|
||||||
|
|
||||||
|
source utils/define.sh
|
||||||
|
|
||||||
|
define PROJECT_NAME "Crawler"
|
||||||
|
define CUSTOM_PARAMS "-std=c++17 -lX11 -lGL -lpthread -lpng -lstdc++fs -I/usr/include/lua5.3"
|
||||||
|
define LANGUAGE "C++"
|
||||||
|
|
||||||
|
source utils/main.sh
|
1
Crawler/utils/.coauthors
Normal file
1
Crawler/utils/.coauthors
Normal file
@ -0,0 +1 @@
|
|||||||
|
sigonasr2 <sigonasr2@gmail.com>
|
5
Crawler/utils/.updateDirectories
Normal file
5
Crawler/utils/.updateDirectories
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Java/
|
||||||
|
C/
|
||||||
|
C++/
|
||||||
|
scripts/
|
||||||
|
utils/
|
26
Crawler/utils/define.sh
Executable file
26
Crawler/utils/define.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
export VARS=("")
|
||||||
|
|
||||||
|
export LANGUAGE=""
|
||||||
|
|
||||||
|
function define() {
|
||||||
|
VARS+=("$1")
|
||||||
|
value="${*:2}"
|
||||||
|
eval export "$1"='$value'
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $(pwd) != *"SigScript" && $AUTO_UPDATE = "true" && $1 != "update" ]]; then
|
||||||
|
source utils/search.sh
|
||||||
|
|
||||||
|
find . -type f -name md5 -delete
|
||||||
|
find . -type f -name filelist -delete
|
||||||
|
|
||||||
|
#Check for hashes
|
||||||
|
FILES=$(cat utils/.updateDirectories)
|
||||||
|
for f in $FILES
|
||||||
|
do
|
||||||
|
search $f
|
||||||
|
check $f
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Dev build, no checks required."
|
||||||
|
fi
|
5
Crawler/utils/filelist
Normal file
5
Crawler/utils/filelist
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.coauthors
|
||||||
|
define.sh
|
||||||
|
main.sh
|
||||||
|
search.sh
|
||||||
|
.updateDirectories
|
28
Crawler/utils/main.sh
Normal file
28
Crawler/utils/main.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
echo " Usage: ./sig <command> {args}"
|
||||||
|
echo ""
|
||||||
|
printf "====\tCurrent Configuration"
|
||||||
|
printf "\t====================="
|
||||||
|
for t in ${VARS[@]}
|
||||||
|
do
|
||||||
|
printf "\n\t%-15s%20s" $t ${!t}
|
||||||
|
done
|
||||||
|
printf "\n====================================================="
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo " Command List:"
|
||||||
|
FILES=$(ls -1A ./$LANGUAGE/scripts 2>/dev/null | sed -e 's/\.sh$//' | sed -e 's/^/ /')
|
||||||
|
for f in $FILES
|
||||||
|
do
|
||||||
|
if [ -f "./$LANGUAGE/scripts/$f.sh" ]; then
|
||||||
|
DESC="$(head -n1 ./$LANGUAGE/scripts/$f.sh)"
|
||||||
|
printf "\n\t%-15s%-65s" $f "${DESC:1}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
./$LANGUAGE/scripts/$1.sh "${@:2}"
|
4
Crawler/utils/md5
Normal file
4
Crawler/utils/md5
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
define.sh:3ecab0dffe2adfb950f3eb7c7061b750 -
|
||||||
|
main.sh:4e6e9f0650ec790ce2c4364db94f0caa -
|
||||||
|
search.sh:30e1842e9a13452ea883bb6516d28e1c -
|
||||||
|
.updateDirectories:971afb892e8280cb4c9ad43fb72a46a0 -
|
103
Crawler/utils/search.sh
Normal file
103
Crawler/utils/search.sh
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
function search() {
|
||||||
|
FILES2=$(ls -A $1 2>/dev/null)
|
||||||
|
for g in $FILES2
|
||||||
|
do
|
||||||
|
if [ -d $1$g ];
|
||||||
|
then
|
||||||
|
echo "$1$g is a directory"
|
||||||
|
search $1$g/
|
||||||
|
else
|
||||||
|
echo "$1$g is a file"
|
||||||
|
if [ $g != "md5" ] && [ $g != "filelist" ] && [ $g != ".package.files" ]; then
|
||||||
|
if [ $g != ".coauthors" ] && [ $g != "version_info" ]; then
|
||||||
|
SUM=$(md5sum < $1$g)
|
||||||
|
echo "$g:$SUM" >> $1md5
|
||||||
|
fi
|
||||||
|
echo "$g" >> $1filelist
|
||||||
|
else
|
||||||
|
echo " ignoring $g..."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function check() {
|
||||||
|
echo "Check $1"
|
||||||
|
FILES2=$(ls -A $1 2>/dev/null)
|
||||||
|
if [ -f "$1/md5" ];
|
||||||
|
then
|
||||||
|
echo " md5: http://sig.projectdivar.com/sigonasr2/SigScript/raw/branch/main/$1md5"
|
||||||
|
curl -H 'Cache-Control: no-cache, no-store' -s "http://sig.projectdivar.com/sigonasr2/SigScript/raw/branch/main/$1md5" --output /tmp/out
|
||||||
|
cmp -s $1/md5 /tmp/out
|
||||||
|
if [ "$?" -ne 0 ]
|
||||||
|
then
|
||||||
|
echo " Differences detected!"
|
||||||
|
cat /tmp/out
|
||||||
|
while IFS= read -r line
|
||||||
|
do
|
||||||
|
IFS=':' read -ra split <<< $line
|
||||||
|
g="${split[0]}"
|
||||||
|
echo "LINE -- $g"
|
||||||
|
if [ "$g" != "md5" ] && [ "$g" != "filelist" ] && [ "$g" != ".package.files" ]; then
|
||||||
|
if [ -f $1$g ];
|
||||||
|
then
|
||||||
|
if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then
|
||||||
|
echo "++Redownload $1$g..."
|
||||||
|
if [ -f "$1$g" ]; then
|
||||||
|
curl -H 'Cache-Control: no-cache, no-store' "http://sig.projectdivar.com/sigonasr2/SigScript/raw/branch/main/$1$g" --output $1$g
|
||||||
|
else
|
||||||
|
echo "===Could not find directory, assuming regular scripts directory exists."
|
||||||
|
curl -H 'Cache-Control: no-cache, no-store' "http://sig.projectdivar.com/sigonasr2/SigScript/raw/branch/main/$1$g" --output $LANGUAGE/scripts/$g
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "++==Downloading $1$g..."
|
||||||
|
curl -H 'Cache-Control: no-cache, no-store' "http://sig.projectdivar.com/sigonasr2/SigScript/raw/branch/main/$1$g" --output $1$g
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < /tmp/out
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -f "$1/filelist" ];
|
||||||
|
then
|
||||||
|
echo " filelist: http://sig.projectdivar.com/sigonasr2/SigScript/raw/branch/main/$1filelist"
|
||||||
|
curl -H 'Cache-Control: no-cache, no-store' -s "http://sig.projectdivar.com/sigonasr2/SigScript/raw/branch/main/$1filelist" --output /tmp/out
|
||||||
|
cmp -s $1/filelist /tmp/out
|
||||||
|
if [ "$?" -ne 0 ]
|
||||||
|
then
|
||||||
|
echo " Differences detected!"
|
||||||
|
cat /tmp/out
|
||||||
|
while IFS= read -r line
|
||||||
|
do
|
||||||
|
IFS=':' read -ra split <<< $line
|
||||||
|
g="${split[0]}"
|
||||||
|
echo "LINE -- $g"
|
||||||
|
if [ "$g" != "md5" ] && [ "$g" != "filelist" ] && [ "$g" != ".package.files" ]; then
|
||||||
|
if [ -f $1$g ];
|
||||||
|
then
|
||||||
|
if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then
|
||||||
|
echo "++Redownload $1$g..."
|
||||||
|
if [ -f "$1$g" ]; then
|
||||||
|
curl -H 'Cache-Control: no-cache, no-store' "http://sig.projectdivar.com/sigonasr2/SigScript/raw/branch/main/$1$g" --output $1$g
|
||||||
|
else
|
||||||
|
echo "===Could not find directory, assuming regular scripts directory exists."
|
||||||
|
curl -H 'Cache-Control: no-cache, no-store' "http://sig.projectdivar.com/sigonasr2/SigScript/raw/branch/main/$1$g" --output $LANGUAGE/scripts/$g
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "++==Downloading $1$g..."
|
||||||
|
curl -H 'Cache-Control: no-cache, no-store' "http://sig.projectdivar.com/sigonasr2/SigScript/raw/branch/main/$1$g" --output $1$g
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < /tmp/out
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
for g in $FILES2
|
||||||
|
do
|
||||||
|
if [ -d $1$g ];
|
||||||
|
then
|
||||||
|
echo "$1$g is a directory"
|
||||||
|
check $1$g/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user