Skip to content

Commit 7cee66b

Browse files
Josh GachnangJosh Gachnang
authored andcommitted
Updating installer to do things in a more logical order.
1 parent c33043f commit 7cee66b

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

install-wordpress.sh

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,40 +25,35 @@ randpass() {
2525
RET=`cat /dev/urandom | tr -cd "$CHAR" | head -c ${1:-16}`
2626
}
2727

28-
INSTALL_DIR="/var/www/$1/htdocs"
29-
mkdir -p $INSTALL_DIR
30-
cd $INSTALL_DIR
31-
3228
#Generate all required random passwords/salt/hashes
3329
randpass
3430
DB_PASS=$RET
3531
randpass
3632
USER_PASS=$RET
3733

34+
#Make user and group
35+
useradd $DOMAIN_NAME
36+
echo $USER_PASS > tmp
37+
echo $USER_PASS >> tmp
38+
passwd $DOMAIN_NAME < tmp
39+
rm tmp
40+
3841
#Sanitize domain name to take out periods
3942
DOMAIN_NAME=$(echo $1 | sed "s/\./__/")
4043

44+
INSTALL_DIR="/home/$DOMAIN_NAME/wordpress"
45+
mkdir -p $INSTALL_DIR
46+
cd $INSTALL_DIR
47+
4148
#Get latest version, delete old version
4249
rm latest.*
4350
wget http://wordpress.org/latest.tar.gz
4451

4552
#Extract to web directory
4653
tar xf latest*
47-
mv wordpress/* .
54+
mv wordpress/* /home/$DOMAIN_NAME/wordpress/
4855
rm -rf wordpress/
4956

50-
#Make user and group
51-
useradd $DOMAIN_NAME
52-
groupadd $DOMAIN_NAME
53-
echo $USER_PASS > tmp
54-
echo $USER_PASS >> tmp
55-
passwd $DOMAIN_NAME < tmp
56-
usermod -g $DOMAIN_NAME $DOMAIN_NAME
57-
58-
#chown and chgrp entire directory to new user
59-
chown -R $DOMAIN_NAME *
60-
chgrp -R $DOMAIN_NAME *
61-
6257
#change permissions (not necessary so far)
6358

6459
#Create Database and Database user
@@ -68,7 +63,6 @@ FLUSH PRIVILEGES;
6863
EXIT;" > input
6964
mysql --user=root --password=$2 < input > output.tab
7065

71-
7266
#Make config.php file
7367
echo "<?php
7468
/**

0 commit comments

Comments
 (0)