diff --git a/Linux_Install.sh b/Linux_Install.sh new file mode 100755 index 000000000..775caf7e1 --- /dev/null +++ b/Linux_Install.sh @@ -0,0 +1,227 @@ +#!/bin/sh + +############################################################################ +## Linux install script for Arduino IDE 2.0 - contributed by Art Sayler ## +## https://github.com/arduinoshop ## +## +## version 1.00 +############################################################################ + +MODE=U +YN=n +RESOURCE_NAME=arduino-arduinoide2 +RED='\033[0;31m' +NOCOLOR='\033[0m' +VERSION="1.00" + +echo "\nLinux_Install.sh ver. $VERSION for the Arduino IDE 2.0\n" + +if [ -z $1 ] +then + echo no option selected - defaulting to single user instalation + echo "usage: ./Linux_Install.sh [local] | [ulocal]" + echo " local - installs IDE for user $USER only ( default if no option given )" + echo " ulocal - uninstall IDE from user $USER" + echo "usage: sudo ./Linux_Install.sh [system] | [usystem]" + echo " system - install IDE systemwide for all users" + echo " usystem - uninstall IDE systemwide from all users\n" + echo "Both local and system installations may be used on the same computer" + echo "for example - a stable release installed systemwide and a nightly for a development user\n" + + MSG="Install IDE 2.0 for user $USER only?" + +elif [ $1 = local ] +then + MSG="Install IDE 2.0 for user $USER only?" +elif [ $1 = ulocal ] +then + MSG="UnInstall IDE 2.0 from user $USER?" + MODE=u +elif [ $1 = usystem ] +then + MSG="UnInstall IDE 2.0 system wide (all users will be affected)?" + MODE=s +elif [ $1 = system ] +then + MSG="Install IDE 2.0 system wide (all users will have access)?" + MODE=S +fi + +# Get absolute path from which this script file was executed +# (Could be changed to "pwd -P" to resolve symlinks to their target) +SCRIPT_PATH=$( pwd -P ) +LIB_PATH=$SCRIPT_PATH +EXE_PATH=$SCRIPT_PATH +# echo S_PATH = $SCRIPT_PATH + + +read -p "$MSG (Y/N) " YN + +if [ -z $YN ] +then + echo OK - exiting + exit +elif [ $YN = n ] +then + echo OK - No is No... exiting + exit +fi + +echo + +###### Remove local user installation + + if [ $MODE = u ] + then + echo Uninstalling IDE 2.0 from user $USER + echo "Deleting ${HOME}/.local/share/applications/${RESOURCE_NAME}l.desktop" + rm ${HOME}/.local/share/applications/${RESOURCE_NAME}l.desktop + + echo "Deleting ${HOME}/.local/lib/${RESOURCE_NAME}" + rm -rf ${HOME}/.local/lib/${RESOURCE_NAME} + + echo "Deleting ${HOME}/.local/bin/${RESOURCE_NAME}" + rm ${HOME}/.local/bin/${RESOURCE_NAME} + + echo "Installation directory and it's contents including this script can be removed" + read -p "Delete directory ${SCRIPT_PATH}? (YES for the affirmative)" YN + if [ -z $YN ] + then + echo exiting; exit + elif [ $YN = YES ] + then + echo "Removing Directory ${SCRIPT_PATH}" + cd .. + rm -rf ${SCRIPT_PATH} + fi + fi + +###### Perform local user only installation + if [ $MODE = U ] + then + + LIB_PATH=${HOME}/.local/lib/${RESOURCE_NAME} + EXE_PATH=${HOME}/.local/bin + + if [ $YN = Y ] || [ $YN = y ] + then + mkdir -p $LIB_PATH + echo -n "Copying files... " + cp -rf * ${HOME}/.local/lib/${RESOURCE_NAME} + echo "Files copied...\n" + fi + + mkdir -p "${HOME}/.local/bin" + rm -f ${HOME}/.local/bin/${RESOURCE_NAME} + ln -s ${HOME}/.local/lib/${RESOURCE_NAME}/arduino-ide ${HOME}/.local/bin/${RESOURCE_NAME} + + # Create a temp dir accessible by all users + TMP_DIR=`mktemp --directory` + + # Create *.desktop file using the existing template file + sed -e "s,,${EXE_PATH}/${RESOURCE_NAME},g" \ + -e "s,,local,g" \ + -e "s,,${LIB_PATH}/arduino2.png,g" "${SCRIPT_PATH}/desktop.template" > "${TMP_DIR}/${RESOURCE_NAME}l.desktop" + + mkdir -p "${HOME}/.local/share/applications" + cp "${TMP_DIR}/${RESOURCE_NAME}l.desktop" "${HOME}/.local/share/applications/" + echo "Installing Launcher and Icon\n" + + echo "Launcher and Icon Installed\n" + echo "Go to \"Show Application\" ( button in lower left or hit \"Super/Windows Key\")" + echo "Search for \"Arduino\" - you will see an Icon labeled \"2.0 $1\"" + echo "click on this icon to run the IDE or right-click to add it to the Dock\n" + +# Clean up temp dir + rm "${TMP_DIR}/${RESOURCE_NAME}l.desktop" + rmdir "${TMP_DIR}" + fi + +######## System Wide Install / UnInstall + if [ $MODE = s ] || [ $MODE = S ] + then + if [ $USER != root ] + then + echo "$RED You must be SuperUser to make SystemWide changes$NOCOLOR\007" + echo "Use sudo ./Linux_Install.sh [option]\n" + exit + fi + fi + +######## System Wide UnInstall + + if [ $MODE = s ] + then + echo Uninstalling IDE 2.0 systemwide + + if [ -f /usr/local/share/applications/${RESOURCE_NAME}.desktop ] + then + echo "Deleting /usr/local/share/applications/${RESOURCE_NAME}.desktop" + rm /usr/local/share/applications/${RESOURCE_NAME}.desktop + fi + + if [ -f /usr/local/bin/${RESOURCE_NAME} ] + then + echo "Deleting /usr/local/bin/${RESOURCE_NAME}" + rm /usr/local/bin/${RESOURCE_NAME} + fi + + if [ -d /usr/local/lib/${RESOURCE_NAME} ] + then + echo "Deleting Directory /usr/local/lib/${RESOURCE_NAME}" + rm -rf /usr/local/lib/${RESOURCE_NAME} + else + echo "/usr/local/lib/${RESOURCE_NAME} does not exist" + fi + + echo "Installation directory and it's contents including this script can be removed" + read -p "Delete directory ${SCRIPT_PATH} (YES)? " YN + if [ -z $YN ] + then + echo "Directory ${SCRIPT_PATH} will not be removed" + elif [ $YN != YES ] + then + echo "Directory ${SCRIPT_PATH} will not be removed" + else + echo "Removing Directory ${SCRIPT_PATH}" + cd .. + rm -rf ${SCRIPT_PATH} + fi + fi + +###### Perform SystemWide installation + if [ $MODE = S ] + then + echo -n "Copying downloaded files to /usr/local/lib... " + LIB_PATH=/usr/local/lib/${RESOURCE_NAME} + EXE_PATH=/usr/local/bin + mkdir -p $LIB_PATH + cp -rf * $LIB_PATH + rm -f $EXE_PATH/${RESOURCE_NAME} + ln -s $LIB_PATH/arduino-ide $EXE_PATH/${RESOURCE_NAME} + echo "Files copied...\n" + + # Create a temp dir accessible by all users + TMP_DIR=`mktemp --directory` + + # Create *.desktop file using the existing template file + sed -e "s,,${EXE_PATH}/${RESOURCE_NAME},g" \ + -e "s,,system,g" \ + -e "s,,${LIB_PATH}/arduino2.png,g" "${SCRIPT_PATH}/desktop.template" > "${TMP_DIR}/${RESOURCE_NAME}.desktop" + + mkdir -p "${HOME}/.local/share/applications" + cp "${TMP_DIR}/${RESOURCE_NAME}.desktop" "/usr/local/share/applications/" + echo "Launcher and Icon Installed\n" + echo "Go to \"Show Application\" ( button in lower left or hit \"Super/Windows Key\")" + echo "Search for \"Arduino\" - you will see an Icon labeled \"2.0 $1\"" + echo "click on this icon to run the IDE or right-click to add it to the Dock\n" + + # mkdir -p "${HOME}/.local/share/metainfo" + # cp "${SCRIPT_PATH}/lib/appdata.xml" "${HOME}/.local/share/metainfo/${RESOURCE_NAME}.appdata.xml" + + # Clean up temp dir + rm "${TMP_DIR}/${RESOURCE_NAME}.desktop" + rmdir "${TMP_DIR}" + fi + +exit diff --git a/Linux_Install_ReadME.txt b/Linux_Install_ReadME.txt new file mode 100644 index 000000000..3bf84535f --- /dev/null +++ b/Linux_Install_ReadME.txt @@ -0,0 +1,39 @@ + +# Arduino IDE 2.x (beta) Linux Installer by Art Sayler - https://ArduinoShop.ca + +This bash script installs the Arduino IDE 2.0 on the Linux Desktop.. + +-- May 5 2021 - tested on Gnome3 / Ubuntu 21.04 ( Hippo ) +-- May 6 2021 - tested on Gnome3 / Ubuntu 20.10 ( Gorilla ) +-- May 6 2021 - tested on Gnome3 / Debian 10 ( Buster ) +-- May 7 2021 - tested on LXQt / Lubuntu 21.04 ( Hippo ) + +# Instructions + +1). open a termina window from the directory where you installed IDE 2.0. + +2). type ./Linux_Install.sh [option] where option is one of the following: + local - installs the IDE for the local user only ( default if no option is given ). + system - installs the IDE system wide for all users. + ulocal - uninstalls the IDE from the current user. + usystem - uninstalls the IDE system wide from all users. + +3). go to "Show Applications" ( button in lower left corner - or hit Home/Windows key ) + +4). type Arduino in the search bar - you should see an icon for Arduino 2.0 + +5). click on the icon to run the IDE - or right-click to add it to the dock. + +NoTE: for LXQt/Lubuntu - the IDE will be accessible from the menu under "Programming" + an icon will also appear on the desktop with a warning symbol + you can delete the icon or right-click to enable "trusted mode" + + +==================================================================================================================== + + +This open source code was written by the Arduino team and is maintained on a daily basis with the help of the community. We invest a considerable amount of time in development, testing and optimization. Please consider donating to support our work, as well as buying original Arduino boards which is the best way to make sure our efforts can continue in the long term. + +## License + +The code contained in this repository and the executable distributions are licensed under the terms of the GNU AGPLv3. The executable distributions contain third-party code licensed under other compatible licenses such as GPLv2, MIT and BSD-3. If you have questions about licensing please contact us at license@arduino.cc diff --git a/arduino2.png b/arduino2.png new file mode 100644 index 000000000..b407e39c9 Binary files /dev/null and b/arduino2.png differ diff --git a/desktop.template b/desktop.template new file mode 100644 index 000000000..e195705af --- /dev/null +++ b/desktop.template @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=IDE +GenericName=Arduino IDE +Comment=Open-source electronics prototyping platform +Exec= +Icon= +Terminal=false +Categories=Development;IDE;Electronics; +MimeType=text/x-arduino; +Keywords=embedded electronics;electronics;avr;microcontroller; +StartupWMClass=processing-app-Base