[Android Q&A, Help & Troubleshooting] YarsRevenge78:
ATTENTION LINUX USERS:

I am currently testing my Knives & Forks script in some virtual machines using VirtualBox, as well as my local Xubuntu installation.

For distro specific things (installing 32-bit libs, udev changes, etc) in the next release I will be detecting the distro using the following code:

echo " -- DETECTING LINUX DISTRO --"

if [ "`cat /etc/issue | grep Arch | wc -l`" == "1" ]; then
DISTRO_NAME="Arch"
elif [ "`cat /etc/issue | grep Cent | wc -l`" == "1" ]; then
DISTRO_NAME="CentOS"
elif [ "`cat /etc/issue | grep Debian | wc -l`" == "1" ]; then
DISTRO_NAME="Debian"
elif [ "`cat /etc/issue | grep Fedora | wc -l`" == "1" ]; then
DISTRO_NAME="Fedora"
elif [ "`cat /etc/issue | grep Ubuntu | wc -l`" == "1" ]; then
# DETECTS UBUNTU, KUBUNTU, XUBUNTU, ETC
DISTRO_NAME="Ubuntu"
else
DISTRO_NAME="UNKNOWN"
fi

echo " - $DISTRO_NAME"

Please let me know what other distros your using and if you are able to find the name using the "/etc/issue" method I am using in the above if statements.

I wrote a bash function to check if sudo is installed, and then to see if the current user has permissions to use sudo. If sudo is not installed, or if the current user does not have permission to use it, su will be used instead. This will be included in my next update, but I wanted to post it here first:

echo " -- CHECKING TO SEE IF 'SUDO' IS INSTALLED --"

CURRENT_USER=$USER
USE_SUDO="NO"

if [ -f "/usr/bin/sudo" ]; then
echo " - 'sudo' is installed."
echo ""
echo " -- CHECKING FOR PERMISSION TO USE 'SUDO' --"
echo ""
echo " If prompted, enter the password for the user '$CURRENT_USER'."
echo ""
if [ "$(sudo whoami)" != "root" ]; then
echo ""
echo " - Sorry, '$CURRENT_USER' does not have permission to use 'sudo'."
echo " - 'su' will be uses instead of 'sudo'."
echo ""
else
echo " - '$CURRENT_USER' has permission to use 'sudo'."
USE_SUDO="YES"
echo ""
fi
else
echo " - 'sudo' is not installed."
echo " - 'su' will be used instead of 'sudo'."
echo ""
fi

DO_SU()
{
echo ""
if [ $USE_SUDO == "YES" ]; then
# echo " -- USING 'SUDO' TO RUN '$1' --"
echo ""
echo " If prompted, enter the password for the user '$CURRENT_USER'."
echo ""
sudo $1
else
# echo " -- USING 'SU' TO RUN '$1' --"
echo ""
echo " If prompted, enter the password for the user 'root'."
echo ""
su -c "$1"
fi
echo ""
}

# EXAMPLE USAGE OF THE DO_SU() FUNCTION:
# NOTE THAT THE COMMAND TO RUN WITH SU OR SUDO HAS TO BE IN QUOTES
DO_SU "whoami"

I also found out why debian users were being forced to use sudo or su in order to use adb. The next release will include this fix, but for those who might be interested in making this change manually:

Open "/lib/udev/rules.d/91-permissions.rules" as root (su or sudo) in your favorite text editor and find this line

usbfs-like devices SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, \ MODE=”0664″

Change MODE to "0666"

usbfs-like devices SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, \ [B]MODE=”0666“[/B]

Instead of replacing or modifying your "/lib/udev/rules.d/91-permissions.rules" file, the next version of my script will actually create a "/lib/udev/rules.d/92-permissions.rules" for Debian users that contains only the following:

# usbfs-like devices
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \
MODE="0666"

This file will load right after the 91-permissions.rules and replace just the usbfs-like devices settings. I'm just doing this with my script so I don't accidently break anything on your system. If you are making the changes manually, editing the 91-permissions.rules file should be all you need to do.

Save your changes and then restart udev as root (using sudo or su)

/etc/init.d/udev restart

-- or --

service udev restart

This assumes of course that you already have a working udev rule for your android device, and that adb is working only with su or sudo currently. Once this change is made you should be able to use adb without being forced to use su or sudo.