-
Notifications
You must be signed in to change notification settings - Fork 20
/
clerk_toolbox_magento.sh
111 lines (103 loc) · 3.57 KB
/
clerk_toolbox_magento.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env bash
echo "-----------------------------------------"
echo "- Welcome To Clerk.io Magento 1 Toolbox -"
echo "-----------------------------------------"
case "$1" in
-i|--install)
if [ -z "$2" ];
then
echo "No extension version detectet! you have to add a second parameter with the extension version you want to install."
else
echo "-------------------------------------------"
echo "- Installing Clerk.io Magento 1 Extension -"
echo "-------------------------------------------"
echo "-------------------"
echo "- Creating Backup -"
echo "-------------------"
tar -czf clerkbackup.tar.gz . --exclude=./*.gz;
echo "---------------------"
echo "- Backup Completed! -"
echo "---------------------"
echo ""
echo "-------------------------------"
echo "- Downloading Clerk Extension -"
echo "-------------------------------"
wget "https://github.com/clerkio/clerk-magento/releases/download/${2}/ClerkForMagento-${2}.tgz"
echo "-----------------------"
echo "- Download Completed! -"
echo "-----------------------"
echo ""
echo "------------------------------"
echo "- Installing Clerk Extension -"
echo "------------------------------"
chmod +x mage
./mage install-file "ClerkForMagento-${2}.tgz"
echo "----------------------"
echo "- Install Completed! -"
echo "----------------------"
echo ""
echo "------------------------------------------------"
echo "- DONE! Clerk.io Extension is now ready to use -"
echo "------------------------------------------------"
fi
;;
-u|--uninstall)
echo "---------------------------------------------"
echo "- Uninstalling Clerk.io Magento 1 Extension -"
echo "---------------------------------------------"
if [ "$2" == "--force" ];
then
rm -rf ./skin/frontend/base/default/clerk/
rm -rf ./app/code/community/Clerk/
rm -rf ./app/etc/modules/Clerk_Clerk.xml
rm -rf ./app/design/frontend/base/default/layout/clerk.xml
rm -rf ./app/design/frontend/base/default/template/clerk/
rm -rf ./app/design/adminhtml/default/default/layout/clerk.xml
for d in ./app/locale//*/ ; do
rm -rf "${d}Clerk_Clerk.csv"
done
rm -rf ./skin/frontend/base/default/clerk/
else
./mage uninstall community ClerkForMagento
fi
echo "---------------------------"
echo "- Uninstalling Completed! -"
echo "---------------------------"
echo ""
echo "-----------------------------------------------"
echo "- DONE! Clerk.io Extension is now Uninstalled -"
echo "-----------------------------------------------"
;;
-r|--restore)
echo "--------------------------"
echo "- Rebuilding From Backup -"
echo "--------------------------"
tar -zxvf clerkbackup.tar.gz;
echo "-------------------------"
echo "- Rebuilding Completed! -"
echo "-------------------------"
;;
-b|--backup)
shift
echo "-------------------"
echo "- Creating Backup -"
echo "-------------------"
tar -czf clerkbackup.tar.gz . --exclude=./*.gz;
echo "---------------------"
echo "- Backup Completed! -"
echo "---------------------"
shift
;;
*)
echo "-------------------"
echo "- Toolbox Options -"
echo "-------------------"
echo "-i, --install {version} Installing Clerk.io Magento 1 Extension"
echo "-u, --uninstall Uninstalling Clerk.io Magento 1 Extension"
echo "-u --force, --uninstall --force Force uninstalling Clerk.io Magento 1 Extension if it have been removed wrong earlyer"
echo "-r, --restore Restore from the backup"
echo "-b, --backup Make full backup of Magento 1"
exit 0
break
;;
esac