Skip to content

Commit 43d63d6

Browse files
authored
Merge pull request #118 from christyjacob4/fix-appwrite-cli-executable-name
fix: change appwrite executable name to temp
2 parents c6c582d + 1961277 commit 43d63d6

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

templates/cli/install.sh.twig

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
# {{ spec.title | caseUcfirst }} executable file path
2424
{{ spec.title | upper }}_EXECUTABLE_FILEPATH="${{ spec.title | upper }}_INSTALL_DIR/${{ spec.title | upper }}_EXECUTABLE_NAME"
2525

26+
# {{ spec.title | caseUcfirst }} CLI temp name
27+
{{ spec.title | upper }}_TEMP_NAME=temp
28+
2629
# {{ spec.title | caseUcfirst }} CLI image name
2730
{{ spec.title | upper }}_CLI_IMAGE_NAME={{ spec.title | lower }}/cli
2831

@@ -124,7 +127,7 @@ fi
124127
125128
# Check if the command is in the whitelist
126129
if [[ ! " ${allowList[@]} " =~ " ${1} " ]]; then
127-
echo "\nLooks like a crazy hamster 🐹 flipped a bit.\n\nUse {{ language.params.executableName }} help for a list of supported commands."
130+
printf "\nLooks like a crazy hamster 🐹 flipped a bit.\n\nUse {{ language.params.executableName }} help for a list of supported commands.\n"
128131
exit 1
129132
fi
130133
@@ -138,30 +141,30 @@ for x in "${@}" ; do
138141
_args=$_args" "$x
139142
done
140143
141-
bash -c "docker run -i --rm --volume {{ spec.title | lower }}-cli:/usr/local/code/app/.preferences/ --volume $(pwd):/usr/local/code/files:rw --network host '${{ spec.title | upper }}_CLI_IMAGE_NAME:${{ spec.title | upper }}_CLI_IMAGE_VERSION' $_args" ' > ${{ spec.title | upper }}_EXECUTABLE_NAME
144+
bash -c "docker run -i --rm --volume {{ spec.title | lower }}-cli:/usr/local/code/app/.preferences/ --volume $(pwd):/usr/local/code/files:rw --network host '${{ spec.title | upper }}_CLI_IMAGE_NAME:${{ spec.title | upper }}_CLI_IMAGE_VERSION' $_args" ' > ${{ spec.title | upper }}_TEMP_NAME
142145

143146
printf "${GREEN}🚧 Setting Permissions ${NC}\n"
144-
chmod +x ${{ spec.title | upper }}_EXECUTABLE_NAME
147+
chmod +x ${{ spec.title | upper }}_TEMP_NAME
145148
if [ $? -ne 0 ]; then
146149
printf "${RED}❌ Failed to set permissions ... ${NC}\n"
147150
exit 1
148151
fi
149152
printSuccess
150153

151-
printf "${GREEN}📝 Copying file to ${{ spec.title | upper }}_EXECUTABLE_FILEPATH ... ${NC}\n"
152-
runAsRoot cp ${{ spec.title | upper }}_EXECUTABLE_NAME ${{ spec.title | upper }}_EXECUTABLE_FILEPATH
154+
printf "${GREEN}📝 Copying temporary file to ${{ spec.title | upper }}_EXECUTABLE_FILEPATH ... ${NC}\n"
155+
runAsRoot cp ${{ spec.title | upper }}_TEMP_NAME ${{ spec.title | upper }}_EXECUTABLE_FILEPATH
153156
if [ $? -ne 0 ]; then
154-
printf "${RED}❌ Failed to copy file to ${{ spec.title | upper }}_EXECUTABLE_FILEPATH ... ${NC}\n"
157+
printf "${RED}❌ Failed to copy temporary file to ${{ spec.title | upper }}_EXECUTABLE_FILEPATH ... ${NC}\n"
155158
exit 1
156159
fi
157160
printSuccess
158161
}
159162

160163
cleanup() {
161164
echo "🧹 Cleaning up mess ... "
162-
rm ${{ spec.title | upper }}_EXECUTABLE_NAME
165+
rm ${{ spec.title | upper }}_TEMP_NAME
163166
if [ $? -ne 0 ]; then
164-
printf "${RED}❌ Failed to remove ${{ spec.title | upper }}_EXECUTABLE_NAME ... ${NC}\n"
167+
printf "${RED}❌ Failed to remove temporary file ... ${NC}\n"
165168
exit 1
166169
fi
167170
printSuccess

0 commit comments

Comments
 (0)