Skip to content

Commit 2c5bed1

Browse files
committed
Fixed udev rules support
1 parent 7935422 commit 2c5bed1

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
gphoto2-updater
22
===============
33

4-
Gphoto2 2.5.5 compiler and installer script v0.4
4+
Gphoto2 2.5.5 compiler and installer script v0.4.1
55
http://github.com/gonzalo/gphoto2-updater
66

77
This script is specifically created for Raspbian http://www.raspbian.org
@@ -14,9 +14,10 @@ Please send any feedback or comments to gonzalo.cao(at)gmail.com
1414

1515
How-to use
1616
==========
17-
Just be sure you are connected to the Internet and run it as:
17+
Just be sure you are connected to the Internet and download and run it with this commands:
1818

1919
```
20+
$ wget https://raw.githubusercontent.com/gonzalo/gphoto2-updater/master/gphoto2-updater.sh
2021
$ chmod +x gphoto2-updater.sh
2122
$ sudo ./gphoto2-updater.sh
2223
```

gphoto2-updater.sh

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#/bin/sh
22

3-
# Gphoto2 2.5.5 compiler and installer script v0.3.1
3+
# Gphoto2 2.5.5 compiler and installer script v0.4.1
44
#
55
# This script is specifically created for Raspbian http://www.raspbian.org
66
# and Raspberry Pi http://www.raspberrypi.org but should work over any
@@ -159,11 +159,37 @@ echo
159159
ldconfig
160160

161161
echo
162-
echo "-----------------------------------------------------------------------------------------------"
163-
echo "Setting up permissions for USB ports, see http://www.gphoto.org/doc/manual/permissions-usb.html"
164-
echo "-----------------------------------------------------------------------------------------------"
162+
echo "---------------------------------------------------------------------------------"
163+
echo "Generating udev rules, see http://www.gphoto.org/doc/manual/permissions-usb.html"
164+
echo "---------------------------------------------------------------------------------"
165165
echo
166-
/usr/local/lib/libgphoto2/print-camera-list udev-rules version 0.98 group plugdev mode 0660 > /etc/udev/rules.d/90-libgphoto2.rules
166+
167+
udev_version=$(udevd --version)
168+
169+
if [ "$udev_version" -ge "201" ]
170+
then
171+
udev_rules=201
172+
elif [ "$udev_version" -ge "175" ]
173+
then
174+
udev_rules=175
175+
elif [ "$udev_version" -ge "136" ]
176+
then
177+
udev_rules=136
178+
else
179+
udev_rules=0.98
180+
fi
181+
182+
/usr/local/lib/libgphoto2/print-camera-list udev-rules version $udev_rules group plugdev mode 0660 > /etc/udev/rules.d/90-libgphoto2.rules
183+
184+
if [ "$udev_rules" = "201" ]
185+
then
186+
echo
187+
echo "------------------------------------------------------------------------"
188+
echo "Generating hwdb file in /etc/udev/hwdb.d/20-gphoto.hwdb. Ignore the NOTE"
189+
echo "------------------------------------------------------------------------"
190+
echo
191+
/usr/local/lib/libgphoto2/print-camera-list hwdb > /etc/udev/hwdb.d/20-gphoto.hwdb
192+
fi
167193

168194

169195
echo

0 commit comments

Comments
 (0)