-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrascsiphp_setup.sh
More file actions
65 lines (51 loc) · 1.3 KB
/
rascsiphp_setup.sh
File metadata and controls
65 lines (51 loc) · 1.3 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
#!/usr/bin/env bash
#
#
# update package and firmware
function update_package(){
# update package
apt -y update
apt-mark hold raspberrypi-kernel
apt -y full-upgrade
apt-mark unhold raspberrypi-kernel
#apt -y update
#apt -y upgrade
#apt dist-upgrade
# update firmware
#rpi-update
}
# install apt package
function apt_install(){
# Install nginx
apt -y install nginx
# Install php-fpm
apt -y install php-fpm
sed -i -e "44s:index index.html:index index.php index.html:" /etc/nginx/sites-enabled/default
sed -i -e "56,57s:^ #: :" /etc/nginx/sites-enabled/default
sed -i -e "60s:^ #: :" /etc/nginx/sites-enabled/default
sed -i -e "63s:^ #: :" /etc/nginx/sites-enabled/default
if ! grep "www-data" "/etc/sudoers" >/dev/null; then
echo "www-data ALL=NOPASSWD:/sbin/shutdown" >> /etc/sudoers
echo "www-data ALL=NOPASSWD:/usr/bin/pkill" >> /etc/sudoers
fi
}
# install rascsi-php
function rascsiphp_install(){
# Install rascsi-php
cd /var/www/html
wget https://raw.githubusercontent.com/ztto/rascsi-php/master/index.php
}
function conform_check() {
# sudo
if [[ "$(id -u)" -ne 0 ]]; then
echo "Try 'sudo $0'"
echo " 実行する場合は 'sudo $0' と入力して下さい."
exit 1
fi
}
conform_check
update_package
apt_install
rascsiphp_install
echo "Please sudo reboot"
exit 0