Author: doogie
Date: Tue Mar 3 22:51:50 2009
New Revision: 749814
URL: http://svn.apache.org/viewvc?rev=749814&view=rev
Log:
Rewrote the main loop, so it pulls each step from an array. This
will allow for adding new entries without having to renumber
everything.
Modified:
ofbiz/trunk/debian/ofbiz-framework.config
Modified: ofbiz/trunk/debian/ofbiz-framework.config
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz-framework.config?rev=749814&r1=749813&r2=749814&view=diff
==============================================================================
--- ofbiz/trunk/debian/ofbiz-framework.config (original)
+++ ofbiz/trunk/debian/ofbiz-framework.config Tue Mar 3 22:51:50 2009
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/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
@@ -72,56 +72,72 @@
esac
seen_admin_password_prompt="false"
db_fget ofbiz/admin-password seen && seen_admin_password_prompt="$RET"
+
+ofb_dc_admin_password() {
+ db_input medium ofbiz/admin-password || true
+}
+ofb_dc_admin_password_check() {
+ 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
+}
+ofb_dc_admin_password_confirm() {
+ if [ "$seen_admin_password_prompt" = "true" ]; then
+ db_input high ofbiz/password-confirmation || true
+ fi
+}
+ofb_dc_admin_password_compare() {
+ 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
+}
+ofb_dc_import_question() {
+ db_input low $import_question || true
+}
+ofb_dc_readers() {
+ db_get $import_question && do_import="$RET"
+ if [ "$do_import" = "true" ]; then
+ db_input medium ofbiz/readers || true
+ fi
+}
+ofb_dc_admin_port() {
+ db_input low ofbiz/admin-port || true
+}
+declare -a ofb_dc_list
+ofb_dc_list=(
+ ofb_dc_admin_password
+ ofb_dc_admin_password_check
+ ofb_dc_admin_password_confirm
+ ofb_dc_admin_password_compare
+ ofb_dc_import_question
+ ofb_dc_readers
+ ofb_dc_admin_port
+)
+
case "$cmd" in
(configure|reconfigure)
STATE=0
while :; do
+ [[ $STATE = -1 ]] && exit 10
+ [[ $STATE = ${#ofb_dc_list[*]} ]] && break
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
+ ${ofb_dc_list[$STATE]}
if db_go; then
STATE=$NEXT
else