forked from truongan/wecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·71 lines (63 loc) · 1.99 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·71 lines (63 loc) · 1.99 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
64
65
66
67
68
69
70
71
usage(){
cat << EOF
usage: $0 [-a admin_user_name] [-e admin_email] -u db_user -d db -p password -s site_url
base url will be set in config.php
OPTIONS:
-a admin username default to be "abc"
-p database and admin password
-e admin email default to be "abc@def.com"
-d database name
-s site url with format "http://..."
EOF
}
echo "Running install.sh in `pwd`"
username="abc"
email="abc@def.com"
db_user=""
db=""
password=""
site_url=""
while getopts "ha:e:p:u:d:s:" ops ; do
case "${ops}" in
h) usage ;;
a) username=${OPTARG};;
e) email=${OPTARG};;
u) db_user=${OPTARG};;
d) db=${OPTARG};;
p) password=${OPTARG};;
s) site_url=${OPTARG};;
*) usage; exit 1;;
esac
done
if [ "$db_user" = "" ]; then
usage; exit 1
fi
if [ "$db" = "" ]; then
db=$db_user
fi
if [ "$site_url" = "" ]; then
usage; exit 1
fi
if [ "$password" = "" ]; then
usage; exit 1
fi
echo $site_url
#php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# wget -O composer-setup.php https://getcomposer.org/installer
#php -r "if (hash_file('sha384', 'composer-setup.php') === 'c31c1e292ad7be5f49291169c0ac8f683499edddcfd4e42232982d0fd193004208a58ff6f353fde0012d35fdd72bc394') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
# php composer-setup.php
# php -r "unlink('composer-setup.php');"
wget https://github.com/composer/composer/releases/download/2.1.9/composer.phar
php composer.phar install
cp .env.example .env
# site_url=`printf "%q" "$site_url"`
# password=`printf "%q" "$password"`
sed -i "s,APP_URL.*,APP_URL=$site_url,g" .env # Can't use / character here because it's url
sed -i "s/DB_USERNAME.*/DB_USERNAME=$db_user/g" .env
sed -i "s/DB_DATABASE.*/DB_DATABASE=$db/g" .env
sed -i "s/DB_PASSWORD.*/DB_PASSWORD=$password/g" .env
php artisan key:generate
php artisan migrate:refresh
php artisan db:seed --class=installation_seeding
php artisan add_admin truonganpn truonganpnt@ttafs.uit.edu.vn $password
php artisan add_admin $username $email $password