From 31a26cb2fa3b119d89387454939a22b464213d4c Mon Sep 17 00:00:00 2001 From: Arturo Rinaldi Date: Fri, 10 Mar 2017 12:30:59 +0100 Subject: [PATCH] adding arduino-linux-setup.sh script --- build/build.xml | 1 + build/linux/dist/arduino-linux-setup.sh | 222 ++++++++++++++++++++++++ build/linux/dist/install.sh | 3 + 3 files changed, 226 insertions(+) create mode 100755 build/linux/dist/arduino-linux-setup.sh diff --git a/build/build.xml b/build/build.xml index e12d763a6..b5e2f0bb3 100644 --- a/build/build.xml +++ b/build/build.xml @@ -632,6 +632,7 @@ + diff --git a/build/linux/dist/arduino-linux-setup.sh b/build/linux/dist/arduino-linux-setup.sh new file mode 100755 index 000000000..c98a6ce31 --- /dev/null +++ b/build/linux/dist/arduino-linux-setup.sh @@ -0,0 +1,222 @@ +# arduino-linux-setup.sh : A simple Arduino setup script for Linux systems +# Copyright (C) 2015 Arduino Srl +# +# Author : Arturo Rinaldi +# E-mail : arturo@arduino.org +# Project URL : https://github.com/artynet/arduino-linux-setup +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Release v8 changelog : +# +# + rules are now created in /tmp folder +# +# Release v7 changelog : +# +# + Adding project URL +# + minor bugfixing +# +# Release v6 changelog : +# +# + removing sudocheck function and control +# +# Release v5 changelog : +# +# + adding UDEV rule for stm32 DFU mode +# +# Release v4 changelog : +# +# + The rules are generated in a temporary folder +# +# + the user should run it without sudo while having its permissions +# +# Release v3 changelog : +# +# + The most common linux distros are now fully supported +# +# + now the script checks for SUDO permissions +# + +#! /bin/bash + +# if [[ $EUID != 0 ]] ; then +# echo This must be run as root! +# exit 1 +# fi + +refreshudev () { + + echo "" + echo "Restarting udev" + echo "" + + sudo service udev restart + sudo udevadm control --reload-rules + sudo udevadm trigger + +} + +groupsfunc () { + + echo "" + echo "******* Add User to dialout,tty, uucp, plugdev groups *******" + echo "" + + 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 + +} + +acmrules () { + + echo "" + echo "# Setting serial port rules" + echo "" + +cat < /tmp/90-extraacl.rules + + openocdrules > /tmp/98-openocd.rules + + avrisprules > /tmp/avrisp.rules + + dfustm32rules > /tmp/40-dfuse.rules + + dfuarduino101rules > /tmp/99-arduino-101.rules + + sudo mv /tmp/*.rules /etc/udev/rules.d/ + + refreshudev + + echo "" + echo "*********** Please Reboot your system ************" + echo "" +fi diff --git a/build/linux/dist/install.sh b/build/linux/dist/install.sh index ca7b699db..e4bd8b633 100755 --- a/build/linux/dist/install.sh +++ b/build/linux/dist/install.sh @@ -70,6 +70,9 @@ xdg_install_f() { rm "${TMP_DIR}/${RESOURCE_NAME}.desktop" rmdir "$TMP_DIR" + # Launching arduino-linux-setup.sh script + #./arduino-linux-setup.sh $(whoami) + } # Install by simply copying desktop file (fallback)