#!/bin/sh # Copyright (C) Martin Ošmera # 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