summaryrefslogtreecommitdiff
path: root/astro/boinc-setiathome/files/pkg-deinstall.in
blob: c2b6d27a0ca789d24b04ba64f1a92279222f1521 (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
#!/bin/sh

# $FreeBSD$

if [ "$2" != "POST-DEINSTALL" ]; then
    exit 0
fi

F=%%BOINC_CLIENT_HOME%%/projects/%%SETI_SITE%%/app_info.xml
echo Removing setiathome_v7 lines from $F

l=`grep -n "<name>setiathome_v8</name>" $F | cut -f 1 -d :`
if [ $? -ne 0 ]; then
    echo $F is corrupt
    exit 1
fi
l1=$(($l-1))
l2=$(($l+13))
sed -i.bak "${l1},${l2}d" $F # sed wants the braces
rm $F.bak

l=`wc -l $F | cut -f 1 -d / | sed 's/ //g'`
if [ $l -eq 2 ]; then
    echo Removing empty $F
    rm $F
fi