Add install script (#176)

Simplify the install process by adding a lightly configurable install script based on the README.md instructions.
This commit is contained in:
Kenzi Jeanis 2020-02-15 06:26:32 -06:00 committed by GitHub
parent ceeb08ee96
commit 135e1bc6f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 38 additions and 0 deletions

38
install.sh Executable file
View File

@ -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