aboutsummaryrefslogtreecommitdiffstats
path: root/lang/ruby16-shim-ruby18/pkg-install
blob: ff6264190e0c0affac44f62fa943d6b1198273cd (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
#
# $FreeBSD$

PKGNAME=$1
PKG_DBDIR=${PKG_DBDIR:-/var/db/pkg}

die () {
    echo $* >&2
    exit 1
}

delete_modules () {
    modules="
    bigfloat
    devel-logger
    dl
    drb
    erb
    fileutils
    fnmatch
    gserver
    openssl
    optparse
    racc-runtime
    rdoc
    rexml
    soap
    strscan
    testunit
    webrick
    xmlrpc
    yaml
    zlib
    "

    echo "Deinstalling modules being replaced by $PKGNAME..."

    cd $PKG_DBDIR || die "$PKG_DBDIR is not found"

    for portname in $modules; do
    for pkg in $RUBY_PKGNAMEPREFIX$portname-*; do
        if [ -d $pkg ]; then
        echo "---> $pkg"
        /usr/sbin/pkg_delete -f $pkg
        fi
    done
    done
}

RUBY_PKGNAMEPREFIX=$(expr "$PKGNAME" : '\([^-]*-\)')

if [ -z $RUBY_PKGNAMEPREFIX ]; then
    die "Cannot determine RUBY_PKGNAMEPREFIX from '$PKGNAME'."
fi

case $2 in
    PRE-INSTALL)
    delete_modules
    ;;
    POST-INSTALL)
    ;;
    *)
    die "usage: sh $0 \$PKGNAME { PRE-INSTALL | POST-INSTALL }"
    ;;
esac

exit 0