handled. Instaling -applications or -specialpurpose, or any other package that drops into hot-deploy is not yet supported; namely, the extra seed/demo data won't get installed, and the daemon won't be restarted. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@718535 13f79535-47bb-0310-9956-ffa450edef68
134 lines
3.4 KiB
Bash
134 lines
3.4 KiB
Bash
#!/bin/sh
|
|
#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.
|
|
|
|
set -e
|
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
db_title OFBiz
|
|
db_version 2.0
|
|
db_capb backup
|
|
#DEBHELPER#
|
|
|
|
if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
|
|
dbc_dbuser="ofbiz"
|
|
dbc_dbname="ofbiz"
|
|
dbc_dbtype="pgsql"
|
|
dbc_dbtypes="pgsql, mysql, derby, hsql"
|
|
#dbc_authmethod_admin="ident"
|
|
dbc_authmethod_user="password"
|
|
. /usr/share/dbconfig-common/dpkg/config
|
|
dbc_go ofbiz $@
|
|
fi
|
|
if [ -r "/etc/ofbiz/debconf.cfg" ]; then
|
|
. "/etc/ofbiz/debconf.cfg"
|
|
fi
|
|
set_if() {
|
|
if [ "$2" ]; then
|
|
db_set "$1" "$2"
|
|
return 0
|
|
fi
|
|
return 1;
|
|
}
|
|
ofbiz_readers="seed"
|
|
ofbiz_admin_port="10523"
|
|
#env LANG=C LC_ALL=C sed -n -e 's/[^[:alnum:]]//g;p;q' < /dev/urandom | cut -b1-12
|
|
if set_if ofbiz/admin-password-encrypted "$ofbiz_admin_password_encrypted"; then
|
|
db_fset ofbiz/admin-password-encrypted seen true
|
|
fi
|
|
#db_set ofbiz/admin-password ofbiz || true
|
|
set_if ofbiz/readers "$ofbiz_readers" || true
|
|
set_if ofbiz/admin-port "$ofbiz_admin_port" || true
|
|
|
|
cmd="$1"
|
|
shift
|
|
|
|
case "$cmd" in
|
|
(configure)
|
|
import_question=ofbiz/readers
|
|
;;
|
|
(reconfigure)
|
|
import_question=ofbiz/reimport-data
|
|
;;
|
|
(*)
|
|
echo "Invalid command($cmd)" 1>&2
|
|
exit 9
|
|
;;
|
|
esac
|
|
seen_admin_password_prompt="false"
|
|
db_fget ofbiz/admin-password seen && seen_admin_password_prompt="$RET"
|
|
case "$cmd" in
|
|
(configure|reconfigure)
|
|
STATE=0
|
|
while :; do
|
|
NEXT=$(($STATE + 1))
|
|
case "$STATE" in
|
|
(-1) exit 10
|
|
;;
|
|
(0) db_input medium ofbiz/admin-password || true
|
|
;;
|
|
(1) password=""
|
|
db_get ofbiz/admin-password && password="$RET"
|
|
if [ "z" = "z$password" ]; then
|
|
if [ "$seen_admin_password_prompt" = "false" ]; then
|
|
db_set ofbiz/admin-password "ofbiz"
|
|
db_set ofbiz/password-confirmation "ofbiz"
|
|
password="ofbiz"
|
|
else
|
|
db_input high ofbiz/empty-password-not-allowed || true
|
|
NEXT=0
|
|
fi
|
|
else
|
|
seen_admin_password_prompt="true"
|
|
fi
|
|
;;
|
|
(2) if [ "$seen_admin_password_prompt" = "true" ]; then
|
|
db_input high ofbiz/password-confirmation || true
|
|
fi
|
|
;;
|
|
(3) confirm=""
|
|
db_get ofbiz/password-confirmation && confirm="$RET"
|
|
if [ "$password" != "$confirm" ]; then
|
|
db_input high ofbiz/mismatched-passwords || true
|
|
NEXT=0
|
|
db_set ofbiz/admin-password ''
|
|
db_fset ofbiz/admin-password seen false
|
|
fi
|
|
;;
|
|
(4) db_input low $import_question || true
|
|
;;
|
|
(5) db_get $import_question && do_import="$RET"
|
|
if [ "$do_import" = "true" ]; then
|
|
db_input medium ofbiz/readers || true
|
|
fi
|
|
;;
|
|
(6) db_input low ofbiz/admin-port || true
|
|
;;
|
|
(*) break
|
|
;;
|
|
esac
|
|
if db_go; then
|
|
STATE=$NEXT
|
|
else
|
|
STATE=$(($STATE - 1))
|
|
fi
|
|
done
|
|
;;
|
|
esac
|
|
db_stop
|