@@ -11,6 +11,7 @@ ARGV0=${ARGV0-$0}
1111bold=$( tput bold || true)
1212red=$( tput setaf 1 || true)
1313reset=$( tput sgr0 || true)
14+ bold_str=${bold} %s${reset}
1415
1516DIR=$( dirname " $( realpath " $0 " ) " )
1617readonly AI_LIB_PATH=" $DIR " /usr/lib
@@ -48,7 +49,29 @@ get_tool_from_progname() {(
4849 done
4950)}
5051
52+ # create convenience symlinks for the AppImage
53+ mk_symlinks () {(
54+ if [ " $APPIMAGE " = none ]; then
55+ abs_path=$( realpath " $0 " )
56+ dstdir=.
57+ else
58+ abs_path=$APPIMAGE
59+ dstdir=$( dirname " $APPIMAGE " )
60+ fi
61+ printf " Creating symlinks for ${bold_str} in $bold_str pointing to \
62+ ${bold_str} ...\n" " $( get_tools) " " $dstdir " " $abs_path "
63+ cd " $dstdir "
64+ # shellcheck disable=SC2046 # intentional
65+ set -- $( get_tools)
66+ while [ $# -gt 0 ]; do
67+ ln -s " $abs_path " " $1 " || true
68+ shift
69+ done
70+ )}
71+
72+ # # @param $1 non-empty to show full help
5173usage () {
74+ full=${1: +1}
5275 printf " usage:\n"
5376 printf " \t${bold}${red} %s${reset} ${bold} [--gui [args]]${reset} \n" " $ARGV0 "
5477 printf " \t\tinvokes GUI\n"
@@ -75,12 +98,19 @@ usage() {
7598 printf " \t\tinvokes specified tool\n"
7699 printf " \t\ttool may be one of: ${bold} %s${reset} \n" " $( get_tools) "
77100 printf " \n"
101+ if [ " $full " ]; then
102+ printf " \t${bold}${red} %s${reset} ${bold} --mk-symlinks${reset} \n" " $ARGV0 "
103+ printf " \t\tmake symlinks for the above tools to allow direct run\n"
104+ printf " \n"
105+ fi
78106 printf " \t${bold}${red} %s${reset} ${bold} args${reset} \n" " $ARGV0 "
79107 printf " \t\tinvokes command-line UltraGrid\n"
80108 printf " \n"
81- }
82109
83- usage_aux () {
110+ if [ ! " $full " ]; then
111+ return
112+ fi
113+
84114 printf " environment variables:\n"
85115 printf " \tAPPIMAGE_DEBUG: print debug info + used Firejail options\n"
86116 printf " \tULTRAGRID_AUTOUPDATE: autoupdate interval in days (0 - check always); -1 - disable update advice\n"
@@ -438,8 +468,7 @@ elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
438468elif [ " $1 " = " --ug-help" ]; then
439469 run uv -h
440470elif [ " $1 " = " --fullhelp" ]; then
441- usage
442- usage_aux
471+ usage full
443472 exit 0
444473elif { [ $# -eq 1 ] || [ $# -eq 2 ]; } && { [ " $1 " = " -m" ] || [ " $1 " = " --man" ]; }; then
445474 PAGE=${2:- uv}
@@ -451,6 +480,8 @@ elif [ "$1" = "-u" ] || [ "$1" = "--update" ]; then
451480 fi
452481 touch " $APPIMAGE " # update AppImage mtime to avoid update notices if there are no updates avalable but were checked for
453482 " $DIR /appimageupdatetool" ${1+" $@ " } " $APPIMAGE "
483+ elif [ " $1 " = " --mk-symlinks" ]; then
484+ mk_symlinks
454485else
455486 handle_autoupdates " $@ "
456487 run uv " $@ "
0 commit comments