Ubuntu Pastebin

Paste from Lex Canh at Tue, 5 Apr 2016 07:29:45 +0000

Download as text
  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
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/bin/sh

OS=`uname -s 2>/dev/null`
PLATFORM=`uname -i 2>/dev/null`
UDEV_DIR="/etc/udev"
UDEV_CONF_FILE="$UDEV_DIR/udev.conf"


echo ""
echo "WiNRADiO G315 driver and API installation"
echo ""

if [ $(id -ur) != 0 ]; then
    echo "Please, run this installer as root."
    echo "Installation aborted."
    echo ""
    exit 1
fi

if [ "$OS" != "Linux" ]; then
    echo "Your operating system is not supported."
    echo "Installation aborted."
    echo ""
    exit 1
fi

if [ "$PLATFORM" != "i386" ] && [ "$PLATFORM" != "x86_64" ]; then
    echo "Your hardware platform is not supported."
    echo "i386 or x86_64 hardware platform is required."
    echo "Installation aborted."
    echo ""
    exit 1
fi

echo "Compiling G315 kernel module"

cd "driver"

if [ $? != 0 ]; then
    echo "Could not find G315 driver source code."
    echo "Installation aborted."
    echo ""
    exit 1
fi

make clean
make

echo ""

if [ ! -f "wrg315.ko" ]; then
    cd ..
    echo "Compilation of G315 kernel module failed."
    echo "Please, check if development tools and development package"
    echo "for building kernel modules are installed and check if your kernel"
    echo "supports loadable modules."
    echo "Installation aborted."
    echo ""
    exit 1
fi

echo "Writing udev rule"

if [ -f "$UDEV_CONF_FILE" ]; then
    udev_rules=""
    
    source "$UDEV_CONF_FILE"
    
    if [ "$udev_rules" != "" ]; then
	WiNRADiO_RULES="$udev_rules/WiNRADiO.rules"
    else
	WiNRADiO_RULES="$UDEV_DIR/rules.d/WiNRADiO.rules"
    fi
    
    if [ -f "$WiNRADiO_RULES" ]; then
	WRG3=`less "$WiNRADiO_RULES" | grep wrg3`
	
	if [ "$WRG3" == "" ]; then
	    if [ -s "$WiNRADiO_RULES" ]; then
    		echo "" >> "$WiNRADiO_RULES"
    	    fi
	
    	    echo "# WiNRADiO G3xx devices" >> "$WiNRADiO_RULES"
	    echo "KERNEL==\"wrg3*\"				MODE=\"0644\"" >> "$WiNRADiO_RULES"
	else
	    echo "G315 udev rule exists."	    
	fi
    else
	echo "# WiNRADiO G3xx devices" > "$WiNRADiO_RULES"
	echo "KERNEL==\"wrg3*\"				MODE=\"0644\"" >> "$WiNRADiO_RULES"
    fi
else
    echo "Warning: unable to find udev configuration file."
    echo "udev is not installed or its configuration file"
    echo "is another than $UDEV_CONF_FILE."
    echo "G315 udev rule will not be written."
    echo "It is possible only root will have the accces to"
    echo "the G315 devices."
    echo ""
fi

echo "Installing G315 kernel module"
make uninstall >/dev/null 2>&1
make install

echo ""

if [ $? != 0 ]; then
    cd ..

    echo "G315 kernel module installation failed."
    echo "Installation aborted."
    echo ""
    exit 1
fi

cd ..

/sbin/modprobe wrg315

echo "Installing G315 API"

install -m 755 lib/wrg315api.so /usr/lib

if [ $? != 0 ]; then
    if [ "$PLATFORM" == "i386" ]; then
	echo "Installation of G315 API failed."
	echo "Installation aborted."
	echo ""
	exit 1
    else
	echo "Installation of 32bit G315 API failed."
	echo "Installation aborted."
	echo ""
	exit 1
    fi
fi

if [ "$PLATFORM" == "i386" ]; then
    echo "G315 API (wrg315api.so) installed to /usr/lib"
else
    echo "32bit G315 API (wrg315api.so) installed to /usr/lib"
fi

if [ "$PLATFORM" == "x86_64" ]; then
    install -m 755 lib64/wrg315api.so /usr/lib64
    
    if [ $? != 0 ]; then
	echo "Installation of 64bit G315 API failed."
	echo "Installation aborted."
	echo ""
	exit 1
    fi
    
    echo "64bit G315 API (wrg315api.so) installed to /usr/lib64"
fi

echo ""
echo "Done."
echo ""

exit 0
Download as text