-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
89 lines (59 loc) · 1.98 KB
/
install
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
### openspace bash installer v0.1.0 [https://github.com/openspace42/bash_installer]
################################################################################
### Set bash environment error management
set -e
set -u
### Source local functions file
echo
source_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. $source_dir/functions
### Source openspace functions file
source_os_functions
### Define formatting
os-define_formatting
### Define variables
define_vars
################################################################################
if [[ "${@#--return-check}" = "$@" ]]
then
echo "${r}${b}This script must not be run directly.${x}"
echo
echo "${b}You should instead run the | ${x}${g}${b}setup${x}${b} | script and it will take care of the installation itself.${x}"
echo
echo "${b}Exiting...${x}"
echo
exit 1
fi
################################################################################
### Check for any already existing installation
skip_backup=y
os-check_install_version
### All ready for installation
echo "${b}Initiating install...${x}"
echo
################################################################################
sed -i "/Subsystem/c\Subsystem sftp internal-sftp" "$ssh_config_file"
if ! grep -q "Match Group $sftp_group" "$ssh_config_file"
then
cat <<EOT >> "$ssh_config_file"
Match Group $sftp_group
ChrootDirectory /home/%u
ForceCommand internal-sftp
PasswordAuthentication yes
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
EOT
fi
if ! grep -q $sftp_group /etc/group
then
addgroup "$sftp_group"
fi
service ssh restart
rsync -aAXx $source_dir/ $install_dir/ --include=add-site-to-user --include=add-user --include=functions --exclude="*"
os-install_dependencies -p bindfs
################################################################################
### Mark installer as completed successfully
touch $source_dir/install_complete