first commit

This commit is contained in:
lehmancurtis147 2019-05-15 10:28:40 -05:00
parent fc939ecb53
commit ee59830ada
13 changed files with 67 additions and 77 deletions

0
51-android.rules Normal file → Executable file
View File

View File

@ -1,53 +1,23 @@
# android-udev-rules
# __51-android-rules *UBUNTU*__
## Description
## Intro
These rules refer to [Run Apps on a Hardware Device - Android Studio](https://developer.android.com/studio/run/device.html) and include many suggestions from the Archlinux and Github Communities.
To create an easy-to-install version of _M0RF30's_ work which can be found [here](https://github.com/M0Rf30/android-udev-rules.git). This installer should work on most linux distros, but is focused on Ubuntu (try others at your own risk).
#### Installation
## Installation
To install simply clone [this](https://github.com/lehmancurtis147/android-udev-rules.git) repository.
### Arch
```bash
$cd ./android-udev-rules.git
```
On Arch it should be enough to follow the [instructions for connecting a device on the Arch wiki](https://wiki.archlinux.org/index.php/Android_Debug_Bridge). There's no need to clone this repository.
followed by
```bash
$sudo bash ./install.sh
```
### Ubuntu
Things seem to go smoother without having devices plugged in until after installation.
# Clone this repository
git clone https://github.com/M0Rf30/android-udev-rules.git
cd android-udev-rules
# Copy rules file
sudo cp -v 51-android.rules /etc/udev/rules.d/51-android.rules
# OR create a sym-link to the rules file - choose this option if you'd like to update your udev rules using git.
sudo ln -sf "$PWD"/51-android.rules /etc/udev/rules.d/51-android.rules
# Change file permissions
sudo chmod a+r /etc/udev/rules.d/51-android.rules
# If adbusers group already exists remove old adbusers group
groupdel adbusers
# add the adbusers group if it's doesn't already exist
sudo mkdir -p /usr/lib/sysusers.d/ && sudo cp android-udev.conf /usr/lib/sysusers.d/
sudo systemd-sysusers # (1)
# OR on Fedora:
groupadd adbusers
# Add your user to the adbusers group
sudo usermod -a -G adbusers $(whoami)
# Restart UDEV
sudo udevadm control --reload-rules
sudo service udev restart
# OR on Fedora:
sudo systemctl restart systemd-udevd.service
# Restart the ADB server
adb kill-server
# Replug your Android device and verify that USB debugging is enabled in developer options
adb devices
# You should now see your device
(1) Not available on Ubuntu 16.04 and mint 18, use `sudo groupadd adbusers` instead.
## To Contribute:
1. Fork this repository.
2. Make your edits.
3. TEST THEM!
4. Create a pull request.
*Special thanks to M0RF30 for the original effort*.

0
android-udev.conf Normal file → Executable file
View File

View File

@ -1,5 +0,0 @@
android-udev-rules (0.0.1-1) stable; urgency=low
* First build of a deb
-- builder <builder@wheezy-builder> Mon, 24 Mar 2014 16:05:35 +0100

5
debian/changelog vendored
View File

@ -1,5 +0,0 @@
android-udev-rules (0.0.1-1) stable; urgency=low
* First build of a deb
-- builder <builder@wheezy-builder> Mon, 24 Mar 2014 16:05:35 +0100

1
debian/compat vendored
View File

@ -1 +0,0 @@
7

1
debian/files vendored
View File

@ -1 +0,0 @@
android-udev-rules_0.0.1-1_amd64.deb developer-tools extra

2
debian/install vendored
View File

@ -1,2 +0,0 @@
android-udev.conf /usr/lib/sysusers.d
51-android.rules /etc/udev/rules.d

13
debian/postinst vendored
View File

@ -1,13 +0,0 @@
#!/bin/bash
# Setup permissions
chmod a+r /etc/udev/rules.d/51-android.rules
# Make sure adbusers is setup properly
groupadd adbusers
usermod -a -G adbusers $(whoami)
# Reload udev and reset adb
udevadm control --reload-rules
service udev restart
adb kill-server

6
debian/rules vendored
View File

@ -1,6 +0,0 @@
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_make:
make

53
install.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/bash
################################
## Install android-udev-rules ##
################################
#
## Install adb and fastboot
sudo apt-get install android-tools-adb android-tools-fastboot
## Clone rules
# git clone https://github.com/M0Rf30/android-udev-rules.git
# this line has been included to give credit to the work I built on
git clone https://github.com/lehmancurtis147/android-udev-rules.git
## Install rules
if [ ! /usr/lib/sysusers.d/android-udev.conf ]; then
sudo cp ./android-udev.conf /usr/lib/sysusers.d
else
echo "android-udev.conf already exist"
fi
if [ ! /etc/udev/rules.d/51-andriod.rules ]; then
sudo cp -v ./51-android.rules /etc/udev/rules.d;
sudo chmod a+r /etc/udev/rules.d/51-android.rules
else
echo "rules are already installed"
fi
## Set up adb users group
#
# Delete old rules
sudo groupdel adbusers
# Configure adbusers
if [ ! /usr/lib/sysusers.d/ ]; then
sudo mkdir -p /usr/lib/sysusers.d/ && sudo cp android-udev.conf /usr/lib/sysusers.d/
else
echo "adbusers already configured"
fi
sudo systemd-sysusers # (1)
# Add user to adb group
sudo usermod -a -G adbusers $(whoami)
# Reload rules
sudo udevadm control --reload-rules
# Start udev services
sudo service udev restart
# Reset adb server
sudo adb kill-server
sudo adb devices