Skip to content

Commit bcd8a8a

Browse files
committed
add install.sh uninstall.sh desktop.template processing-processing.xml appdata.xml
1 parent 446485a commit bcd8a8a

5 files changed

Lines changed: 350 additions & 0 deletions

File tree

build/linux/appdata.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- See https://www.freedesktop.org/software/appstream/docs/chap-Quickstart.html -->
3+
<component type="desktop-application">
4+
<id>org.processing.processingide.desktop</id>
5+
<metadata_license>GPLv3</metadata_license>
6+
<developer_name>Processing Foundation</developer_name>
7+
8+
<name>Processing IDE</name>
9+
<summary>Open-source software prototyping platform</summary>
10+
11+
<description>
12+
<p>
13+
Processing is the first easy-to-use software sketching platform
14+
created by C. Reas and B. Fry and supported by the Processing
15+
Foundation.
16+
</p>
17+
<p>
18+
Included is an integrated development environment that can be used
19+
to develop interactive applications using different programming
20+
languages but mainly Java, Android, Python, and Javascript.
21+
</p>
22+
</description>
23+
24+
<screenshots>
25+
<screenshot type="default">
26+
<image>https://upload.wikimedia.org/wikipedia/commons/6/6b/Processing_screen_shot.png</image>
27+
<caption>The Processing IDE showing a simple example program</caption>
28+
</screenshot>
29+
</screenshots>
30+
31+
<url type="homepage">http://www.processing.org/</url>
32+
<url type="help">https://processing.org/reference/</url>
33+
<url type="bugtracker">https://github.com/processing/processing/issues?q=is%3Aopen</url>
34+
<url type="translate">https://github.com/processing/processing/tree/master/build/shared/lib/languages</url>
35+
<url type="donation">https://processing.org/download/support.html</url>
36+
37+
<update_contact>foundation@processing.org</update_contact>
38+
</component>

build/linux/desktop.template

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=Processing IDE
4+
GenericName=Processing IDE
5+
Comment=Open-source software prototyping platform
6+
Exec=<BINARY_LOCATION>
7+
Icon=<ICON_NAME>
8+
Terminal=false
9+
Categories=Development;IDE;Programming;
10+
MimeType=text/x-processing;
11+
Keywords=sketching;software;animation;programming;coding;
12+
StartupWMClass=processing-app-Base

build/linux/install.sh

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
#!/bin/sh
2+
3+
# This script adds a menu item, icons and mime type for Arduino for the current
4+
# user. If possible, it will use the xdg-utils - or fall back to just creating
5+
# and copying a desktop file to the user's dir.
6+
# If called with the "-u" option, it will undo the changes.
7+
8+
# Resource name to use (including vendor prefix)
9+
RESOURCE_NAME=processing-processingide
10+
11+
# Get absolute path from which this script file was executed
12+
# (Could be changed to "pwd -P" to resolve symlinks to their target)
13+
SCRIPT_PATH=$( cd $(dirname $0) ; pwd )
14+
cd "${SCRIPT_PATH}"
15+
16+
# Default mode is to install.
17+
UNINSTALL=false
18+
19+
# If possible, get location of the desktop folder. Default to ~/Desktop
20+
XDG_DESKTOP_DIR="${HOME}/Desktop"
21+
if [ -f "${XDG_CONFIG_HOME:-${HOME}/.config}/user-dirs.dirs" ]; then
22+
. "${XDG_CONFIG_HOME:-${HOME}/.config}/user-dirs.dirs"
23+
fi
24+
25+
# Install using xdg-utils
26+
xdg_install_f() {
27+
28+
# Create a temp dir accessible by all users
29+
TMP_DIR=`mktemp --directory`
30+
31+
# Create *.desktop file using the existing template file
32+
sed -e "s,<BINARY_LOCATION>,${SCRIPT_PATH}/processing,g" \
33+
-e "s,<ICON_NAME>,${RESOURCE_NAME},g" "${SCRIPT_PATH}/lib/desktop.template" > "${TMP_DIR}/${RESOURCE_NAME}.desktop"
34+
35+
# Install the icon files using name and resolutions
36+
xdg-icon-resource install --context mimetypes --size 16 "${SCRIPT_PATH}/lib/icons/pde-16.png" $RESOURCE_NAME
37+
xdg-icon-resource install --context mimetypes --size 32 "${SCRIPT_PATH}/lib/icons/pde-32.png" $RESOURCE_NAME
38+
xdg-icon-resource install --context mimetypes --size 48 "${SCRIPT_PATH}/lib/icons/pde-48.png" $RESOURCE_NAME
39+
xdg-icon-resource install --context mimetypes --size 64 "${SCRIPT_PATH}/lib/icons/pde-64.png" $RESOURCE_NAME
40+
xdg-icon-resource install --context mimetypes --size 128 "${SCRIPT_PATH}/lib/icons/pde-128.png" $RESOURCE_NAME
41+
xdg-icon-resource install --context mimetypes --size 256 "${SCRIPT_PATH}/lib/icons/pde-256.png" $RESOURCE_NAME
42+
xdg-icon-resource install --context mimetypes --size 512 "${SCRIPT_PATH}/lib/icons/pde-512.png" $RESOURCE_NAME
43+
xdg-icon-resource install --context mimetypes --size 1024 "${SCRIPT_PATH}/lib/icons/pde-1024.png" $RESOURCE_NAME
44+
45+
# Install the created *.desktop file
46+
xdg-desktop-menu install "${TMP_DIR}/${RESOURCE_NAME}.desktop"
47+
48+
# Create icon on the desktop
49+
xdg-desktop-icon install "${TMP_DIR}/${RESOURCE_NAME}.desktop"
50+
51+
# Install Processing mime type
52+
xdg-mime install "${SCRIPT_PATH}/lib/${RESOURCE_NAME}.xml"
53+
54+
# Install icons for mime type
55+
xdg-icon-resource install --context mimetypes --size 16 "${SCRIPT_PATH}/lib/icons/pde-16.png" text-x-processing
56+
xdg-icon-resource install --context mimetypes --size 32 "${SCRIPT_PATH}/lib/icons/pde-32.png" text-x-processing
57+
xdg-icon-resource install --context mimetypes --size 48 "${SCRIPT_PATH}/lib/icons/pde-48.png" text-x-processing
58+
xdg-icon-resource install --context mimetypes --size 64 "${SCRIPT_PATH}/lib/icons/pde-64.png" text-x-processing
59+
xdg-icon-resource install --context mimetypes --size 128 "${SCRIPT_PATH}/lib/icons/pde-128.png" text-x-processing
60+
xdg-icon-resource install --context mimetypes --size 256 "${SCRIPT_PATH}/lib/icons/pde-256.png" text-x-processing
61+
xdg-icon-resource install --context mimetypes --size 512 "${SCRIPT_PATH}/lib/icons/pde-512.png" text-x-processing
62+
xdg-icon-resource install --context mimetypes --size 1024 "${SCRIPT_PATH}/lib/icons/pde-1024.png" text-x-processing
63+
64+
# Make Processing IDE the default application for *.pde
65+
xdg-mime default ${RESOURCE_NAME}.desktop text/x-processing
66+
67+
# Clean up
68+
rm "${TMP_DIR}/${RESOURCE_NAME}.desktop"
69+
rmdir "$TMP_DIR"
70+
71+
}
72+
73+
# Install by simply copying desktop file (fallback)
74+
simple_install_f() {
75+
76+
# Create a temp dir accessible by all users
77+
TMP_DIR=`mktemp --directory`
78+
79+
# Create *.desktop file using the existing template file
80+
sed -e "s,<BINARY_LOCATION>,${SCRIPT_PATH}/processing,g" \
81+
-e "s,<ICON_NAME>,${SCRIPT_PATH}/lib/icons/pde-128.png,g" "${SCRIPT_PATH}/lib/desktop.template" > "${TMP_DIR}/${RESOURCE_NAME}.desktop"
82+
83+
mkdir -p "${HOME}/.local/share/applications"
84+
cp "${TMP_DIR}/${RESOURCE_NAME}.desktop" "${HOME}/.local/share/applications/"
85+
86+
mkdir -p "${HOME}/.local/share/metainfo"
87+
cp "${SCRIPT_PATH}/lib/appdata.xml" "${HOME}/.local/share/metainfo/${RESOURCE_NAME}.appdata.xml"
88+
89+
# Copy desktop icon if desktop dir exists (was found)
90+
if [ -d "${XDG_DESKTOP_DIR}" ]; then
91+
cp "${TMP_DIR}/${RESOURCE_NAME}.desktop" "${XDG_DESKTOP_DIR}/"
92+
# Altering file permissions to avoid "Untrusted Application Launcher" error on Ubuntu
93+
chmod u+x "${XDG_DESKTOP_DIR}/${RESOURCE_NAME}.desktop"
94+
fi
95+
96+
# Clean up temp dir
97+
rm "${TMP_DIR}/${RESOURCE_NAME}.desktop"
98+
rmdir "${TMP_DIR}"
99+
100+
}
101+
102+
# Uninstall using xdg-utils
103+
xdg_uninstall_f() {
104+
105+
# Remove *.desktop file
106+
xdg-desktop-menu uninstall ${RESOURCE_NAME}.desktop
107+
108+
# Remove icon from desktop
109+
xdg-desktop-icon uninstall ${RESOURCE_NAME}.desktop
110+
111+
# Remove icons
112+
xdg-icon-resource uninstall --size 16 $RESOURCE_NAME
113+
xdg-icon-resource uninstall --size 32 $RESOURCE_NAME
114+
xdg-icon-resource uninstall --size 48 $RESOURCE_NAME
115+
xdg-icon-resource uninstall --size 64 $RESOURCE_NAME
116+
xdg-icon-resource uninstall --size 128 $RESOURCE_NAME
117+
xdg-icon-resource uninstall --size 256 $RESOURCE_NAME
118+
xdg-icon-resource uninstall --size 512 $RESOURCE_NAME
119+
xdg-icon-resource uninstall --size 1024 $RESOURCE_NAME
120+
121+
# Remove MIME type icons
122+
xdg-icon-resource uninstall --size 16 text-x-processing
123+
xdg-icon-resource uninstall --size 32 text-x-processing
124+
xdg-icon-resource uninstall --size 48 text-x-processing
125+
xdg-icon-resource uninstall --size 64 text-x-processing
126+
xdg-icon-resource uninstall --size 128 text-x-processing
127+
xdg-icon-resource uninstall --size 256 text-x-processing
128+
xdg-icon-resource uninstall --size 512 text-x-processing
129+
xdg-icon-resource uninstall --size 1024 text-x-processing
130+
131+
# Remove Arduino MIME type
132+
xdg-mime uninstall "${SCRIPT_PATH}/lib/${RESOURCE_NAME}.xml"
133+
134+
}
135+
136+
# Uninstall by simply removing desktop files (fallback), incl. old one
137+
simple_uninstall_f() {
138+
139+
# delete legacy cruft .desktop file
140+
if [ -f "${HOME}/.local/share/applications/processing.desktop" ]; then
141+
rm "${HOME}/.local/share/applications/processing.desktop"
142+
fi
143+
144+
# delete another legacy .desktop file
145+
if [ -f "${HOME}/.local/share/applications/processing-processingide.desktop" ]; then
146+
rm "${HOME}/.local/share/applications/processing-processingide.desktop"
147+
fi
148+
149+
if [ -f "${HOME}/.local/share/applications/${RESOURCE_NAME}.desktop" ]; then
150+
rm "${HOME}/.local/share/applications/${RESOURCE_NAME}.desktop"
151+
fi
152+
153+
if [ -f "${HOME}/.local/share/metainfo/${RESOURCE_NAME}.appdata.xml" ]; then
154+
rm "${HOME}/.local/share/metainfo/${RESOURCE_NAME}.appdata.xml"
155+
fi
156+
157+
if [ -f "${XDG_DESKTOP_DIR}/processing.desktop" ]; then
158+
rm "${XDG_DESKTOP_DIR}/processing.desktop"
159+
fi
160+
161+
if [ -f "${XDG_DESKTOP_DIR}/${RESOURCE_NAME}.desktop" ]; then
162+
rm "${XDG_DESKTOP_DIR}/${RESOURCE_NAME}.desktop"
163+
fi
164+
165+
}
166+
167+
# Update desktop file and mime databases (if possible)
168+
updatedbs_f() {
169+
170+
if [ -d "${HOME}/.local/share/applications" ]; then
171+
if command -v update-desktop-database > /dev/null; then
172+
update-desktop-database "${HOME}/.local/share/applications"
173+
fi
174+
fi
175+
176+
if [ -d "${HOME}/.local/share/mime" ]; then
177+
if command -v update-mime-database > /dev/null; then
178+
update-mime-database "${HOME}/.local/share/mime"
179+
fi
180+
fi
181+
182+
}
183+
184+
# Check availability of xdg-utils
185+
xdg_exists_f() {
186+
187+
if ! command -v xdg-icon-resource > /dev/null; then return 1; fi
188+
if ! command -v xdg-desktop-menu > /dev/null; then return 1; fi
189+
if ! command -v xdg-desktop-icon > /dev/null; then return 1; fi
190+
if ! command -v xdg-mime > /dev/null; then return 1; fi
191+
return 0
192+
193+
}
194+
195+
# Shows a description of the available options
196+
display_help_f() {
197+
printf "\nThis script will add a Processing IDE desktop shortcut, menu item,\n"
198+
printf "icons and file associations for the current user.\n"
199+
if ! xdg_exists_f; then
200+
printf "\nxdg-utils are recommended to be installed, so this script can use them.\n"
201+
fi
202+
printf "\nOptional arguments are:\n\n"
203+
printf "\t-u, --uninstall\t\tRemoves shortcut, menu item and icons.\n\n"
204+
printf "\t-h, --help\t\tShows this help again.\n\n"
205+
}
206+
207+
# Check for provided arguments
208+
while [ $# -gt 0 ] ; do
209+
ARG="${1}"
210+
case $ARG in
211+
-u|--uninstall)
212+
UNINSTALL=true
213+
shift
214+
;;
215+
-h|--help)
216+
display_help_f
217+
exit 0
218+
;;
219+
*)
220+
printf "\nInvalid option -- '${ARG}'\n"
221+
display_help_f
222+
exit 1
223+
;;
224+
esac
225+
done
226+
227+
# If possible, use xdg-utils, if not, use a more basic approach
228+
if xdg_exists_f; then
229+
if [ ${UNINSTALL} = true ]; then
230+
printf "Removing desktop shortcut and menu item for Processing IDE..."
231+
xdg_uninstall_f
232+
simple_uninstall_f
233+
else
234+
printf "Adding desktop shortcut, menu item and file associations for Processing IDE..."
235+
xdg_uninstall_f
236+
simple_uninstall_f
237+
xdg_install_f
238+
fi
239+
else
240+
if [ ${UNINSTALL} = true ]; then
241+
printf "Removing desktop shortcut and menu item for Processing IDE..."
242+
simple_uninstall_f
243+
else
244+
printf "Adding desktop shortcut and menu item for Processing IDE..."
245+
simple_uninstall_f
246+
simple_install_f
247+
fi
248+
fi
249+
updatedbs_f
250+
printf " done!\n"
251+
252+
exit 0
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
3+
<mime-type type="text/x-processing">
4+
<comment>Processing source code</comment>
5+
<comment xml:lang="ara">شفرة مصدر Processing</comment>
6+
<comment xml:lang="be@latin">Kryničny kod Processing</comment>
7+
<comment xml:lang="bg">Изходен код на Processing</comment>
8+
<comment xml:lang="ca">codi font en Processing</comment>
9+
<comment xml:lang="da">Processingkildekode</comment>
10+
<comment xml:lang="de">Processing-Quelltext</comment>
11+
<comment xml:lang="el">πηγαίος κώδικας Processing</comment>
12+
<comment xml:lang="en_GB">Processing source code</comment>
13+
<comment xml:lang="eo">Processing-fontkodo</comment>
14+
<comment xml:lang="es">código fuente en Processing</comment>
15+
<comment xml:lang="eu">Processing iturburu-kodea</comment>
16+
<comment xml:lang="fi">Processing-lähdekoodi</comment>
17+
<comment xml:lang="fr">code source Processing</comment>
18+
<comment xml:lang="ga">cód foinseach Processing</comment>
19+
<comment xml:lang="hu">Processing-forráskód</comment>
20+
<comment xml:lang="id">Kode program Processing</comment>
21+
<comment xml:lang="it">Codice sorgente Processing</comment>
22+
<comment xml:lang="ja">Processing ソースコード</comment>
23+
<comment xml:lang="lt">Processing pradinis kodas</comment>
24+
<comment xml:lang="lv">Processing pirmkods</comment>
25+
<comment xml:lang="ms">Kod sumber Processing</comment>
26+
<comment xml:lang="nb">Processing-kildekode</comment>
27+
<comment xml:lang="nl">Processing-broncode</comment>
28+
<comment xml:lang="nn">Processing-kjeldekode</comment>
29+
<comment xml:lang="pl">Kod źródłowy Processing</comment>
30+
<comment xml:lang="pt">código fonte Processing</comment>
31+
<comment xml:lang="pt_BR">Código fonte Processing</comment>
32+
<comment xml:lang="ru">исходный код Processing</comment>
33+
<comment xml:lang="sq">Kod burues Processing</comment>
34+
<comment xml:lang="sv">Processing-källkod</comment>
35+
<comment xml:lang="uk">Вихідний код на мові Processing</comment>
36+
<comment xml:lang="vi">Mã nguồn Processing</comment>
37+
<comment xml:lang="zh_CN">Processing 源代码</comment>
38+
<comment xml:lang="zh_TW">Processing 源代碼</comment>
39+
<sub-class-of type="text/x-csrc"/>
40+
<glob pattern="*.pde"/>
41+
</mime-type>
42+
</mime-info>

build/linux/uninstall.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
SCRIPT_PATH=$( cd $(dirname $0) ; pwd )
4+
cd "$SCRIPT_PATH"
5+
6+
./install.sh -u

0 commit comments

Comments
 (0)