diff options
| author | 2017-06-15 20:09:03 +0200 | |
|---|---|---|
| committer | 2017-06-15 20:09:03 +0200 | |
| commit | b1bc747824c21749d3d09c1aa6b1ce71087cd8cd (patch) | |
| tree | ea0eecf5d717fe3c95a250ded5843e0d2f7c4772 /configure.ac | |
| parent | c2c463af0fe7988c465f88403a50a45af8cb2777 (diff) | |
| download | libirecovery-b1bc747824c21749d3d09c1aa6b1ce71087cd8cd.tar.gz libirecovery-b1bc747824c21749d3d09c1aa6b1ce71087cd8cd.tar.bz2 | |
Add udev rules file to allow non-root users access DFU/Recovery mode devices
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 54 |
1 files changed, 54 insertions, 0 deletions
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 " |
