summaryrefslogtreecommitdiffstats
path: root/proteanos-branding.pkg/postinst
blob: 09610a78f824c96f56bc94291e84184335f743f6 (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
#!/bin/sh

if [ "x${1}" = 'xconfigure' ]; then
	if [ "x$(ls -A /var/www/ | head -n 1)" = 'x' ]; then
		# There are no files in /var/www/.
		cp /usr/share/branding/www/index.html /var/www/index.html
		sha256sum /var/www/index.html \
			>/usr/share/branding/www/SHA256SUMS
		[ -e /var/www/branding ] || \
			ln -s /usr/share/branding /var/www/branding
	elif [ -f /var/www/index.html ] && \
			[ -f /usr/share/branding/www/SHA256SUMS ]; then
		if sha256sum -cs /usr/share/branding/www/SHA256SUMS; then
			# /var/www/index.html exists and hasn't been modified by
			# the user.
			cp /usr/share/branding/www/index.html \
				/var/www/index.html
			sha256sum /var/www/index.html \
				>/usr/share/branding/www/SHA256SUMS
			[ -e /var/www/branding ] || \
				ln -s /usr/share/branding /var/www/branding
		fi
	fi
fi