mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 01:32:18 +02:00
packaging: add pre-check.sh (#11135)
This commit is contained in:
parent
9184170b01
commit
ba42d25162
@ -28,6 +28,7 @@ After=libvirtd.service
|
||||
[Service]
|
||||
Type=simple
|
||||
EnvironmentFile=/etc/default/cloudstack-agent
|
||||
ExecStartPre=/usr/share/cloudstack-common/scripts/installer/pre-check.sh
|
||||
ExecStart=/usr/bin/java $JAVA_OPTS $JAVA_DEBUG -cp $CLASSPATH $JAVA_CLASS
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
|
||||
@ -34,6 +34,7 @@ User=cloud
|
||||
EnvironmentFile=/etc/default/cloudstack-management
|
||||
WorkingDirectory=/var/log/cloudstack/management
|
||||
PIDFile=/var/run/cloudstack-management.pid
|
||||
ExecStartPre=/usr/share/cloudstack-common/scripts/installer/pre-check.sh
|
||||
ExecStart=/usr/bin/java $JAVA_DEBUG $JAVA_OPTS -cp $CLASSPATH $BOOTSTRAP_CLASS
|
||||
StandardOutput=append:/var/log/cloudstack/management/management-server.out
|
||||
StandardError=append:/var/log/cloudstack/management/management-server.err
|
||||
|
||||
@ -32,6 +32,7 @@ After=network.target network-online.target mariadb.service mysqld.service mysql.
|
||||
Type=simple
|
||||
EnvironmentFile=/etc/default/cloudstack-usage
|
||||
Environment=JAVA_PID=$$
|
||||
ExecStartPre=/usr/share/cloudstack-common/scripts/installer/pre-check.sh
|
||||
ExecStart=/bin/sh -ec '/usr/bin/java -Dpid=${JAVA_PID} $JAVA_OPTS $JAVA_DEBUG -cp $CLASSPATH $JAVA_CLASS'
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
|
||||
38
scripts/installer/pre-check.sh
Executable file
38
scripts/installer/pre-check.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
if [ ! -f "/usr/bin/java" ];then
|
||||
echo "ERROR: /usr/bin/java does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAVA_MAJOR_VERSION=$(/usr/bin/java --version | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -n 1 |cut -d "." -f1)
|
||||
|
||||
if [ -z $JAVA_MAJOR_VERSION ];then
|
||||
echo "WARNING: Cannot determine the JAVA version"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$JAVA_MAJOR_VERSION" != "17" ] && [ "$JAVA_MAJOR_VERSION" != "11" ];then
|
||||
echo "ERROR: JAVA $JAVA_MAJOR_VERSION is not supported. Currently only JAVA 17 and JAVA 11 are supported."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$JAVA_MAJOR_VERSION" != "17" ];then
|
||||
echo "WARNING: JAVA version is $JAVA_MAJOR_VERSION. JAVA 17 is recommended."
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user