Skip to content

updating arduino-linux-setup.sh script to release v10 #8669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 40 additions & 12 deletions build/linux/dist/arduino-linux-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) 2015 Arduino Srl
#
# Author : Arturo Rinaldi
# E-mail : arturo@arduino.org
# E-mail : arty.net2@gmail.com
# Project URL : https://github.com/artynet/arduino-linux-setup
#
# This program is free software: you can redistribute it and/or modify
Expand All @@ -18,6 +18,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Release v10 changelog :
#
# + Adding support for Slackware
# + Changed distribution not supported message
# + Changed distribution check sort order (thanks to thenktor @github.com)
# + Small fix for ArchLinux
#
# Release v9 changelog :
#
# + Adding support for ArchLinux
# + Adding support for systemd
# + Fixing a couple of wrong kernel entries
#
# Release v8 changelog :
#
# + rules are now created in /tmp folder
Expand Down Expand Up @@ -48,7 +61,7 @@
# + now the script checks for SUDO permissions
#

#! /bin/bash
#!/bin/bash

# if [[ $EUID != 0 ]] ; then
# echo This must be run as root!
Expand All @@ -61,10 +74,16 @@ refreshudev () {
echo "Restarting udev"
echo ""

sudo service udev restart
sudo udevadm control --reload-rules
sudo udevadm trigger

if [ -d /lib/systemd/ ]
then
sudo systemctl restart systemd-udevd
else
sudo service udev restart
fi

}

groupsfunc () {
Expand All @@ -73,10 +92,11 @@ groupsfunc () {
echo "******* Add User to dialout,tty, uucp, plugdev groups *******"
echo ""

sudo groupadd plugdev
sudo groupadd dialout
sudo usermod -a -G tty $1
sudo usermod -a -G dialout $1
sudo usermod -a -G uucp $1
sudo groupadd plugdev
sudo usermod -a -G plugdev $1

}
Expand All @@ -88,8 +108,8 @@ acmrules () {
echo ""

cat <<EOF
"KERNEL="ttyUSB[0-9]*", TAG+="udev-acl", TAG+="uaccess", OWNER="$1"
"KERNEL="ttyACM[0-9]*", TAG+="udev-acl", TAG+="uaccess", OWNER="$1"
KERNEL=="ttyUSB[0-9]*", TAG+="udev-acl", TAG+="uaccess", OWNER="$1"
KERNEL=="ttyACM[0-9]*", TAG+="udev-acl", TAG+="uaccess", OWNER="$1"
EOF

}
Expand Down Expand Up @@ -168,21 +188,29 @@ removemm () {
echo "******* Removing modem manager *******"
echo ""

if [ -f /etc/lsb-release -a ! -f /etc/SuSE-release ] || [ -f /etc/debian_version ] || [ -f /etc/linuxmint/info ]
then
#Only for Ubuntu/Mint/Debian
sudo apt-get -y remove modemmanager
elif [ -f /etc/SuSE-release ]
if [ -f /etc/SuSE-release ]
then
#Only for Suse
sudo zypper remove modemmanager
elif [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ]
then
#Only for Red Hat/Fedora/CentOS
sudo yum remove modemmanager
elif [ -f /etc/arch-release ]
then
#Only for ArchLinux
sudo pacman -Rdd modemmanager
elif [ -f /etc/slackware-version ]
then
#Only for Slackware
sudo removepkg ModemManager
elif [ -f /etc/lsb-release ] || [ -f /etc/debian_version ] || [ -f /etc/linuxmint/info ]
then
#Only for Ubuntu/Mint/Debian
sudo apt-get -y remove modemmanager
else
echo ""
echo "Your system is not supported, please take care of it with your package manager"
echo "Your system is not supported, please remove the ModemManager package with your package manager!"
echo ""
fi

Expand Down