3 SMACK_PATH=`grep smack /proc/mounts | awk '{print $2}'`
4 test_label="test_label"
5 onlycap_initial=`cat $SMACK_PATH/onlycap`
6 smack_initial=`cat /proc/self/attr/current`
8 # need to set out label to be the same as onlycap, otherwise we lose our smack privileges
10 echo "$test_label" > /proc/self/attr/current
12 echo "$test_label" > $SMACK_PATH/onlycap || RC=$?
13 if [ $RC -ne 0 ]; then
14 echo "Onlycap label could not be set"
18 if [ `cat $SMACK_PATH/onlycap` != "$test_label" ]; then
19 echo "Onlycap label was not set correctly."
23 # resetting original onlycap label
24 echo "$onlycap_initial" > $SMACK_PATH/onlycap 2>/dev/null
26 # resetting our initial's process label
27 echo "$smack_initial" > /proc/self/attr/current