-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre.sh
More file actions
63 lines (55 loc) · 2.21 KB
/
pre.sh
File metadata and controls
63 lines (55 loc) · 2.21 KB
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
#!/bin/bash
# Shell Script user by SenangHost to Install Composer on cPanel Server
#
# Wrote by qeba-
# This script is intended to be use internally by SenangHost
#
# First script is written on 19/01/2021
# Usage: ./pre.sh
# Requirement: PHP 7.0 ^
# -----------------------------------------------------------------------------
#variable is here not there nor thum
current_date=$(date)
installDir="installtemp"
echo "----------------------------------------------------------------------------------"
printf " SenangHost Auto install v1 \n"
printf "This script will be use to automate setup of Composer for cPanel\n"
echo "System time: $current_date"
echo "----------------------------------------------------------------------------------"
mkdir $installDir
cd $installDir
printf "\nInstall Composer...\n"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
printf "Verifying composer installer....\n"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified...'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
printf "\nRunning the installer now....\n"
printf "\nPlease wait might take a while to complete...\n"
run=$(php composer-setup.php)
#copy composer to public_html
printf "\nPutting composer to public_html....\n"
cp composer.phar ../
#delete temp dir
cd ..
rm -rf $installDir
printf "\n"
#simple guide
echo 'To use composer. run "php composer.phar"'
echo "------------------------------------------------"
sleep 3
echo -e "\e[1;31mPlease make sure required PHP extension have enable to use composer \e[0m"
sleep 2
echo -e "\e[1;31mphar/fileinfo/xmlwriter/json \e[0m"
echo "------------------------------------------------"
sleep 3
echo -e "\e[1;32mNext, we will test the composer and this script will end...\e[0m"
sleep 5
read -p "Press any key to resume ..."
printf "\n"
#testing composer running..
echo -e "\e[1;32mThis will run composer version to test composer is working... \e[0m"
printf "\n"
php composer.phar -v
printf "\n"
echo 'Done!... (Start using composer by using; "php composer.phar"'
printf "\n"
#clear the installation script