@@ -18,21 +18,22 @@ $version = $this->getParam('version', '');
1818# You can use "View source" of this page to see the full script.
1919
2020# {{ spec .title | caseUcfirst }} CLI location
21- : ${APPWRITE_INSTALL_DIR: ="/usr/local/bin"}
21+ {{ spec . title | upper }}_INSTALL_DIR ="/usr/local/bin"
2222
2323# {{ spec .title | caseUcfirst }} CLI Executable name
24- APPWRITE_EXECUTABLE_NAME ={{ language .params .executableName }}
24+ {{ spec . title | upper }}_EXECUTABLE_NAME ={{ language .params .executableName }}
2525
2626# {{ spec .title | caseUcfirst }} executable file path
27- APPWRITE_EXECUTABLE_FILEPATH ="${APPWRITE_INSTALL_DIR} /${APPWRITE_EXECUTABLE_NAME} "
27+ {{ spec . title | upper }}_EXECUTABLE_FILEPATH ="${{ spec . title | upper }}_INSTALL_DIR /${{ spec . title | upper }}_EXECUTABLE_NAME "
2828
2929# {{ spec .title | caseUcfirst }} CLI image name
30- APPWRITE_CLI_IMAGE_NAME ={{ spec .title | lower }}/cli
30+ {{ spec . title | upper }}_CLI_IMAGE_NAME ={{ spec .title | lower }}/cli
3131
3232# {{ spec .title | caseUcfirst }} CLI image version
33- APPWRITE_CLI_IMAGE_VERSION=$version
34- # sudo is required to copy executable to APPWRITE_INSTALL_DIR for linux
35- : ${USE_SUDO:="false"}]
33+ {{ spec .title | upper }}_CLI_IMAGE_VERSION=$version
34+
35+ # sudo is required to copy executable to {{ spec .title | upper }}_INSTALL_DIR for linux
36+ USE_SUDO="false"
3637
3738# Add some color to life
3839RED='\033[0;31m'
@@ -60,7 +61,7 @@ getSystemInfo() {
6061 OS=$(echo `uname`|tr '[:upper:]' '[:lower:]')
6162
6263 # Need root access if its a linux system
63- if [ "$OS" == "linux" ] && [ "$APPWRITE_INSTALL_DIR " == "/usr/local/bin" ]; then
64+ if [ "$OS" == "linux" ] && [ "${{ spec . title | upper }}_INSTALL_DIR " == "/usr/local/bin" ]; then
6465 USE_SUDO="true"
6566 fi
6667
@@ -108,7 +109,7 @@ install() {
108109
109110 # Fetch the {{ spec .title | caseUcfirst }} CLI Image.
110111 printf "${GREEN}🐳 Pulling docker image ... ${NC}\n"
111- out=$(docker pull "${APPWRITE_CLI_IMAGE_NAME} :${APPWRITE_CLI_IMAGE_VERSION} ")
112+ out=$(docker pull "${{ spec . title | upper }}_CLI_IMAGE_NAME :${{ spec . title | upper }}_CLI_IMAGE_VERSION ")
112113 if [[ $out != *"Image is up to date"* ]] && [[ $out != *"Downloaded newer image"* ]]; then
113114 printf "${RED}❌ Failed to fetch docker image. Exiting ... ${NC}\n"
114115 exit 1
@@ -140,30 +141,30 @@ for x in "${@}" ; do
140141 _args=$_args" "$x
141142done
142143
143- 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 '$APPWRITE_CLI_IMAGE_NAME:$APPWRITE_CLI_IMAGE_VERSION ' $_args" ' > $APPWRITE_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 }}_EXECUTABLE_NAME
144145
145146 printf "${GREEN}🚧 Setting Permissions ${NC}\n"
146- chmod +x $APPWRITE_EXECUTABLE_NAME
147+ chmod +x ${{ spec . title | upper }}_EXECUTABLE_NAME
147148 if [ $? -ne 0 ]; then
148149 printf "${RED}❌ Failed to set permissions ... ${NC}\n"
149150 exit 1
150151 fi
151152 printSuccess
152153
153- printf "${GREEN}📝 Copying file to $APPWRITE_EXECUTABLE_FILEPATH ... ${NC}\n"
154- runAsRoot cp $APPWRITE_EXECUTABLE_NAME $APPWRITE_EXECUTABLE_FILEPATH
154+ printf "${GREEN}📝 Copying file to ${{ spec . title | upper }}_EXECUTABLE_FILEPATH ... ${NC}\n"
155+ runAsRoot cp ${{ spec . title | upper }}_EXECUTABLE_NAME ${{ spec . title | upper }}_EXECUTABLE_FILEPATH
155156 if [ $? -ne 0 ]; then
156- printf "${RED}❌ Failed to copy file to $APPWRITE_EXECUTABLE_FILEPATH ... ${NC}\n"
157+ printf "${RED}❌ Failed to copy file to ${{ spec . title | upper }}_EXECUTABLE_FILEPATH ... ${NC}\n"
157158 exit 1
158159 fi
159160 printSuccess
160161}
161162
162163cleanup() {
163164 echo "🧹 Cleaning up mess ... "
164- rm $APPWRITE_EXECUTABLE_NAME
165+ rm ${{ spec . title | upper }}_EXECUTABLE_NAME
165166 if [ $? -ne 0 ]; then
166- printf "${RED}❌ Failed to remove $APPWRITE_EXECUTABLE_NAME ... ${NC}\n"
167+ printf "${RED}❌ Failed to remove ${{ spec . title | upper }}_EXECUTABLE_NAME ... ${NC}\n"
167168 exit 1
168169 fi
169170 printSuccess
0 commit comments