install.sh: add dependency check and postinst script for manual install
To install scylla-jmx using install.sh easily, we need: - run dependency check before install - run postinst script after install But we don't want to run them when we build .rpm/.deb package, we also need to add --packaging option to skip them. See scylladb/scylla#5830
This commit is contained in:
parent
3fb777a8f0
commit
354df10ea9
22
install.sh
22
install.sh
@ -31,6 +31,7 @@ Options:
|
|||||||
--prefix /prefix directory prefix (default /usr)
|
--prefix /prefix directory prefix (default /usr)
|
||||||
--nonroot shortcut of '--disttype nonroot'
|
--nonroot shortcut of '--disttype nonroot'
|
||||||
--sysconfdir /etc/sysconfig specify sysconfig directory name
|
--sysconfdir /etc/sysconfig specify sysconfig directory name
|
||||||
|
--packaging use install.sh for packaging
|
||||||
--help this helpful message
|
--help this helpful message
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
@ -39,6 +40,7 @@ EOF
|
|||||||
root=/
|
root=/
|
||||||
sysconfdir=/etc/sysconfig
|
sysconfdir=/etc/sysconfig
|
||||||
nonroot=false
|
nonroot=false
|
||||||
|
packaging=false
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -58,6 +60,10 @@ while [ $# -gt 0 ]; do
|
|||||||
sysconfdir="$2"
|
sysconfdir="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
"--packaging")
|
||||||
|
packaging=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
"--help")
|
"--help")
|
||||||
shift 1
|
shift 1
|
||||||
print_usage
|
print_usage
|
||||||
@ -68,6 +74,20 @@ while [ $# -gt 0 ]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if ! $packaging; then
|
||||||
|
has_java=false
|
||||||
|
if [ -x /usr/bin/java ]; then
|
||||||
|
javaver=$(/usr/bin/java -version 2>&1|head -n1|cut -f 3 -d " ")
|
||||||
|
if [[ "$javaver" =~ ^\"1.8.0 ]]; then
|
||||||
|
has_java=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if ! $has_java; then
|
||||||
|
echo "Please install openjdk-8 before running install.sh."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$prefix" ]; then
|
if [ -z "$prefix" ]; then
|
||||||
if $nonroot; then
|
if $nonroot; then
|
||||||
prefix=~/scylladb
|
prefix=~/scylladb
|
||||||
@ -137,4 +157,6 @@ if $nonroot; then
|
|||||||
sed -i -e "s#/opt/scylladb/jmx#$rprefix/jmx#g" "$rsysconfdir"/scylla-jmx
|
sed -i -e "s#/opt/scylladb/jmx#$rprefix/jmx#g" "$rsysconfdir"/scylla-jmx
|
||||||
systemctl --user daemon-reload
|
systemctl --user daemon-reload
|
||||||
echo "Scylla-JMX non-root install completed."
|
echo "Scylla-JMX non-root install completed."
|
||||||
|
elif ! $packaging; then
|
||||||
|
systemctl --system daemon-reload
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user