-
Notifications
You must be signed in to change notification settings - Fork 2
/
mxmknod
42 lines (39 loc) · 959 Bytes
/
mxmknod
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
dev=/dev
[ "$#" -eq 3 ] || {
echo "usage: mxmknod [Name] [Major#] [Minor#]"
exit
}
[ -e $dev/$1 ] && {
./mxrmnod $1
}
if [ -f /etc/sysconfig/selinux ]
then
STATUS=`sestatus | grep "SELinux " | perl -ne '@F = split; print "$F[2]\n";'`
if [ "$STATUS" = enabled ]
then
[ -e $dev/$1 ] || {
if [ -f /etc/selinux/targeted/setrans.conf ]
then
{
echo "mknod -Z system_u:object_r:tty_device_t:s0 -m 666 $1 c $2 $3"
mknod -Z system_u:object_r:tty_device_t:s0 -m 666 $dev/$1 c $2 $3 > /dev/null 2>&1
}
else
{
echo "mknod -Z system_u:object_r:tty_device_t -m 666 $1 c $2 $3"
mknod -Z system_u:object_r:tty_device_t -m 666 $dev/$1 c $2 $3 > /dev/null 2>&1
}
fi
}
else
[ -e $dev/$1 ] || {
echo "mknod -m 666 $1 c $2 $3"
mknod -m 666 $dev/$1 c $2 $3 > /dev/null 2>&1
}
fi
else
[ -e $dev/$1 ] || {
echo "mknod -m 666 $1 c $2 $3"
mknod -m 666 $dev/$1 c $2 $3 > /dev/null 2>&1
}
fi