-
Notifications
You must be signed in to change notification settings - Fork 251
/
Copy pathlinux_installer.sh
executable file
·74 lines (52 loc) · 1.66 KB
/
linux_installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
NC="\033[0m"
BLUE="\033[1;34m"
RED="\033[1;31m"
GREEN="\033[1;32m"
APP_DIR=~/.local/share/applications
APP=${APP_DIR}/icestudio.desktop
MIME_DIR=~/.local/share/mime
MIME_PKG=${MIME_DIR}/packages
MIME=${MIME_PKG}/icestudio.xml
ICON_DIR=~/.local/share/icons
ICON=${ICON_DIR}/application-x-icestudio-project.png
echo "${BLUE}This script installs Icestudio as a user application"
echo "----------------------------------------------------"
printf "Enter the Icestudio path:${NC} "
read SOURCE
if [ ! -f "${SOURCE}/icestudio" ]; then
echo "${RED}\nError: invalid Icestudio path${NC}"
exit 1
fi
cd ${SOURCE}
PWD=`pwd`
# Desktop Entry
mkdir -p ${APP_DIR}
echo "[Desktop Entry]
Name=Icestudio
Comment=Visual editor for open FPGA boards
Comment[es]=Editor visual para placas FPGA libres
Type=Application
Categories=Development;Education;Graphics;
StartupNotify=true
MimeType=application/x-icestudio-project;
" > ${APP}
echo "Exec=${PWD}/icestudio %f" >> ${APP}
echo "Icon=${ICON}" >> ${APP}
mkdir -p ${ICON_DIR}
cp "${PWD}/resources/images/icestudio-logo.png" ${ICON}
update-desktop-database ${APP_DIR}
echo "${GREEN}\nIcestudio.desktop installed!${NC}"
# Register extension .ice
mkdir -p ${MIME_PKG}
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">
<mime-type type=\"application/x-icestudio-project\">
<sub-class-of type=\"application/json\"/>
<comment>Icestudio project</comment>
<glob pattern=\"*.ice\"/>
<icon name=\"application-x-icestudio-project\"/>
</mime-type>
</mime-info>" > ${MIME}
update-mime-database ${MIME_DIR}
echo "${GREEN}Icestudio project registered!${NC}"