chore: install.sh: some edits to make it work with sudo & su (close #242) (#244)

This commit is contained in:
Gianluca Boiano 2022-12-10 23:23:12 +01:00 committed by GitHub
parent ac87fda61d
commit 070127712e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -3,7 +3,7 @@
CURRENT_UID="$(id -u)"
if [ "$CURRENT_UID" -ne 0 ]; then
echo "Please run using sudo!"
echo "Please run as root!"
exit 1
fi
@ -12,13 +12,16 @@ if [ "$USE_SYMLINK" = "true" ]; then
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/
install -Dm644 android-udev.conf \
/usr/lib/sysusers.d/android-udev.conf
systemd-sysusers
else
groupdel adbusers
groupadd adbusers
getent group 'adbusers' >/dev/null ||
groupadd -f 'adbusers'
fi
usermod -a -G adbusers "$(logname)"