Skip to content

Commit fca62ee

Browse files
authored
Add udev rules installer
1 parent 62d4346 commit fca62ee

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

android-tools-appimage.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ln -s ./Android.png ./.DirIcon
3333
cat >> ./AppRun << 'EOF'
3434
#!/bin/bash
3535
CURRENTDIR="$(readlink -f "$(dirname "$0")")"
36-
UDEVNOTICE=$(echo "If you get errors it might be because you don't have the android udev rules for your device" )
36+
UDEVNOTICE=$(echo "If you get errors it might be because of missing android udev rules, use --getudev to install them")
3737
if [ "$1" = "adb" ]; then
3838
"$CURRENTDIR"/adb "${@:2}" || echo "$UDEVNOTICE"
3939
elif [ "$1" = "etc1tool" ]; then
@@ -48,6 +48,19 @@ if [ "$1" = "adb" ]; then
4848
"$CURRENTDIR"/mke2fs "${@:2}" || echo "$UDEVNOTICE"
4949
elif [ "$1" = "sqlite3" ]; then
5050
"$CURRENTDIR"/sqlite3 "${@:2}" || echo "$UDEVNOTICE"
51+
elif [ "$1" = "--getudev" ]; then
52+
if cat /etc/udev/rules.d/*droid.rules > /dev/null; then
53+
echo "udev rules already installed"
54+
echo “Errors persisting with installed udev rules may be due to specific phone missing from the rules or insufficient permissions on the phone”
55+
else
56+
UDEVREPO=https://github.com/M0Rf30/android-udev-rules.git
57+
git clone $UDEVREPO
58+
cd android-udev-rules
59+
chmod a+x ./install.sh
60+
echo "udev rules installer from $UDEVREPO"
61+
sudo ./install.sh
62+
cd .. && cat /etc/udev/rules.d/*droid.rules > /dev/null && rm -rf "./android-udev-rules"
63+
fi
5164
else
5265
echo "Error: No command specified, try \"./*tools.AppImage adb shell\" for example"
5366
echo "You can also use aliases or wrapper scripts to not write ./*tools.AppImage every time"

0 commit comments

Comments
 (0)