summarylogtreecommitdiffstats
path: root/clash-premium-tun.install
blob: 48bf5f459dacca06fa671bf37c81d5b4370a223f (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
pre_install() {
	if [ -f /etc/clash/config.yaml ]; then
		mv /etc/clash/config.yaml /etc/clash/config.yaml.bak
	fi
}

post_install() {
    echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
	echo "+  Install successfully                                         +"
    echo "+                                                               +"
    echo "+  Home directory at /etc/clash                                 +"
    echo "+                                                               +"
    echo "+  All dns traffic will be redirected to 1.0.0.1:53             +"
    echo "+  Please use clash core's 'tun.dns-hijack' to handle it        +"
    echo "+                                                               +"
    echo "+  Use 'systemctl start clash' to start                         +"
    echo "+  Use 'systemctl enable clash' to enable auto-restart on boot  +"
	echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
}

pre_upgrade() {
	if [ -f /etc/clash/config.yaml ]; then
		mv /etc/clash/config.yaml /etc/clash/config.yaml.user
	fi
}

post_upgrade() {
    if [ -f /etc/clash/config.yaml.user ]; then
		mv /etc/clash/config.yaml.user /etc/clash/config.yaml
	fi
	systemctl restart clash
}

pre_remove() {
	systemctl stop clash
    systemctl disable clash
	if [ -f /etc/clash/config.yaml ]; then
      mv /etc/clash/config.yaml /etc/clash/config.yaml.bak
    fi
}

post_remove() {
	systemctl daemon-reload
}