This repository was archived by the owner on Aug 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·52 lines (44 loc) · 1.37 KB
/
install.sh
File metadata and controls
executable file
·52 lines (44 loc) · 1.37 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
#!/bin/bash
#
# time2backup server install script
#
# MIT License
# Copyright (c) 2017-2021 Jean Prunneaux
# Website: https://github.com/time2backup/server
#
if [ "$(whoami)" != root ] ; then
echo "You must be root to install time2backup server!"
exit 1
fi
# current directory
curdir=$(dirname "$0")
# load libbash
source "$curdir"/libbash/libbash.sh - &> /dev/null
if [ $? != 0 ] ; then
echo >&2 "internal error"
exit 1
fi
# create global link
ln -sf "$lb_current_script_directory/t2b-server.sh" /usr/bin/time2backup-server
if [ $? != 0 ] ; then
lb_error "Cannot create global link"
exit 1
fi
# create t2b group if not exists
if ! grep -q '^t2b-server:' /etc/group ; then
addgroup t2b-server
if [ $? != 0 ] ; then
lb_error "Cannot create group t2b-server"
exit 1
fi
fi
# secure current directory permissions
chmod -R 750 "$curdir"
chmod -x "$curdir"/*.md "$curdir"/config/* "$curdir"/docs/* "$curdir"/inc/* \
"$curdir"/libbash/*.* "$curdir"/libbash/*/*
touch "$curdir"/.access && chmod 660 "$curdir"/.access
touch "$curdir"/config/auth.conf && chmod 640 "$curdir"/config/auth.conf
touch "$curdir"/server.log && chmod 660 "$curdir"/server.log
[ -f "$curdir"/config/time2backup-server.conf ] || cp "$curdir"/config/time2backup-server.example.conf "$curdir"/config/time2backup-server.conf
chmod 640 "$curdir"/config/time2backup-server.conf
chown -R root:t2b-server "$curdir"