mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
Replaced/improved Linux install and uninstall scripts.
Install script adds menu item, desktop icon, file association for the current user - even if the Arduino installation was placed outside of the user's home dir (such as in /opt or /usr/local). Added three more icon resolutions (64px, 72px, 96px) - by using the 256px file - maybe there is a better source available for this... Modified build.xml for copying the existing icons and mime.xml file, both scripts and adjusted file permissions (ugo+x) for *.sh files to be executable by others by default.
This commit is contained in:
parent
2779b07d79
commit
05654ba0aa
@ -515,7 +515,7 @@
|
|||||||
<target name="linux-checkos" unless="linux">
|
<target name="linux-checkos" unless="linux">
|
||||||
<echo>
|
<echo>
|
||||||
=======================================================
|
=======================================================
|
||||||
Arduino for Linux can only be built on on unix systems.
|
Arduino for Linux can only be built on unix systems.
|
||||||
|
|
||||||
Bye.
|
Bye.
|
||||||
=======================================================
|
=======================================================
|
||||||
@ -537,6 +537,10 @@
|
|||||||
<fileset dir="linux/dist" includes="lib/**" />
|
<fileset dir="linux/dist" includes="lib/**" />
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
|
<copy todir="linux/work/lib">
|
||||||
|
<fileset dir="shared" includes="icons/**/*.png" />
|
||||||
|
</copy>
|
||||||
|
|
||||||
<copy todir="linux/work/lib" flatten="true">
|
<copy todir="linux/work/lib" flatten="true">
|
||||||
<fileset refid="runtime.jars" />
|
<fileset refid="runtime.jars" />
|
||||||
</copy>
|
</copy>
|
||||||
@ -545,13 +549,17 @@
|
|||||||
<param name="target.path" value="linux/work" />
|
<param name="target.path" value="linux/work" />
|
||||||
</antcall>
|
</antcall>
|
||||||
|
|
||||||
<copy todir="linux/work" file="linux/dist/arduino" />
|
<copy tofile="linux/work/lib/arduino-arduinoide.xml" file="linux/dist/mime.xml" />
|
||||||
<copy todir="linux/work" file="linux/dist/arduino.desktop" />
|
<copy todir="linux/work/lib" file="linux/dist/desktop.template" />
|
||||||
<copy todir="linux/work" file="linux/dist/install.sh" />
|
|
||||||
<chmod perm="755" file="linux/work/arduino" />
|
|
||||||
|
|
||||||
<copy todir="linux/work" file="linux/dist/arduino" />
|
<copy todir="linux/work" file="linux/dist/arduino" />
|
||||||
<chmod perm="755" file="linux/work/arduino" />
|
<copy todir="linux/work" file="linux/dist/install.sh" />
|
||||||
|
<copy todir="linux/work" file="linux/dist/uninstall.sh" />
|
||||||
|
|
||||||
|
<chmod perm="ugo+x">
|
||||||
|
<fileset dir="linux/work" includes="arduino" />
|
||||||
|
<fileset dir="linux/work" includes="**/*.sh" />
|
||||||
|
</chmod>
|
||||||
|
|
||||||
<antcall target="unzip">
|
<antcall target="unzip">
|
||||||
<param name="archive_file" value="./libastylej-2.05.1.zip" />
|
<param name="archive_file" value="./libastylej-2.05.1.zip" />
|
||||||
|
@ -3,8 +3,8 @@ Type=Application
|
|||||||
Name=Arduino IDE
|
Name=Arduino IDE
|
||||||
GenericName=Arduino IDE
|
GenericName=Arduino IDE
|
||||||
Comment=Open-source electronics prototyping platform
|
Comment=Open-source electronics prototyping platform
|
||||||
Exec=FULL_PATH/arduino
|
Exec=<BINARY_LOCATION>
|
||||||
Icon=FULL_PATH/lib/arduino.png
|
Icon=<ICON_NAME>
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=Development;IDE;Electronics;
|
Categories=Development;IDE;Electronics;
|
||||||
MimeType=text/x-arduino
|
MimeType=text/x-arduino
|
190
build/linux/dist/install.sh
vendored
Normal file → Executable file
190
build/linux/dist/install.sh
vendored
Normal file → Executable file
@ -1,17 +1,187 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
CURDIR=`pwd`
|
# This script adds a menu item, icons and mime type for Arduino for the current
|
||||||
APPDIR="$(dirname -- "$(readlink -f -- "${0}")" )"
|
# user. If possible, it will use the xdg-utils - or fall back to just creating
|
||||||
|
# and copying a desktop file to the user's dir.
|
||||||
|
# If called with the "-u" option, it will undo the changes.
|
||||||
|
|
||||||
cd "$APPDIR"
|
# Resource name to use (including vendor prefix)
|
||||||
|
RESOURCE_NAME=arduino-arduinoide
|
||||||
|
|
||||||
# Set arduino.desktop absolute path workaround
|
# Get absolute path from which this script file was executed
|
||||||
mv arduino.desktop arduino.desktop-bak
|
# Use "pwd -P" to resolve symlinks to their target
|
||||||
sed -e "s,FULL_PATH,$PWD,g" arduino.desktop-bak > arduino.desktop
|
SCRIPT_PATH=$( cd $(dirname $0) ; pwd )
|
||||||
rm arduino.desktop-bak
|
cd "$SCRIPT_PATH"
|
||||||
|
|
||||||
cp arduino.desktop ~/.local/share/applications/arduino.desktop
|
# Install using xdg-utils
|
||||||
cp arduino.desktop ~/Desktop/arduino.desktop
|
xdg_install_f() {
|
||||||
|
|
||||||
echo "Installed Arduino IDE icons on menu and desktop !"
|
# Create a temp dir accessible by all users
|
||||||
|
TMP_DIR=`mktemp --directory`
|
||||||
|
|
||||||
|
# Create *.desktop file using the existing template file
|
||||||
|
sed -e "s,<BINARY_LOCATION>,${SCRIPT_PATH}/arduino,g" \
|
||||||
|
-e "s,<ICON_NAME>,${RESOURCE_NAME},g" "${SCRIPT_PATH}/lib/desktop.template" > "${TMP_DIR}/${RESOURCE_NAME}.desktop"
|
||||||
|
|
||||||
|
# Install the icon files using name and resolutions
|
||||||
|
xdg-icon-resource install --context apps --size 16 "${SCRIPT_PATH}/lib/icons/16x16/apps/arduino.png" $RESOURCE_NAME
|
||||||
|
xdg-icon-resource install --context apps --size 24 "${SCRIPT_PATH}/lib/icons/24x24/apps/arduino.png" $RESOURCE_NAME
|
||||||
|
xdg-icon-resource install --context apps --size 32 "${SCRIPT_PATH}/lib/icons/32x32/apps/arduino.png" $RESOURCE_NAME
|
||||||
|
xdg-icon-resource install --context apps --size 48 "${SCRIPT_PATH}/lib/icons/48x48/apps/arduino.png" $RESOURCE_NAME
|
||||||
|
xdg-icon-resource install --context apps --size 64 "${SCRIPT_PATH}/lib/icons/64x64/apps/arduino.png" $RESOURCE_NAME
|
||||||
|
xdg-icon-resource install --context apps --size 72 "${SCRIPT_PATH}/lib/icons/72x72/apps/arduino.png" $RESOURCE_NAME
|
||||||
|
xdg-icon-resource install --context apps --size 96 "${SCRIPT_PATH}/lib/icons/96x96/apps/arduino.png" $RESOURCE_NAME
|
||||||
|
xdg-icon-resource install --context apps --size 128 "${SCRIPT_PATH}/lib/icons/128x128/apps/arduino.png" $RESOURCE_NAME
|
||||||
|
xdg-icon-resource install --context apps --size 256 "${SCRIPT_PATH}/lib/icons/256x256/apps/arduino.png" $RESOURCE_NAME
|
||||||
|
|
||||||
|
# Install the created *.desktop file
|
||||||
|
xdg-desktop-menu install "${TMP_DIR}/${RESOURCE_NAME}.desktop"
|
||||||
|
|
||||||
|
# Create icon on the desktop
|
||||||
|
xdg-desktop-icon install "${TMP_DIR}/${RESOURCE_NAME}.desktop"
|
||||||
|
|
||||||
|
# Install Arduino mime type
|
||||||
|
xdg-mime install "${SCRIPT_PATH}/lib/${RESOURCE_NAME}.xml"
|
||||||
|
|
||||||
|
# Install icons for mime type
|
||||||
|
xdg-icon-resource install --context mimetypes --size 16 "${SCRIPT_PATH}/lib/icons/16x16/apps/arduino.png" text-x-arduino
|
||||||
|
xdg-icon-resource install --context mimetypes --size 24 "${SCRIPT_PATH}/lib/icons/24x24/apps/arduino.png" text-x-arduino
|
||||||
|
xdg-icon-resource install --context mimetypes --size 32 "${SCRIPT_PATH}/lib/icons/32x32/apps/arduino.png" text-x-arduino
|
||||||
|
xdg-icon-resource install --context mimetypes --size 48 "${SCRIPT_PATH}/lib/icons/48x48/apps/arduino.png" text-x-arduino
|
||||||
|
xdg-icon-resource install --context mimetypes --size 64 "${SCRIPT_PATH}/lib/icons/64x64/apps/arduino.png" text-x-arduino
|
||||||
|
xdg-icon-resource install --context mimetypes --size 72 "${SCRIPT_PATH}/lib/icons/72x72/apps/arduino.png" text-x-arduino
|
||||||
|
xdg-icon-resource install --context mimetypes --size 96 "${SCRIPT_PATH}/lib/icons/96x96/apps/arduino.png" text-x-arduino
|
||||||
|
xdg-icon-resource install --context mimetypes --size 128 "${SCRIPT_PATH}/lib/icons/128x128/apps/arduino.png" text-x-arduino
|
||||||
|
xdg-icon-resource install --context mimetypes --size 256 "${SCRIPT_PATH}/lib/icons/256x256/apps/arduino.png" text-x-arduino
|
||||||
|
|
||||||
|
# Make Arduino IDE the default application for *.ino
|
||||||
|
xdg-mime default ${RESOURCE_NAME}.desktop text/x-arduino
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm "${TMP_DIR}/${RESOURCE_NAME}.desktop"
|
||||||
|
rmdir "$TMP_DIR"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install by simply copying desktop file (fallback)
|
||||||
|
simple_install_f() {
|
||||||
|
|
||||||
|
# Create a temp dir accessible by all users
|
||||||
|
TMP_DIR=`mktemp --directory`
|
||||||
|
|
||||||
|
# Create *.desktop file using the existing template file
|
||||||
|
sed -e "s,<BINARY_LOCATION>,${SCRIPT_PATH}/arduino,g" \
|
||||||
|
-e "s,<ICON_NAME>,${SCRIPT_PATH}/lib/arduino.png,g" "${SCRIPT_PATH}/lib/desktop.template" > "${TMP_DIR}/${RESOURCE_NAME}.desktop"
|
||||||
|
|
||||||
|
mkdir -p ~/.local/share/applications
|
||||||
|
cp "${TMP_DIR}/${RESOURCE_NAME}.desktop" ~/.local/share/applications/
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm "${TMP_DIR}/${RESOURCE_NAME}.desktop"
|
||||||
|
rmdir "$TMP_DIR"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Uninstall using xdg-utils
|
||||||
|
xdg_uninstall_f() {
|
||||||
|
|
||||||
|
# Remove *.desktop file
|
||||||
|
xdg-desktop-menu uninstall ${RESOURCE_NAME}.desktop
|
||||||
|
|
||||||
|
# Remove icon from desktop
|
||||||
|
xdg-desktop-icon uninstall ${RESOURCE_NAME}.desktop
|
||||||
|
|
||||||
|
# Remove icons
|
||||||
|
xdg-icon-resource uninstall --size 16 $RESOURCE_NAME
|
||||||
|
xdg-icon-resource uninstall --size 24 $RESOURCE_NAME
|
||||||
|
xdg-icon-resource uninstall --size 32 $RESOURCE_NAME
|
||||||
|
xdg-icon-resource uninstall --size 48 $RESOURCE_NAME
|
||||||
|
xdg-icon-resource uninstall --size 64 $RESOURCE_NAME
|
||||||
|
xdg-icon-resource uninstall --size 72 $RESOURCE_NAME
|
||||||
|
xdg-icon-resource uninstall --size 96 $RESOURCE_NAME
|
||||||
|
xdg-icon-resource uninstall --size 128 $RESOURCE_NAME
|
||||||
|
xdg-icon-resource uninstall --size 256 $RESOURCE_NAME
|
||||||
|
|
||||||
|
# Remove MIME type icons
|
||||||
|
xdg-icon-resource uninstall --size 16 text-x-arduino
|
||||||
|
xdg-icon-resource uninstall --size 24 text-x-arduino
|
||||||
|
xdg-icon-resource uninstall --size 32 text-x-arduino
|
||||||
|
xdg-icon-resource uninstall --size 48 text-x-arduino
|
||||||
|
xdg-icon-resource uninstall --size 64 text-x-arduino
|
||||||
|
xdg-icon-resource uninstall --size 72 text-x-arduino
|
||||||
|
xdg-icon-resource uninstall --size 96 text-x-arduino
|
||||||
|
xdg-icon-resource uninstall --size 128 text-x-arduino
|
||||||
|
xdg-icon-resource uninstall --size 256 text-x-arduino
|
||||||
|
|
||||||
|
# Remove Arduino MIME type
|
||||||
|
xdg-mime uninstall "${SCRIPT_PATH}/lib/${RESOURCE_NAME}.xml"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Uninstall by simply removing desktop files (fallback), incl. old one
|
||||||
|
simple_uninstall_f() {
|
||||||
|
|
||||||
|
if [ -f ~/.local/share/applications/arduino.desktop ]; then
|
||||||
|
rm ~/.local/share/applications/arduino.desktop
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f ~/.local/share/applications/${RESOURCE_NAME}.desktop ]; then
|
||||||
|
rm ~/.local/share/applications/${RESOURCE_NAME}.desktop
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Update desktop file and mime databases (if possible)
|
||||||
|
updatedbs_f() {
|
||||||
|
|
||||||
|
if [ -d ~/.local/share/applications ]; then
|
||||||
|
if command -v update-desktop-database > /dev/null; then
|
||||||
|
update-desktop-database ~/.local/share/applications
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d ~/.local/share/mime ]; then
|
||||||
|
if command -v update-mime-database > /dev/null; then
|
||||||
|
update-mime-database ~/.local/share/mime
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check availability of xdg-utils
|
||||||
|
xdg_exists_f() {
|
||||||
|
|
||||||
|
if ! command -v xdg-icon-resource > /dev/null; then return 1; fi
|
||||||
|
if ! command -v xdg-desktop-menu > /dev/null; then return 1; fi
|
||||||
|
if ! command -v xdg-desktop-icon > /dev/null; then return 1; fi
|
||||||
|
if ! command -v xdg-mime > /dev/null; then return 1; fi
|
||||||
|
return 0
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# If possible, use xdg-utils, if not, use a more basic approach
|
||||||
|
if xdg_exists_f; then
|
||||||
|
if [ "$1" = "-u" ]; then
|
||||||
|
echo "Removing menu item, icons and file association for Arduino IDE..."
|
||||||
|
xdg_uninstall_f
|
||||||
|
simple_uninstall_f
|
||||||
|
else
|
||||||
|
echo "Adding menu item, icons and file association for Arduino IDE..."
|
||||||
|
xdg_uninstall_f
|
||||||
|
simple_uninstall_f
|
||||||
|
xdg_install_f
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$1" = "-u" ]; then
|
||||||
|
echo "Removing menu item for Arduino IDE..."
|
||||||
|
simple_uninstall_f
|
||||||
|
else
|
||||||
|
echo "Adding menu item for Arduino IDE..."
|
||||||
|
simple_uninstall_f
|
||||||
|
simple_install_f
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
updatedbs_f
|
||||||
|
echo "...done!"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
6
build/linux/dist/uninstall.sh
vendored
Executable file
6
build/linux/dist/uninstall.sh
vendored
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SCRIPT_PATH=$( cd $(dirname $0) ; pwd )
|
||||||
|
cd "$SCRIPT_PATH"
|
||||||
|
|
||||||
|
./install.sh -u
|
BIN
build/shared/icons/64x64/apps/arduino.png
Normal file
BIN
build/shared/icons/64x64/apps/arduino.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
build/shared/icons/72x72/apps/arduino.png
Normal file
BIN
build/shared/icons/72x72/apps/arduino.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
build/shared/icons/96x96/apps/arduino.png
Normal file
BIN
build/shared/icons/96x96/apps/arduino.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.9 KiB |
Loading…
x
Reference in New Issue
Block a user