summarylogtreecommitdiffstats
path: root/pac4cli.install
blob: 27db59d65ca4628beda8087e0eb3f4274591535b (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
source "/usr/share/makepkg/util/message.sh"

pre_install() {
	colorize
	# check for already defined http(s)_proxy
	RESULT=$(grep -r -E '(http_proxy=)|(HTTP_PROXY=)|(https_proxy=)|(HTTPS_PROXY=)' \
			${DESTDIR}/${PREFIX}/etc/profile.d | cut -d':' -f1 | sort | uniq)
	if [[ "x${RESULT}" != "x" ]];then 
		warning "Found these scripts setting the enviroment variables http_proxy & HTTP_PROXY:"
		while read -ra FILES; do
			for FILE in "${FILES[@]}"; do 
				echo ${FILE}
			done
		done  <<< "${RESULT}"
		warning "You have to either remove those definitions, or set them manually to 'localhost:3128'."
		warning "Otherwise, pac4cli may fail to work properly."
	fi
}

pre_upgrade() {
	colorize
	IS_ACTIVE=$(systemctl is-active pac4cli 2>/dev/null)
	if [[ "xIS_ACTIVE" == "xactive" ]]; then
		msg2 "Stopping pac4cli service..."
		systemctl stop pac4cli
	fi
}

post_upgrade() {
	colorize
	if [[ "x$IS_ACTIVE" == "xactive" ]]; then
		warning "You need to reload systemd daemons and start pac4cli service."
		warning "# systemd daemon-reload"
		warning "# systemd start pac4cli"
	fi
}

post_install() {
	colorize
	msg "You need to restart your machine and then start pac4cli service."
}

pre_remove() {
	systemctl stop pac4cli
	systemctl disable pac4cli
}