blob: 3eba0533d535e16de70836f714162e3c4a607fee (
plain)
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
|
#!/bin/sh
# Copyright (C) Martin Ošmera <martin.osmera@gmail.com>
# Licence: GPL v2
# Version: 1.1
# Homepage: http://sourceforge.net/projects/mcu8051ide
# Create launcher for MCU 8051 IDE
# Place the created file into directory /usr/bin and just run mcu8051ide
# Typical usage:
# ./make-launcher --path-to-lib=/usr/share/mcu8051ide/lib
print_help() {
echo "Create launcher for MCU 8051 IDE"
echo "Usage:"
echo "./make-launcher --path-to-lib=path_to_lib_directory"
exit
}
create_launcher() {
cat > mcu8051ide << EOF
#!/bin/sh
cd $value
exec tclsh8.5 main.tcl "\$@" || echo "Tcl 8.5 is not available on the system. Trying another version ..." && exec tclsh main.tcl || echo "FATAL ERROR: Tcl is not installed on the system! MCU 8051 IDE cannot run without it."
EOF
echo "Launcher successfuly created"
}
if [ -z "${1}" ]; then
print_help
fi
while [ -n "${1}" ]; do
key=`echo ${1} | sed -r -e 's/\=[^\=]+//'`
value=`echo $(echo ${1} | grep =) | sed -r -e 's/[^\=]+\=//;s/^"//;s/"$//'`
case "$key" in
--path-to-lib)
if [ -z $value ]; then
echo "Warning invalid value: $value"
echo "Using ~ as value"
value="~"
fi
create_launcher
chmod 0755 mcu8051ide
;;
-h | --help | --usage)
print_help
;;
*)
echo "Unrecognized option: ${1}"
;;
esac
shift
done
|