summarylogtreecommitdiffstats
path: root/wireguard-ui.install
blob: 4914b6d7292e00b8940cdcbda2a4d4b805e7a24a (plain)
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
all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
blue="${bold}$(tput setaf 4)"
yellow="${bold}$(tput setaf 3)"

noteb() {
  printf "${blue}  ->${yellow} ${bold}$1${all_off}\n"
}

note() {
  printf "${blue}  ->${yellow} $1${all_off}\n"
}

post_install() {
    sysctl -q --system
    systemctl --quiet daemon-reload
    echo
    noteb "Please start and enable service:"
    echo "sudo systemctl enable --now wireguard-ui"
    echo
    note "Then open in browser http://<ip_server>:5000"
    noteb "The default username and password are 'admin'. Please change it to secure your setup!"
    echo
    noteb "REQUIRED: Also specify in server settings PostUp and PostDown scripts:"
    echo "PostUp:   '/opt/wireguard-ui/wgiptables up'"
    echo "PostDown: '/opt/wireguard-ui/wgiptables down'"
    echo
    noteb "Then save server settings and finally start wg server:"
    echo "sudo systemctl enable --now wg-reload.{service,path}"
    echo
}

post_upgrade() {
	post_install
}

pre_remove() {
    systemctl --quiet --no-reload disable --now wireguard-ui.service
    systemctl --quiet --no-reload disable --now wg-reload.path
    systemctl --quiet --no-reload disable --now wg-reload.service
}

post_remove() {
    note "Old settings are located in /opt/wireguard-ui/db, skip removing."
	systemctl --quiet daemon-reload
    sysctl -q --system
}