26 lines
687 B
Bash
26 lines
687 B
Bash
|
#!/bin/bash
|
||
|
which gohttpd
|
||
|
if [ $? -eq 0 ]; then
|
||
|
echo "gohttpd is already installed."
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
#获取当前脚本所在目录
|
||
|
scriptPath=$( cd `dirname $0` && pwd )
|
||
|
|
||
|
# 创建目录/usr/local/gohttpd
|
||
|
mkdir -p /usr/local/gohttpd
|
||
|
# 复制文件到scriptPath下的所有文件到/usr/local/gohttpd
|
||
|
cp -r $scriptPath/* /usr/local/gohttpd/
|
||
|
# link /usr/local/gohttpd/gohttpd to /usr/local/bin/gohttpd
|
||
|
ln -s /usr/local/gohttpd/gohttpd /usr/local/bin/gohttpd
|
||
|
|
||
|
# 安装gohttpd.service文件
|
||
|
cp $scriptPath/gohttpd.service /etc/systemd/system/
|
||
|
# 启动服务
|
||
|
systemctl daemon-reload
|
||
|
systemctl enable gohttpd.service
|
||
|
systemctl start gohttpd.service
|
||
|
|
||
|
echo "gohttpd installed successfully."
|