Skip to content

Commit

Permalink
Add install script (#176)
Browse files Browse the repository at this point in the history
Simplify the install process by adding a lightly configurable install script based on the README.md instructions.
  • Loading branch information
isavegas committed Feb 15, 2020
1 parent ceeb08e commit 135e1bc
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions install.sh
@@ -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

0 comments on commit 135e1bc

Please sign in to comment.