This commit is contained in:
+11
-1
@@ -64,6 +64,14 @@ detect_platform() {
|
||||
fi
|
||||
}
|
||||
|
||||
validate_service_manager() {
|
||||
[[ "$PLATFORM" != "linux" || "$NO_SERVICE" == "1" ]] && return 0
|
||||
command -v systemctl >/dev/null 2>&1 \
|
||||
|| fail 'systemd is required for a production Linux install; use --no-service only for development'
|
||||
[[ -d /run/systemd/system ]] \
|
||||
|| fail 'systemd is not running on this Linux host; use --no-service only for development'
|
||||
}
|
||||
|
||||
java_major() {
|
||||
local java_bin="${1:-java}"
|
||||
"$java_bin" -version 2>&1 | awk -F'[".]' '/version/ {print $2; exit}'
|
||||
@@ -294,10 +302,11 @@ shell_setting() {
|
||||
prepare_layout() {
|
||||
if [[ "$PLATFORM" == "linux" ]]; then
|
||||
ERP_USER="${ERP_SERVICE_USER:-kaidi-erp}"
|
||||
ERP_GROUP="$ERP_USER"
|
||||
[[ "$ERP_USER" =~ ^[a-z_][a-z0-9_-]*[$]?$ ]] || fail 'invalid Linux service user name'
|
||||
id "$ERP_USER" >/dev/null 2>&1 \
|
||||
|| useradd --system --home-dir "$INSTALL_ROOT" --shell /usr/sbin/nologin "$ERP_USER"
|
||||
ERP_GROUP="$(id -gn "$ERP_USER" 2>/dev/null)" \
|
||||
|| fail "unable to resolve the primary group for Linux service user: $ERP_USER"
|
||||
CONFIG_ROOT="${ERP_CONFIG_ROOT:-/etc/kaidi-erp}"
|
||||
STATE_ROOT="${ERP_STATE_ROOT:-/var/lib/kaidi-erp}"
|
||||
LOG_ROOT="${ERP_LOG_ROOT:-/var/log/kaidi-erp}"
|
||||
@@ -506,6 +515,7 @@ detect_lan_address() {
|
||||
|
||||
main() {
|
||||
detect_platform
|
||||
validate_service_manager
|
||||
if [[ -z "$INSTALL_ROOT" ]]; then
|
||||
if [[ "$PLATFORM" == "linux" ]]; then
|
||||
INSTALL_ROOT=/opt/kaidi-erp
|
||||
|
||||
Reference in New Issue
Block a user