From 3adb6b618d63e22e51ed9c87372549974c643778 Mon Sep 17 00:00:00 2001 From: Pavel Dmitriev Date: Tue, 3 May 2022 00:46:42 +0300 Subject: [PATCH] update script --- .gitignore | 1 + pack.sh | 31 +++++++++++++------------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 0b169b2..502ff2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /*.zip /.env /src +/test \ No newline at end of file diff --git a/pack.sh b/pack.sh index ab39ecd..6ba2dc4 100755 --- a/pack.sh +++ b/pack.sh @@ -1,23 +1,21 @@ #!/bin/bash -if [ ! -f .env ] + +if [ -f ".env" ] then - echo "Config not found" - exit + source .env fi -source .env -rm -rf ./src -cp -r "${mod_path}" "./src" - +echo ${REG_LOGIN} # TODO: implement .modignore processing from current dir and from src +rm -rf .git -md5=`find ./src -type f -exec md5sum {} + | awk '{print $1}' | sort | md5sum | awk '{ print $1 }'` +md5=`find . -type f -exec md5sum {} + | awk '{print $1}' | sort | md5sum | awk '{ print $1 }'` -if [ -f "src/module.json" ] +if [ -f "module.json" ] then - mod_name=`cat src/module.json | jq ".name" -r` - mod_version=`cat src/module.json | jq ".version" -r` - mod_title=`cat src/module.json | jq ".title" -r` + mod_name=`cat module.json | jq ".name" -r` + mod_version=`cat module.json | jq ".version" -r` + mod_title=`cat module.json | jq ".title" -r` else echo "Moduleinfo read failed" exit 9 @@ -28,16 +26,13 @@ echo "{ \"version\":\"${mod_version}\", \"title\":\"${mod_title}\", \"hash\":\"${md5}\" -}" > src/module.json +}" > module.json zip_name="mod_$mod_name-v$mod_version.zip" rm -f mod_*.zip -cd src -zip -r ../$zip_name . -cd - -rm -rf src +zip -r /tmp/$zip_name . curl --user ${REG_LOGIN}:${REG_PASSWORD} \ - --upload-file ${zip_name} \ + --upload-file /tmp/${zip_name} \ https://mxfox.ru/api/packages/${REG_REPOS}/generic/${mod_name}/${mod_version}/${mod_name}.zip