forked from M0Rf30/android-udev-rules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·34 lines (27 loc) · 723 Bytes
/
install.sh
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
#!/bin/sh
CURRENT_UID="$(id -u)"
if [ "$CURRENT_UID" -ne 0 ]; then
echo "Please run as root!"
exit 1
fi
if [ "$USE_SYMLINK" = "true" ]; then
ln -sf "$PWD"/51-android.rules /etc/udev/rules.d/51-android.rules
else
cp -v 51-android.rules /etc/udev/rules.d/51-android.rules
fi
chmod a+r /etc/udev/rules.d/51-android.rules
if [ "$USE_GROUP" = "false" ]; then
install -Dm644 android-udev.conf \
/usr/lib/sysusers.d/android-udev.conf
systemd-sysusers
else
getent group 'adbusers' >/dev/null ||
groupadd -f 'adbusers'
fi
usermod -a -G adbusers "$(logname)"
udevadm control --reload-rules
if [ "$USE_SERVICE_CMD" = "true" ]; then
service udev restart
else
systemctl restart systemd-udevd.service
fi