summaryrefslogtreecommitdiff
blob: 07710dd7c3e90b9b9d79ad00a449ba0fa31331ce (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
#!/bin/bash

confDir="etc"
distConfFile="webdav.conf-dist"

sedCmd="/bin/sed"


function die ()
{
	echo "reconfig error: $1" >&2
    	exit 1
}


if [ $1 != "install" ]; then
	# nothing to be done, exit
	exit 0
fi

# Set the correct path within the config file
distConfFilePath="${VHOST_ROOT}/${confDir}/${distConfFile}"
if ! ${sedCmd} -i -e "s|^\(\$INSTALL_BASE\)=.*|\1='${VHOST_ROOT}/';|" \
         ${distConfFilePath}
then
	die "Setting INSTALL_BASE path in ${distConfFilePath} failed"
fi


# Adding logout support
# see: http://webdavcgi.sourceforge.net/doc.html#logout
echo "\$HEADER = '<div class=\"header\">WebDAV CGI - Web interface: You are logged in as <span title="'.`id -a`.'">' .\$ENV{REMOTE_USER}.'</span> (<a href="/logout">Logout</a>).</div>';" >> ${distConfFilePath}