This repository was archived by the owner on Feb 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathinstall.sh
executable file
·62 lines (55 loc) · 1.81 KB
/
install.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
#! /bin/bash
#====================================================================
# install.sh
#
# Linux + Apache + Nginx + MySQL + PHP Auto Install Script
#
# Copyright (c) 2012, WangYan <[email protected]>
# All rights reserved.
# Distributed under the GNU General Public License, version 3.0.
#
# Intro: https://wangyan.org/blog/lanmp.html
#
#====================================================================
if [ $(id -u) != "0" ]; then
clear && echo "Error: You must be root to run this script!"
exit 1
fi
LANMP_PATH=`pwd`
if [ `echo $LANMP_PATH | awk -F/ '{print $NF}'` != "lanmp" ]; then
clear && echo "Please enter lanmp script path:"
read -p "(Default path: ${LANMP_PATH}/lanmp):" LANMP_PATH
[ -z "$LANMP_PATH" ] && LANMP_PATH=$(pwd)/lanmp
cd $LANMP_PATH/
fi
DISTRIBUTION=`awk 'NR==1{print $1}' /etc/issue`
if echo $DISTRIBUTION | grep -Eqi '(Red Hat|CentOS|Fedora|Amazon)';then
PACKAGE="rpm"
elif echo $DISTRIBUTION | grep -Eqi '(Debian|Ubuntu)';then
PACKAGE="deb"
else
if cat /proc/version | grep -Eqi '(redhat|centos)';then
PACKAGE="rpm"
elif cat /proc/version | grep -Eqi '(debian|ubuntu)';then
PACKAGE="deb"
else
echo "Please select the package management! (rpm/deb)"
read -p "(Default: rpm):" PACKAGE
if [ -z "$PACKAGE" ]; then
PACKAGE="rpm"
fi
if [[ "$PACKAGE" != "rpm" && "$PACKAGE" != "deb" ]];then
echo -e "\nNot supported linux distribution!"
echo "Please contact me! WangYan <[email protected]>"
exit 0
fi
fi
fi
[ -r "$LANMP_PATH/fifo" ] && rm -rf $LANMP_PATH/fifo
mkfifo $LANMP_PATH/fifo
cat $LANMP_PATH/fifo | tee $LANMP_PATH/log.txt &
exec 1>$LANMP_PATH/fifo
exec 2>&1
/bin/bash ${LANMP_PATH}/${PACKAGE}.sh
sed -i '/password/d' $LANMP_PATH/log.txt
rm -rf $LANMP_PATH/fifo