diff options
| -rw-r--r-- | Makefile.am | 4 | ||||
| -rw-r--r-- | configure.ac | 54 | ||||
| -rw-r--r-- | udev/39-libirecovery.rules.in | 5 | ||||
| -rw-r--r-- | udev/Makefile.am | 21 |
4 files changed, 82 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 021066e..0ddd6f7 100644 --- a/Makefile.am +++ b/Makefile.am | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | AUTOMAKE_OPTIONS = foreign | 1 | AUTOMAKE_OPTIONS = foreign |
| 2 | ACLOCAL_AMFLAGS = -I m4 | 2 | ACLOCAL_AMFLAGS = -I m4 |
| 3 | SUBDIRS = src include tools | 3 | SUBDIRS = src include tools udev |
| 4 | 4 | ||
| 5 | pkgconfigdir = $(libdir)/pkgconfig | 5 | pkgconfigdir = $(libdir)/pkgconfig |
| 6 | pkgconfig_DATA = libirecovery.pc \ No newline at end of file | 6 | pkgconfig_DATA = libirecovery.pc |
diff --git a/configure.ac b/configure.ac index 422e527..e13c571 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -147,6 +147,59 @@ if test "$enable_largefile" != no; then | |||
| 147 | fi | 147 | fi |
| 148 | AC_SUBST(LFS_CFLAGS) | 148 | AC_SUBST(LFS_CFLAGS) |
| 149 | 149 | ||
| 150 | AC_ARG_WITH([udev], | ||
| 151 | AS_HELP_STRING([--with-udev], | ||
| 152 | [Configure and install udev rules file for DFU/Recovery mode devices]), | ||
| 153 | [], | ||
| 154 | [if $($PKG_CONFIG --exists udev); then with_udev=yes; else with_udev=no; fi]) | ||
| 155 | |||
| 156 | AC_ARG_WITH([udevrulesdir], | ||
| 157 | AS_HELP_STRING([--with-udevrulesdir=DIR], | ||
| 158 | [Directory for udev rules (implies --with-udev)]), | ||
| 159 | [with_udev=yes], | ||
| 160 | [with_udevrulesdir=auto]) | ||
| 161 | |||
| 162 | AC_ARG_WITH([udevrule], | ||
| 163 | AS_HELP_STRING([--with-udevrule="RULE"], | ||
| 164 | [udev activation rule (implies --with-udev)]), | ||
| 165 | [with_udev=yes], | ||
| 166 | [with_udevrule=auto]) | ||
| 167 | |||
| 168 | if test "x$with_udev" = "xyes"; then | ||
| 169 | if test "x$with_udevrule" = "xauto"; then | ||
| 170 | for I in plugdev storage disk staff; do | ||
| 171 | if grep $I /etc/group >/dev/null; then | ||
| 172 | USEGROUP=$I | ||
| 173 | break | ||
| 174 | fi | ||
| 175 | done | ||
| 176 | if test "x$USEGROUP" != "x"; then | ||
| 177 | if ! groups |grep $USEGROUP >/dev/null; then | ||
| 178 | AC_MSG_WARN([The group '$USEGROUP' was determined to be used for the udev rule, but the current user is not member of this group.]) | ||
| 179 | fi | ||
| 180 | else | ||
| 181 | AC_MSG_ERROR([Could not determine an appropriate user group for the udev activation rule. | ||
| 182 | Please manually specify a udev activation rule using --with-udevrule=<RULE> | ||
| 183 | Example: --with-udevrule="OWNER=\\"root\\", GROUP=\\"myusergroup\\", MODE=\\"0660\\""]) | ||
| 184 | fi | ||
| 185 | with_udevrule="OWNER=\"root\", GROUP=\"$USEGROUP\", MODE=\"0660\"" | ||
| 186 | fi | ||
| 187 | |||
| 188 | if test "x$with_udevrulesdir" = "xauto"; then | ||
| 189 | udevdir=$($PKG_CONFIG --silence-errors --variable=udevdir udev) | ||
| 190 | if test "x$udevdir" != "x"; then | ||
| 191 | with_udevrulesdir=$udevdir"/rules.d" | ||
| 192 | else | ||
| 193 | with_udevrulesdir="\${prefix}/lib/udev/rules.d" | ||
| 194 | AC_MSG_WARN([Could not determine default udev rules directory. Using $with_udevrulesdir.]) | ||
| 195 | fi | ||
| 196 | fi | ||
| 197 | |||
| 198 | AC_SUBST([udev_activation_rule], [$with_udevrule]) | ||
| 199 | AC_SUBST([udevrulesdir], [$with_udevrulesdir]) | ||
| 200 | fi | ||
| 201 | AM_CONDITIONAL(WITH_UDEV, test "x$with_udev" = "xyes") | ||
| 202 | |||
| 150 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) | 203 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) |
| 151 | 204 | ||
| 152 | AC_OUTPUT([ | 205 | AC_OUTPUT([ |
| @@ -155,6 +208,7 @@ src/Makefile | |||
| 155 | include/Makefile | 208 | include/Makefile |
| 156 | tools/Makefile | 209 | tools/Makefile |
| 157 | libirecovery.pc | 210 | libirecovery.pc |
| 211 | udev/Makefile | ||
| 158 | ]) | 212 | ]) |
| 159 | 213 | ||
| 160 | echo " | 214 | echo " |
diff --git a/udev/39-libirecovery.rules.in b/udev/39-libirecovery.rules.in new file mode 100644 index 0000000..3f1e906 --- /dev/null +++ b/udev/39-libirecovery.rules.in | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # Handle iOS devices in DFU and Recovery mode - for use with libirecovery | ||
| 2 | |||
| 3 | # Change group and permissions of iOS devices in DFU, legacy WTF, and Recovery mode | ||
| 4 | ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="122[27]|128[0-3]", @udev_activation_rule@ | ||
| 5 | |||
diff --git a/udev/Makefile.am b/udev/Makefile.am new file mode 100644 index 0000000..2a7ad98 --- /dev/null +++ b/udev/Makefile.am | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | if WITH_UDEV | ||
| 2 | edit = \ | ||
| 3 | $(SED) -r \ | ||
| 4 | -e 's|@udev_activation_rule[@]|$(udev_activation_rule)|g' \ | ||
| 5 | < $< > $@ || rm $@ | ||
| 6 | |||
| 7 | udevrules_DATA = \ | ||
| 8 | 39-libirecovery.rules | ||
| 9 | |||
| 10 | 39-libirecovery.rules: 39-libirecovery.rules.in | ||
| 11 | $(edit) | ||
| 12 | |||
| 13 | EXTRA_DIST = \ | ||
| 14 | 39-libirecovery.rules.in | ||
| 15 | |||
| 16 | MAINTAINERCLEANFILES = \ | ||
| 17 | 39-libirecovery.rules | ||
| 18 | |||
| 19 | CLEANFILES = \ | ||
| 20 | 39-libirecovery.rules | ||
| 21 | endif | ||
