summarylogtreecommitdiffstats
path: root/asd.install
blob: ade2c84eb7f0b61d26c052235db83590240dfb51 (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
## arg 1:  the new package version
## arg 2:  the old package version

_stopit() {
	systemctl is-active asd.service &>/dev/null
	if [ $? -eq 0 ]; then
		echo '--> Pacman must stop asd before it can upgrade.'
		echo '--> Please start it manually once the upgrade is complete.'
		systemctl stop asd.service &>/dev/null
	fi
}

pre_upgrade() {
	for version in 5.69 5.76; do
		if [ $(vercmp $2 $version) -lt 0 ]; then
			_stopit
		fi
	done
}

post_install() {
	echo '--------------------------------------------------------------------------'
	echo '  Define what to sync in /etc/asd.conf'
	echo '  Read the manpage before use and also see the wiki page'
	echo '  https://wiki.archlinux.org/index.php/Anything-sync-daemon'
	echo
	echo '  ALWAYS backup your important data before using utils like asd!'
	echo '--------------------------------------------------------------------------'
}

pre_remove() {
	systemctl is-active asd.service &>/dev/null
	if [ $? -eq 0 ]; then
		echo '--> In order to preserve your data, pacman will now stop asd.'
		systemctl stop asd.service &>/dev/null
	fi
}