summaryrefslogtreecommitdiff
blob: e70b150028d7b647551946425f2427de33281acb (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
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/sbin/openrc-run
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

depend() {
    # you need the elfspe bin
    need localmount
}

start() {
    ebegin "Registering elfspe to binfmt"
    
    if test -f /proc/sys/fs/binfmt_misc/spe
    then
        eerror "elfspe already registered"
        return 1
    else
        if test -f /proc/sys/fs/binfmt_misc/register
        then
            echo ':spe:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x17::/usr/bin/elfspe:' >/proc/sys/fs/binfmt_misc/register 
            eend $?
        else
            eerror "binfmt not available"
            return 1
        fi
    fi
}

stop() {
    if ! test -f /proc/sys/fs/binfmt_misc/spe
    then
        eerror "elfspe not present"
        return 1
    else
        echo -1 > /proc/sys/fs/binfmt_misc/spe
        eend $?
    fi
}