SHA256
1
0
forked from pool/s390-tools
s390-tools/dasdro
2017-02-21 11:14:26 +00:00

21 lines
418 B
Bash

#!/bin/bash
# checks DASD accessibility in VM and sets Linux-side readonly attributes
# accordingly
modprobe -q vmcp
vmcp q v dasd 2>/dev/null >/dev/null || exit 0 # not running in VM
vmcp q v dasd | while read x dev rest
do
dev=`echo $dev|tr A-F a-f`
roattr=/sys/bus/ccw/devices/?.?.$dev/readonly
test -e $roattr || continue
if echo "$rest"|grep -q R/O
then
echo 1 >$roattr
else
echo 0 >$roattr
fi
done