37 lines
761 B
Bash
Executable File
37 lines
761 B
Bash
Executable File
#!/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
|
|
|
|
|