summarylogtreecommitdiffstats
path: root/asd.install
blob: 71cb86943d7a060161345b5ebdd58b753f506de9 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
DAEMON_FILE="/run/asd"

pre_upgrade() {
	## arg 1:  the new package version
	## arg 2:  the old package version
	oldpkgver=${2%-*}

	if [[ $oldpkgver < 5.69 ]]; then
		if [ -e $DAEMON_FILE ]; then
			if ! systemd-notify --booted; then # not using systemd  
				echo '--> Pacman must stop asd before it can upgrade.'
				echo '--> Please start it manually once the upgrade is complete.'
				/etc/rc.d/asd stop
			else
				echo '--> Pacman must stop asd before it can upgrade.'
				echo '--> Please start it manually once the upgrade is complete.'
				/usr/bin/systemctl stop asd
			fi
		fi
	fi
}

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 '--------------------------------------------------------------------------'
}

post_upgrade() {
	## arg 1:  the new package version
	## arg 2:  the old package version
	oldpkgver=${2%-*}
	#newpkgver=${1%-*}

	if [[ $oldpkgver < 3.13 ]]; then
		echo '-------------------------------------------------------------------'
		echo ' Support for cron has been deprecated in favor of a systemd timer.'
		echo ' This package now provides both asd.service and asd-resync.service'
		echo
		echo ' systemctl enable asd asd-resync'
		echo ' systemctl start asd asd-resync'
		echo
		echo ' See the wiki or man page for more info.'
		echo '-------------------------------------------------------------------'
	else
		/bin/true
	fi
}

pre_remove() {
	if [ -e $DAEMON_FILE ]; then
		if ! systemd-notify --booted; then # not using systemd  
			echo '--> Automatically stopping asd to rotate data back out of tmpfs.'
			/etc/rc.d/asd stop
		else
			echo '--> Automatically stopping asd to rotate data back out of tmpfs.'
			/usr/bin/systemctl stop asd
		fi
	fi
}