11#! /usr/bin/env sh
2- #
3- # parameters
4- # install directory
5- # Jqt: none/slim/full (default full)
6- # Addons: none/all (default all)
72
83set -eu
94
2015# Show usage
2116usage () {
2217 cat << EOF
23- Usage: $( basename " $0 " ) [OPTIONS] [Dir] [Jqt] [Addons]
18+ Usage: $( basename " $0 " ) [OPTIONS]
2419
2520Options:
26- -h, --help Show this help and exit
27- -d, --default install with default parameters (home/full/all)
28- -f, --force Force operation (no prompts)
29-
30- Give other parameters in order, use "" or empty for the default
31-
32- [Dir] - installation top level directory, default $HOME .
33- The installation is to a $V subdirectory of this.
34- In Linux, a directory of /usr makes a standard system install
35- [Jqt] - Jqt installed, one of none|slim|full (default full)
36- [Addons] - Addons installed, one of none|all (default all)
37-
38- Examples:
39- $( basename " $0 " ) --default # install full Jqt system under home with all addons
40- $( basename " $0 " ) "" slim none # install slim Jqt system under home with no addons
41- $( basename " $0 " ) -f mydir none none # install base system only in mydir, no prompts
42- $( basename " $0 " ) mydir none # install base system in mydir with all addons
43- $( basename " $0 " ) /usr none none # system install on Linux, with base system only
21+ -h --help Show this help and exit
22+ -p --path installation top level directory, default $HOME .
23+ The installation is to a $V subdirectory of this.
24+ In Linux, a directory of /usr makes a standard system install.
25+ Some paths may require root access.
26+ -q --qt type of Jqt installed, one of [full]|slim|none
27+ --no-addons do not install the full set of addons
28+ --no-shortcuts do not create desktop shortcuts
4429EOF
4530}
4631
47- # ----------------------------------------------------------------------
48- if [ $# -eq 0 ]; then
49- usage;
50- printf " \nPress enter to finish "
51- read wait
52- printf " \n"
53- exit 0
54- fi
55-
56- # ----------------------------------------------------------------------
57- FORCE=0;
58- DEFAULT=0;
59-
6032# ----------------------------------------------------------------------
6133# Parse options
62- while [ $# -gt 0 ]; do
63- case " $1 " in
64- -h|--help) usage; exit 0 ;;
65- -f|--force) FORCE=1; shift ;;
66- -d|--default) DEFAULT=1; break ;;
67- --) shift ; break ;;
68- -* ) printf " Unknown option: $1 " >&2 ; usage ;;
69- * ) break ;; # first non-option argument → stop parsing
70- esac
34+ D=$HOME
35+ P=full
36+ A=all
37+ S=true
38+
39+ OPTIONS=$( getopt -o hp:q: \
40+ -l help,path:,qt:,no-addons,no-shortcuts \
41+ -n " $( basename " $0 " ) " -- " $@ " )
42+
43+ eval set -- " $OPTIONS "
44+
45+ while true ; do
46+ case " $1 " in
47+ -h|--help) usage; exit 1;;
48+ -p|--path) D=" $2 " ; shift 2;;
49+ -q|--qt) P=" $2 " ; shift 2;;
50+ --no-addons) A=none; shift 1;;
51+ --no-shortcuts) S=false; shift 1;;
52+ --) break ;;
53+ * ) echo " Internal error! Unknown option: $1 " ; exit 1;;
54+ esac
7155done
7256
73- # ----------------------------------------------------------------------
74- # directory, Jqt, Addons parameters
75-
76- if [ $DEFAULT = " 1" ]; then
77- D=home
78- P=full
79- A=all
80- else
81- D=${1:- " home" }
82- P=${2:- " full" }
83- A=${3:- " all" }
84- fi
57+ # echo "path = $D"
58+ # echo "addons = $A"
59+ # echo "jqt = $P"
60+ # echo "shortcuts = $S"
8561
86- # check likely incorrect directory
62+ # check directory
8763case " $D " in
88- none|slim|full|all )
89- printf " The installation directory may not be one of the keywords: none|slim|full|all \n" ;
64+ none|slim|full)
65+ printf " The installation directory may not be one of the keywords: none|slim|full\n" ;
9066 exit 1 ;;
9167esac
9268
@@ -98,12 +74,6 @@ case "$P" in
9874 * ) printf " Invalid Jqt selection: $P \n" ; exit 1 ;;
9975esac
10076
101- # check Addons selection
102- case " $A " in
103- none|all) ;;
104- * ) printf " Invalid Addons selection: $A \n" ; exit 1 ;;
105- esac
106-
10777# ----------------------------------------------------------------------
10878# check user/path/OS combo
10979UID1=` id -u`
@@ -136,32 +106,6 @@ if [ ! "$D" = "/usr" ]; then
136106fi
137107
138108# ----------------------------------------------------------------------
139- # install message + prompt to continue
140- m=" Installing"
141-
142- case " $P " in
143- " slim" ) m=" $m slim Jqt system" ;;
144- " full" ) m=" $m full Jqt system" ;;
145- * ) m=" $m base system with no Jqt" ;;
146- esac
147-
148- if [ " $A " = " all" ]; then
149- m=" $m and all Addons"
150- else
151- m=" $m and no Addons"
152- fi
153-
154- printf " $m in $D /$V \n"
155-
156- if [ " $FORCE " = 0 ]; then
157- printf ' OK to continue? (y/N) '
158- read response
159- case " ${response:- N} " in # defaults to N on Enter
160- [Yy]* ) ;; # do nothing
161- * ) printf " Not done.\n" ; exit 1 ;;
162- esac
163- fi
164-
165109M=$( mktemp -d -t ' jtemp.XXXXXX' )
166110trap ' rm -rf "$M"' EXIT
167111cd $M
210154 mkdir -p $D /$V
211155 cp -r $M /$V /* $D /$V
212156 cd $D /$V
213- bin/jconsole -js " install 'system $P $A '"
157+ bin/jconsole -js " install 'system $P $A $S '"
214158fi
215-
0 commit comments