-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathps-install-module.sh
executable file
·42 lines (36 loc) · 1.11 KB
/
ps-install-module.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
if test $# -gt 1; then
modulePath=$2
else
echo "Usage: ps-install-module.sh suffix module_path"
exit 1
fi
echo "Installing a module from $modulePath in PrestaShop"
echo
BASEDIR=$(dirname "$0")
source $BASEDIR/tools/config.sh
if test -d $modulePath; then
moduleFolderPath=$modulePath
moduleName=$(basename $moduleFolderPath)
else
moduleName=$(basename $modulePath)
moduleName=$(echo "$moduleName" | cut -f 1 -d '.')
moduleFolderPath=/tmp/$moduleName/
rm -fR $moduleFolderPath
echo "unzip $modulePath $moduleFolderPath"
unzip $modulePath -d /tmp
fi
targetModulePath="$targetFolder/modules/$moduleName/"
if ! test -d $targetModulePath; then
mkdir $targetModulePath
fi
cp -R $moduleFolderPath/* $targetModulePath
if test -f $targetFolder/bin/console; then
# In 1.7 we have use a command to install the module
cd $targetFolder
php ./bin/console prestashop:module install $moduleName
else
# This is for 1.6 versions, we should check the target version an run the command for 1.7 versions
cd $BASEDIR
npm run install-module $targetUrl/admin-dev $modulePath
fi