#!/bin/sh
#########
# This script installs axelq in the appropriate directories
# 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'
axel=`which axel`
while [ -n "$1" ]; do
e="`expr "$1" : '--\(.*=.*\)'`"
if [ -z "$e" ]; then
cat<<EOH
axelq install
Usage: $0 [OPTIONS]
Option Description Default
--prefix=... Directories to put files in $prefix
--etcdir=... $etcdir
--bindir=... $bindir
--mandir=... $mandir
--axel=... Command to run axel $axel
EOH
exit;
fi
eval "$e"
shift;
done
if [ -z "$axel" ]; then
cat<<EOW
WARNING: axel is not found. Default of 'axel' is assumed. You probably
need to edit /etc/axelq.rc
EOW
axel=axel
fi
# Expand $prefix
etcdir=`eval echo $etcdir`
bindir=`eval echo $bindir`
mandir=`eval echo $mandir`
axel=`eval echo $axel`
if [ -f $etcdir/axelq.rc ]; then
echo Configuration file found. Keeping current configuration
else
mkdir -p $etcdir
cat << EOF >> $etcdir/axelq.rc
# $etcdir/axelq.rc: system-wide configuration for axelq
# Use command to specify the location (and command-line parameters) of axel,
# e.g. command=/usr/bin/axel
command=$axel
# failaction specifies what to do when an error occurs. You can specify
# ask, remove, maintain or move. ask makes axelq ask each time what to do.
# remove will auto-remove the download and start the next. maintain will
# retry and move will move the download to the end of the queue. This
# setting is case-sensitive.
#
# NOTE: best is to keep this to its default. maintain will cause axelq to
# retry until it dies. This is not good, since it will cause unnecessary
# bandwidth consumption for both you and the server. This is rude.
# move will act like maintain, if there is only one file in the queue.
failaction=ask
# qfile lets you specify where to store your queue.
qfile=~/.axelq
EOF
fi
echo "etcdir=$etcdir" > installed
echo "bindir=$bindir" >> installed
echo "mandir=$mandir" >> installed
mkdir -p $bindir
mkdir -p $mandir/man1
cp axelq $bindir/axelq
cp axelq.1 $mandir/man1/axelq.1
chmod 0644 $etcdir/axelq.rc
chmod 0755 $bindir/axelq
chmod 0644 $mandir/man1/axelq.1
echo axelq installed in $bindir
syntax highlighted by Code2HTML, v. 0.9.1