From 2472c9f3d0a20e1343dbebbcc405c5e04f252c69 Mon Sep 17 00:00:00 2001 From: Pavel Dmitirev Date: Sat, 30 Apr 2022 16:21:08 +0300 Subject: [PATCH] first commit --- .gitignore | 1 + .modingnore | 4 ++++ pack.sh | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 .gitignore create mode 100644 .modingnore create mode 100755 pack.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..68743aa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/*.zip \ No newline at end of file diff --git a/.modingnore b/.modingnore new file mode 100644 index 0000000..4319e7e --- /dev/null +++ b/.modingnore @@ -0,0 +1,4 @@ +.git +.settings +.buildpath +.project diff --git a/pack.sh b/pack.sh new file mode 100755 index 0000000..87e690d --- /dev/null +++ b/pack.sh @@ -0,0 +1,36 @@ +#!/bin/bash +mod_path='/home/palkan/git/mod_ic_billing' + +rm -rf ./src +cp -r "${mod_path}" "./src" + +# TODO: implement .modignore processing from current dir and from src + +md5=`find ./src -type f -exec md5sum {} + | awk '{print $1}' | sort | md5sum | awk '{ print $1 }'` + +if [ -f "src/module.json" ] +then + mod_name=`cat src/module.json | jq ".name" -r` + mod_version=`cat src/module.json | jq ".version" -r` + mod_desc=`cat src/module.json | jq ".desc" -r` +else + echo "Moduleinfo read failed" + exit 9 +fi + +echo "{ + \"name\":\"${mod_name}\", + \"version\":\"${mod_version}\", + \"desc\":\"${mod_desc}\", + \"hash\":\"${md5}\", +} +" > src/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 + +