Skip to content

Commit 2d2e8b6

Browse files
committed
update jinstall.sh
1 parent 6e5e006 commit 2d2e8b6

5 files changed

Lines changed: 46 additions & 104 deletions

File tree

.github/workflows/jinstall.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
# script installers ------------------------------------------------------
3737
script:
38-
name: install scripts
38+
name: install script
3939
runs-on: ubuntu-latest
4040
steps:
4141
- name: Checkout Git repository
@@ -48,7 +48,7 @@ jobs:
4848
uses: ncipollo/release-action@v1
4949
with:
5050
tag: build
51-
artifacts: "unix.tar.gz"
51+
artifacts: "jinstall.sh"
5252
token: ${{ secrets.GITHUB_TOKEN }}
5353
allowUpdates: true
5454
replacesArtifacts: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ test.sh
44
makezips.sh
55
version.txt
66
revision.txt
7+
t1.sh

build.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
118
1+
119

script/jinstall.sh

Lines changed: 38 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
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

83
set -eu
94

@@ -20,73 +15,54 @@ fi
2015
# Show usage
2116
usage() {
2217
cat <<EOF
23-
Usage: $(basename "$0") [OPTIONS] [Dir] [Jqt] [Addons]
18+
Usage: $(basename "$0") [OPTIONS]
2419
2520
Options:
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
4429
EOF
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
7155
done
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
8763
case "$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 ;;
9167
esac
9268

@@ -98,12 +74,6 @@ case "$P" in
9874
*) printf "Invalid Jqt selection: $P\n"; exit 1 ;;
9975
esac
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
10979
UID1=`id -u`
@@ -136,32 +106,6 @@ if [ ! "$D" = "/usr" ]; then
136106
fi
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-
165109
M=$(mktemp -d -t 'jtemp.XXXXXX')
166110
trap 'rm -rf "$M"' EXIT
167111
cd $M
@@ -210,6 +154,5 @@ else
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'"
214158
fi
215-

script/makejinstall.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1+
#!/bin/bash
2+
#
3+
# just copies the script into the current directory
14

2-
P=`pwd`
5+
cp script/jinstall.sh .
36

4-
cd script
5-
chmod +x jinstall.sh
6-
tar -czf ../unix.tar.gz jinstall.sh
7-
8-
cd ..
97
ls -alrt

0 commit comments

Comments
 (0)