Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify the install process by adding a lightly configurable install script based on the README.md instructions.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env sh | ||
|
||
SELECTED_USER="$1" | ||
CURRENT_UID="$(id -u)" | ||
|
||
if [ "$SELECTED_USER" = "" ]; then | ||
echo "Please specify a user!" | ||
exit 1 | ||
fi | ||
|
||
if [ $CURRENT_UID -ne 0 ]; then | ||
echo "Please run using sudo!" | ||
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 | ||
mkdir -p /usr/lib/sysusers.d/ && sudo cp android-udev.conf /usr/lib/sysusers.d/ | ||
systemd-sysusers | ||
else | ||
groupdel adbusers | ||
groupadd adbusers | ||
fi | ||
|
||
usermod -a -G adbusers "$USER" | ||
udevadm control --reload-rules | ||
|
||
if [ "$USE_SERVICE_CMD" = "true" ]; then | ||
service udev restart | ||
else | ||
systemctl restart systemd-udevd.service | ||
fi | ||
|