Skip to content

Commit bd76d1e

Browse files
committed
touch build
1 parent 6224cba commit bd76d1e

3 files changed

Lines changed: 57 additions & 18 deletions

File tree

build.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
102
1+
103

misc/install-usr.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ else
2020
exit 1
2121
fi
2222

23+
P=`pwd`
2324
cd ..
2425
[ "j9.7" = ${PWD##*/} ] || [ "jlibrary" = ${PWD##*/} ] || { echo "directory not j9.7" ; exit 1; }
25-
cd -
26+
cd "$P"
2627

2728
[ "Darwin" = "$(uname)" ] || [ "$(id -u)" = "0" ] || { echo "need sudo" ; exit 1; }
2829

script/jinstall.sh

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ V=j9.7
1111

1212
OS=$(uname -s)
1313
if [ "$OS" != "Darwin" ] && [ "$OS" != "Linux" ]; then
14-
echo "This script only works for Linux or macOS, not for $OS"
14+
printf "This script only works for Linux or macOS, not for $OS\n"
1515
exit 1
1616
fi
1717

@@ -29,6 +29,7 @@ Give other parameters in order, use "" or empty for the default
2929
3030
[Dir] - installation top level directory, default $HOME.
3131
The installation is to a $V subdirectory of this.
32+
In Linux, a directory of /usr makes a standard system install
3233
[Jqt] - Jqt installed, one of none|slim|full (default full)
3334
[Addons] - Addons installed, one of none|all (default none)
3435
@@ -37,6 +38,7 @@ $(basename "$0") # install full Jqt system under home with no ad
3738
$(basename "$0") "" slim # install slim Jqt system under home with no addons
3839
$(basename "$0") -f mydir none # install base system only in mydir, no prompts
3940
$(basename "$0") mydir none all # install base system in mydir plus all addons
41+
$(basename "$0") /usr none all # system base system install on Linux
4042
EOF
4143
exit 0
4244
}
@@ -50,7 +52,7 @@ while [ $# -gt 0 ]; do
5052
-h|--help) usage ;;
5153
-f|--force) FORCE=1; shift ;;
5254
--) shift; break ;;
53-
-*) echo "Unknown option: $1" >&2; usage ;;
55+
-*) printf "Unknown option: $1" >&2; usage ;;
5456
*) break ;; # first non-option argument → stop parsing
5557
esac
5658
done
@@ -64,7 +66,7 @@ A=${3:-"none"}
6466
# check likely incorrect directory
6567
case "$D" in
6668
none|slim|full|all)
67-
echo "The installation directory may not be one of the keywords: none|slim|full|all";
69+
printf "The installation directory may not be one of the keywords: none|slim|full|all\n";
6870
exit 1 ;;
6971
esac
7072

@@ -73,19 +75,45 @@ if [ "$D" = "home" ]; then D=$HOME; fi
7375
# check Jqt selection
7476
case "$P" in
7577
none|slim|full) ;;
76-
*) echo "Invalid Jqt selection: $P"; exit 1 ;;
78+
*) printf "Invalid Jqt selection: $P\n"; exit 1 ;;
7779
esac
7880

7981
# check Addons selection
8082
case "$A" in
8183
none|all) ;;
82-
*) echo "Invalid Addons selection: $A"; exit 1 ;;
84+
*) printf "Invalid Addons selection: $A\n"; exit 1 ;;
8385
esac
8486

87+
# ----------------------------------------------------------------------
88+
# check user/path/OS combo
89+
UID=`id -u`
90+
if [ "$D" = "/usr" ]; then
91+
if [ "$OS" = "Darwin" ]; then
92+
printf "This script does not support install to /usr in macOS\n"
93+
exit 1
94+
fi
95+
if [ ! $UID = 0 ]; then
96+
printf "Run this script as root to install under /usr\n"
97+
exit 1
98+
fi
99+
else
100+
if [ $UID = 0 ]; then
101+
printf "You are running this script as root. OK to continue? (y/N) "
102+
read response
103+
case "${response:-N}" in
104+
[Yy]*) ;;
105+
*) exit 1 ;;
106+
esac
107+
fi
108+
fi
109+
110+
# ----------------------------------------------------------------------
85111
# resolve directory path
86-
mkdir -p $D
87-
cd $D
88-
D=`pwd`
112+
if [ ! "$D" = "/usr" ]; then
113+
mkdir -p $D
114+
cd $D
115+
D=`pwd`
116+
fi
89117

90118
# ----------------------------------------------------------------------
91119
# install message + prompt to continue
@@ -103,35 +131,45 @@ else
103131
m="$m and no Addons"
104132
fi
105133

106-
echo "$m in $D"
134+
printf "$m in $D\n"
107135

108136
if [ "$FORCE" = 0 ]; then
109137
printf 'OK to continue? (y/N) '
110138
read response
111139
case "${response:-N}" in # defaults to N on Enter
112140
[Yy]*) ;; # do nothing
113-
*) echo "Not done."; exit 1 ;;
141+
*) printf "Not done.\n"; exit 1 ;;
114142
esac
115143
fi
116144

117145
M=$(mktemp -d -t 'jtemp.XXXXXX')
146+
trap 'rm -rf "$M"' EXIT
118147
cd $M
119148

120149
S="https://www.jsoftware.com/download/$V/install"
121150

122151
if [ "$OS" = "Darwin" ]; then
123152
W=${V}_mac64.zip
124-
curl -O $S/$W
153+
curl -OL $S/$W
125154
unzip $W
126155
else
127156
W=${V}_linux64.tar.gz
128157
wget $S/$W
129158
tar -xf $W
130159
fi
131160

132-
mkdir -p $D/$V
133-
cp -r $M/$V/* $D/$V
134-
cd $D/$V
135-
rm -rf $M
161+
# ----------------------------------------------------------------------
162+
if [ "$D" = "/usr" ]; then
163+
cd $V
164+
bin/jconsole -js "install 'system $P $A'"
165+
if [ -f "/etc/alternatives/ijconsole" ]; then
166+
update-alternatives --remove-all ijconsole
167+
fi
168+
bin/install-usr.sh
169+
else
170+
mkdir -p $D/$V
171+
cp -r $M/$V/* $D/$V
172+
cd $D/$V
173+
bin/jconsole -js "install 'system $P $A'"
174+
fi
136175

137-
bin/jconsole -js "install 'system $P $A'"

0 commit comments

Comments
 (0)