Skip to content

Commit

Permalink
#1113 set right permissions on json files
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromeleonard committed Aug 10, 2022
1 parent 6d60c14 commit 6619077
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions utils/docker/build-customimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ neuronschema='{
"description": {
"type": "string"
},
"type": {
"type": "string"
},
"multi": {
"type": "boolean"
},
Expand All @@ -154,7 +157,8 @@ neuronschema='{
"name",
"description",
"multi",
"required"
"required",
"type"
]
},
"screenshot": {
Expand Down Expand Up @@ -260,7 +264,7 @@ neuron-type() {
############################
json-validate() {
jsondata=$1
cat ${jsondata} | python -mjson.tool > /dev/null && log ok "JSON validated"
cat ${jsondata} | python3 -mjson.tool > /dev/null && log ok "JSON validated"
}


Expand All @@ -284,6 +288,16 @@ updatejsonfile() {

}

#########################################
# UPDATE PERMISSION ON JSON FILE #
#########################################
updatepermissions() {
destination=$1
uid=$2
gid=$3
chown -R ${uid}:${gid} ${destination}
}

#########################################
# BUILD DOCKER FILE IF NOT EXIST #
#########################################
Expand Down Expand Up @@ -375,6 +389,7 @@ build-image() {
# Update and save json file with dockerImage value
mkdir -p ${destinationpath}/${workername}
updatejsonfile ${jsonpath} ${destinationpath}/${workername}/$(basename ${jsonpath})
updatepermissions ${destinationpath}/${workername}/$(basename ${jsonpath}) $(stat -c '%u' ${destinationpath}/${workername}) $(stat -c '%g' ${destinationpath}/${workername})
log success "\nDocker image for your ${neurontype} has been built successfully.
Image name: ${dockerimagename}
JSON file updated and saved in: ${destinationpath}/${workername}/$(basename ${jsonpath})"
Expand Down

0 comments on commit 6619077

Please sign in to comment.