Update SigScript

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
Nic0Nic0Nii 3 years ago
parent 9fcd0384ab
commit ff1761f5c8
  1. 6
      Java/scripts/build.sh
  2. 4
      Java/scripts/clean.sh
  3. 1
      Java/scripts/commit.sh
  4. 8
      Java/scripts/jar.sh
  5. 14
      Java/scripts/release.sh
  6. 3
      Java/scripts/update.sh
  7. 3
      utils/define.sh
  8. 4
      utils/main.sh
  9. 57
      utils/search.sh

@ -1,9 +1,9 @@
#Builds and runs the project. #Builds and runs the project.
#Java #Java
rm -Rf out/* source ${LANGUAGE}/scripts/version_info
javac -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH} -d ${OUT_DIR} ${PROJECT_DIR}/*.java
printf "\n\n\nRunning Program...\n\n" printf "\n\n\nRunning Program...\n\n"
ORIGINAL_LOC=$(pwd) ORIGINAL_LOC=$(pwd)
cd $OUT_DIR cd $OUT_DIR
java ${MAIN_CLASS} "$@" java -cp .:../lib/bin -Djava.library.path="${LIBRARY_PATH}" ${MAIN_CLASS} "$@"
${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh ${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh

@ -1,4 +1,4 @@
#Cleans up and removes unused files. #Cleans up and removes unused files.
#Java #Java
find . -type f -name *.class -delete find -type f -name *.class -delete
find . -type f -name manifest -delete find -type f -name manifest -delete

@ -1,6 +1,7 @@
#Adds a commit message and pushes project to github repository. #Adds a commit message and pushes project to github repository.
#Java #Java
COMMIT_MESSAGE="$*" COMMIT_MESSAGE="$*"
FIRST_LINE=true
while IFS= read -r line while IFS= read -r line
do do
if [ "$FIRST_LINE" = true ]; then if [ "$FIRST_LINE" = true ]; then

@ -1,7 +1,8 @@
#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar. #Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar.
#Java #Java
source ${LANGUAGE}/scripts/version_info
rm -Rf bin/* rm -Rf bin/*
javac -Xlint:unchecked -cp src -d bin ${PROJECT_DIR}/${PROJECT_NAME}.java javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH} -d ${OUT_DIR} ${PROJECT_DIR}/${PROJECT_NAME}.java
printf "\n\n\nGenerating Manifest...\n\n" printf "\n\n\nGenerating Manifest...\n\n"
touch manifest touch manifest
echo "Main-Class: ${MAIN_CLASS}" >> manifest echo "Main-Class: ${MAIN_CLASS}" >> manifest
@ -9,7 +10,8 @@ printf "\n\n\nCreating Jar...\n\n"
ORIGINAL_LOC=$(pwd) ORIGINAL_LOC=$(pwd)
cd ${OUT_DIR} cd ${OUT_DIR}
jar cfm ${PROJECT_NAME}.jar ${ORIGINAL_LOC}/manifest sig jar cfm ${PROJECT_NAME}.jar ${ORIGINAL_LOC}/manifest sig
jar uf ${PROJECT_NAME}.jar -C ../lib/bin/ .
printf "\n\n\nRunning Program...\n\n" printf "\n\n\nRunning Program...\n\n"
java -jar ${PROJECT_NAME}.jar "$@" java -cp .:../lib/bin -Djava.library.path="${LIBRARY_PATH}" -jar ${PROJECT_NAME}.jar "$@"
../${LANGUAGE}/scripts/clean.sh
cd .. cd ..
./${LANGUAGE}/scripts/clean.sh

@ -0,0 +1,14 @@
#Creates a zip file containing all project contents.
#Java
source ${LANGUAGE}/scripts/version_info
TARGET_FILE="${PROJECT_NAME}_${RELEASE_VERSION}.zip"
FILES=$(cat ${LANGUAGE}/scripts/.package.files)
echo "Creating Package $TARGET_FILE..."
for f in $FILES
do
zip -ur $TARGET_FILE $f
done
echo "Complete!"
echo ""
echo ""
echo ""

@ -0,0 +1,3 @@
#Pulls the latest version of the repository.
#Java
git pull

@ -8,10 +8,11 @@ function define() {
eval export "$1"='$value' eval export "$1"='$value'
} }
if [[ $(pwd) != *"SigScript" ]]; then if [[ $(pwd) != *"SigScript" && $AUTO_UPDATE = "true" ]]; then
source utils/search.sh source utils/search.sh
find . -type f -name md5 -delete find . -type f -name md5 -delete
find . -type f -name filelist -delete
#Check for hashes #Check for hashes
FILES=$(cat utils/.updateDirectories) FILES=$(cat utils/.updateDirectories)

@ -13,10 +13,10 @@ if [ -z "$1" ]
echo "" echo ""
echo "" echo ""
echo " Command List:" echo " Command List:"
FILES=$(ls -1A ./$LANGUAGE/scripts | sed -e 's/\.sh$//' | sed -e 's/^/ /') FILES=$(ls -1A ./$LANGUAGE/scripts 2>/dev/null | sed -e 's/\.sh$//' | sed -e 's/^/ /')
for f in $FILES for f in $FILES
do do
if [ $f != "md5" ]; then if [ -f "./$LANGUAGE/scripts/$f.sh" ]; then
DESC="$(head -n1 ./$LANGUAGE/scripts/$f.sh)" DESC="$(head -n1 ./$LANGUAGE/scripts/$f.sh)"
printf "\n\t%-15s%-65s" $f "${DESC:1}" printf "\n\t%-15s%-65s" $f "${DESC:1}"
fi fi

@ -1,5 +1,5 @@
function search() { function search() {
FILES2=$(ls -A $1) FILES2=$(ls -A $1 2>/dev/null)
for g in $FILES2 for g in $FILES2
do do
if [ -d $1$g ]; if [ -d $1$g ];
@ -8,11 +8,14 @@ function search() {
search $1$g/ search $1$g/
else else
echo "$1$g is a file" echo "$1$g is a file"
if [ $g != "md5" ]; then if [ $g != "md5" ] && [ $g != "filelist" ] && [ $g != ".package.files" ]; then
if [ $g != ".coauthors" ] && [ $g != "version_info" ]; then
SUM=$(md5sum < $1$g) SUM=$(md5sum < $1$g)
echo "$g:$SUM" >> $1md5 echo "$g:$SUM" >> $1md5
fi
echo "$g" >> $1filelist
else else
echo " md5 file, ignoring..." echo " ignoring $g..."
fi fi
fi fi
done done
@ -20,11 +23,11 @@ function search() {
function check() { function check() {
echo "Check $1" echo "Check $1"
FILES2=$(ls -A $1) FILES2=$(ls -A $1 2>/dev/null)
if [ -f "$1/md5" ]; if [ -f "$1/md5" ];
then then
echo " md5: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5" echo " md5: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5"
curl -H 'Cache-Control: no-cache, no-store' -s https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5 --output /tmp/out curl -H 'Cache-Control: no-cache, no-store' -s "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5" --output /tmp/out
cmp -s $1/md5 /tmp/out cmp -s $1/md5 /tmp/out
if [ "$?" -ne 0 ] if [ "$?" -ne 0 ]
then then
@ -35,21 +38,55 @@ function check() {
IFS=':' read -ra split <<< $line IFS=':' read -ra split <<< $line
g="${split[0]}" g="${split[0]}"
echo "LINE -- $g" echo "LINE -- $g"
if [ "$g" != "md5" ]; then 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' "https://raw.githubusercontent.com/sigonasr2/SigScript/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' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $LANGUAGE/scripts/$g
fi
fi
else
echo "++==Downloading $1$g..."
curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g
fi
fi
done < /tmp/out
fi
fi
if [ -f "$1/filelist" ];
then
echo " filelist: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1filelist"
curl -H 'Cache-Control: no-cache, no-store' -s "https://raw.githubusercontent.com/sigonasr2/SigScript/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 ]; if [ -f $1$g ];
then then
if [ "$g" != ".coauthors" ]; then if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then
echo "++Redownload $1$g..." echo "++Redownload $1$g..."
if [ -f "$1$g" ]; then if [ -f "$1$g" ]; then
curl -H 'Cache-Control: no-cache, no-store' https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output $1$g curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g
else else
echo "===Could not find directory, assuming regular scripts directory exists." echo "===Could not find directory, assuming regular scripts directory exists."
curl -H 'Cache-Control: no-cache, no-store' https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output $LANGUAGE/scripts/$g curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $LANGUAGE/scripts/$g
fi fi
fi fi
else else
echo "++==Downloading $1$g..." echo "++==Downloading $1$g..."
curl -H 'Cache-Control: no-cache, no-store' https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output $1$g curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g
fi fi
fi fi
done < /tmp/out done < /tmp/out

Loading…
Cancel
Save