#!/bin/sh
#########

# This script uninstalls axelq

# axelq
# 
# A queue manager for the popular download accelerator axel
# 
# You can download axel at: <http://www.lintux.cx/axel.html>
# axel is Copyright Wilmer van der Gaast <lintux@lintux.cx>
# axelq is Copyright Sjoerd Hemminga <sjoerd@huiswerkservice.nl>
# 
# Both programs are freely distributable under the GPL. See the file
# COPYING for details.

##########

prefix='/usr/local'
etcdir='/etc'
bindir='$prefix/bin'
mandir='$prefix/share/man'

purge=0

if [ -r ./installed ]; then
	source ./installed
fi

while [ -n "$1" ]; do
	e="`expr "$1" : '--\(.*=.*\)'`"
	if [ -z "$e" ]; then
		cat<<EOF
axelq uninstall

Usage: $0 [OPTIONS]
Option          Description                             Default

--prefix=...    Directories to put files in             $prefix
--etcdir=...                                            $etcdir
--bindir=...                                            $bindir
--mandir=...                                            $mandir
--purge=0/1     Delete configuration files              $purge
EOF
		exit;
	fi

	eval "$e"
	shift;
done

# Expand $prefix
etcdir=`eval echo $etcdir`
bindir=`eval echo $bindir`
mandir=`eval echo $mandir`

if [ $purge = 1 ]; then
	rm -f $etcdir/axelq.rc
fi

rm -f $bindir/axelq
rm -f $mandir/man1/axelq.1
rm -f ./installed
rm -f ./axelq.rc

if [ $purge = 1 ]; then
	rm -f $etcdir/axelq.rc
	echo axelq purged. Configuration files in homedirectories and queues
	echo are untouched.
else
	echo axelq deleted. All configuration files are still in $etcdir
	echo Queues were not deleted either.
fi
	

syntax highlighted by Code2HTML, v. 0.9.1