aboutsummaryrefslogtreecommitdiffstats
path: root/setsched
blob: 411d999fcdd93b51112c171174a5fce1f7d3a0f2 (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
#!/bin/bash
#
# setsched: facilitate changing the active scheduler plugin.

ADIR=/proc/litmus/active_plugin
PDIR=/proc/litmus/plugins

CHOICE=$1

if [ ! -e $ADIR ]; then
    KERN=`uname -s -r`
    echo "Error: LITMUS^RT not found on $KERN!" 
    exit 1
fi

ACTIVE=`cat $ADIR`

if [ -z "$1" ]; then
    TMP=`mktemp`
    (awk "{print \$1 \" 'Plugin'\"}" $PDIR | \
    xargs  dialog --title "Select Plugin" --backtitle "Current: $ACTIVE"  \
	--cancel-label "Cancel" --ok-label "Select Plugin" \
	--menu "Select a new plugin to run: " 23 60 16) 2> $TMP
    OK=$?
    clear
    if [ "$OK" != "0" ]; then	
	exit 0;
    fi
    CHOICE=`cat $TMP`
    rm $TMP   
fi


echo "$CHOICE" > $ADIR

ACTIVE=`cat $ADIR`

if [ "$ACTIVE" != "$CHOICE" ]; then
    echo "Error: Setting new plugin failed."
    exit 1
fi