#!/bin/sh
# C.Ostheimer 12-2005
addon=capircvd
#server=http://192.168.222.10
server=http://www.spblinux.de/fbox
export PATH=$PATH:/sbin:/usr/sbin:/var/$addon/bin
errorexit()
{
echo -e "$@"
exit 1
}
cd /var
case $1 in
install)
free
echo "installing $addon ..."
for f in rd.o freeramdisk; do
[ $f = rd.o -a -d /dev/rd ] && continue
[ -f $f ] || wget $server/$f
done
chmod 755 freeramdisk
[ -d /dev/rd ] || insmod rd.o
[ -d /dev/rd ] || errorexit "failed to use ramdisk /dev/rd/ (module rd.o)"
[ -d $addon ] || mkdir $addon
if ! mount |grep -q "on /var/$addon"; then
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 none; do
mount |grep -q "^/dev/rd/$i " || break
done
[ $i = none ] && errorexit "error: no free ramdisk found"
if [ -f $addon.sqf ]; then
cat $addon.sqf >/dev/rd/$i
else
echo -n "$addon.sqf -> /dev/rd/$i: "
wget $server/$addon.sqf -O /dev/rd/$i
fi
[ $? -eq 0 ] && mount /dev/rd/$i $addon
fi
for d in spool spool/capircvd; do
[ -d $d ] || mkdir $d
done
cd /var/spool/capircvd
for f in ansage.la beep.la; do
[ -f $f ] && echo "NOT changing existing file $f in /var/spool/capircvd" && continue
[ -L $f ] || ln -s ../../$addon/etc/$addon/$f.default $f
done