Skip to content

Commit baeb4c6

Browse files
authored
Merge pull request #8669 from artynet/arduino-linux-setup-refresh
updating arduino-linux-setup.sh script to release v10
2 parents e92d594 + 9ab3ca5 commit baeb4c6

File tree

1 file changed

+40
-12
lines changed

1 file changed

+40
-12
lines changed

build/linux/dist/arduino-linux-setup.sh

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (C) 2015 Arduino Srl
33
#
44
# Author : Arturo Rinaldi
5-
# E-mail : arturo@arduino.org
5+
# E-mail : arty.net2@gmail.com
66
# Project URL : https://github.com/artynet/arduino-linux-setup
77
#
88
# This program is free software: you can redistribute it and/or modify
@@ -18,6 +18,19 @@
1818
# You should have received a copy of the GNU General Public License
1919
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
#
21+
# Release v10 changelog :
22+
#
23+
# + Adding support for Slackware
24+
# + Changed distribution not supported message
25+
# + Changed distribution check sort order (thanks to thenktor @github.com)
26+
# + Small fix for ArchLinux
27+
#
28+
# Release v9 changelog :
29+
#
30+
# + Adding support for ArchLinux
31+
# + Adding support for systemd
32+
# + Fixing a couple of wrong kernel entries
33+
#
2134
# Release v8 changelog :
2235
#
2336
# + rules are now created in /tmp folder
@@ -48,7 +61,7 @@
4861
# + now the script checks for SUDO permissions
4962
#
5063

51-
#! /bin/bash
64+
#!/bin/bash
5265

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

64-
sudo service udev restart
6577
sudo udevadm control --reload-rules
6678
sudo udevadm trigger
6779

80+
if [ -d /lib/systemd/ ]
81+
then
82+
sudo systemctl restart systemd-udevd
83+
else
84+
sudo service udev restart
85+
fi
86+
6887
}
6988

7089
groupsfunc () {
@@ -73,10 +92,11 @@ groupsfunc () {
7392
echo "******* Add User to dialout,tty, uucp, plugdev groups *******"
7493
echo ""
7594

95+
sudo groupadd plugdev
96+
sudo groupadd dialout
7697
sudo usermod -a -G tty $1
7798
sudo usermod -a -G dialout $1
7899
sudo usermod -a -G uucp $1
79-
sudo groupadd plugdev
80100
sudo usermod -a -G plugdev $1
81101

82102
}
@@ -88,8 +108,8 @@ acmrules () {
88108
echo ""
89109

90110
cat <<EOF
91-
"KERNEL="ttyUSB[0-9]*", TAG+="udev-acl", TAG+="uaccess", OWNER="$1"
92-
"KERNEL="ttyACM[0-9]*", TAG+="udev-acl", TAG+="uaccess", OWNER="$1"
111+
KERNEL=="ttyUSB[0-9]*", TAG+="udev-acl", TAG+="uaccess", OWNER="$1"
112+
KERNEL=="ttyACM[0-9]*", TAG+="udev-acl", TAG+="uaccess", OWNER="$1"
93113
EOF
94114

95115
}
@@ -168,21 +188,29 @@ removemm () {
168188
echo "******* Removing modem manager *******"
169189
echo ""
170190

171-
if [ -f /etc/lsb-release -a ! -f /etc/SuSE-release ] || [ -f /etc/debian_version ] || [ -f /etc/linuxmint/info ]
172-
then
173-
#Only for Ubuntu/Mint/Debian
174-
sudo apt-get -y remove modemmanager
175-
elif [ -f /etc/SuSE-release ]
191+
if [ -f /etc/SuSE-release ]
176192
then
177193
#Only for Suse
178194
sudo zypper remove modemmanager
179195
elif [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ]
180196
then
181197
#Only for Red Hat/Fedora/CentOS
182198
sudo yum remove modemmanager
199+
elif [ -f /etc/arch-release ]
200+
then
201+
#Only for ArchLinux
202+
sudo pacman -Rdd modemmanager
203+
elif [ -f /etc/slackware-version ]
204+
then
205+
#Only for Slackware
206+
sudo removepkg ModemManager
207+
elif [ -f /etc/lsb-release ] || [ -f /etc/debian_version ] || [ -f /etc/linuxmint/info ]
208+
then
209+
#Only for Ubuntu/Mint/Debian
210+
sudo apt-get -y remove modemmanager
183211
else
184212
echo ""
185-
echo "Your system is not supported, please take care of it with your package manager"
213+
echo "Your system is not supported, please remove the ModemManager package with your package manager!"
186214
echo ""
187215
fi
188216

0 commit comments

Comments
 (0)