Annotation of /trunk/installer/ncurses-gui/usermanagement.sh
Parent Directory | Revision Log
Revision 1013 -
(hide annotations)
(download)
(as text)
Sun May 30 17:33:29 2010 UTC (14 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 4595 byte(s)
Sun May 30 17:33:29 2010 UTC (14 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 4595 byte(s)
-added ncurses-gui
1 | niro | 1013 | # $Id$ |
2 | |||
3 | root_password_dialog() | ||
4 | { | ||
5 | #ROOT_PASSWORD=$(passwordbox "root" "Enter a password for root:" 10 50) | ||
6 | #ROOT_PASSWORD_RETYPE=$(passwordbox "root" "Re-enter the password:" 10 50) | ||
7 | ROOT_USER_SETUP=($(dialog \ | ||
8 | --stdout \ | ||
9 | --colors \ | ||
10 | --title "root" \ | ||
11 | --backtitle "${TITLE}" \ | ||
12 | --insecure \ | ||
13 | --mixedform "Enter a password for root:" 10 60 0 \ | ||
14 | " Username:" 1 1 "root" 1 18 36 0 2 \ | ||
15 | " Password:" 2 1 "${ROOT_PASSWORD}" 2 18 36 0 1 \ | ||
16 | "Retype Password:" 3 1 "${ROOT_PASSWORD_RETYPE}" 3 18 36 0 1)) | ||
17 | |||
18 | debug "ARRAY_LEN='${#ROOT_USER_SETUP[*]}'" | ||
19 | debug "ROOT_USER_SETUP='${ROOT_USER_SETUP[*]}'" | ||
20 | } | ||
21 | |||
22 | add_user_dialog() | ||
23 | { | ||
24 | #USER_NAME=$(inputbox "Create a user" "Please enter a username for daily use:" 10 50) | ||
25 | #if [[ ! -z ${USER_NAME} ]] | ||
26 | #then | ||
27 | # USER_PASSWORD=$(passwordbox "${USER_NAME}" "Enter a password for '${USER_NAME}':" 10 50) | ||
28 | # USER_PASSWORD_RETYPE=$(passwordbox "${USER_NAME}" "Enter a password for '${USER_NAME}':" 10 50) | ||
29 | #fi | ||
30 | |||
31 | USER_SETUP=($(dialog \ | ||
32 | --stdout \ | ||
33 | --colors \ | ||
34 | --title "User-Setup" \ | ||
35 | --backtitle "${TITLE}" \ | ||
36 | --insecure \ | ||
37 | --mixedform "Please enter a username and password for daily use:" 10 60 0 \ | ||
38 | " Username:" 1 1 "${USER_NAME}" 1 18 36 0 0 \ | ||
39 | " Password:" 2 1 "${USER_PASSWORD}" 2 18 36 0 1 \ | ||
40 | "Retype Password:" 3 1 "${USER_PASSWORD_RETYPE}" 3 18 36 0 1)) | ||
41 | |||
42 | debug "ARRAY_LEN='${#USER_SETUP[*]}'" | ||
43 | debug "USER_SETUP='${USER_SETUP[*]}'" | ||
44 | } | ||
45 | |||
46 | check_password() | ||
47 | { | ||
48 | local pass1="$1" | ||
49 | local pass2="$2" | ||
50 | |||
51 | if [[ -z ${pass1} ]] | ||
52 | then | ||
53 | messagebox "Warning" "Empty password given!" 10 40 | ||
54 | return 1 | ||
55 | fi | ||
56 | |||
57 | if [[ ${pass1} = ${pass2} ]] | ||
58 | then | ||
59 | return 0 | ||
60 | else | ||
61 | messagebox "Warning" "Passwords did not match!" 10 40 | ||
62 | return 1 | ||
63 | fi | ||
64 | } | ||
65 | |||
66 | rundialog_root_password_dialog() | ||
67 | { | ||
68 | # root_password_dialog | ||
69 | # case $? in | ||
70 | # -1) die "Error!" ;; | ||
71 | # 255) die "aborted by user" ;; | ||
72 | # | ||
73 | # 1) | ||
74 | # root_password_dialog | ||
75 | # ;; | ||
76 | # | ||
77 | # 0) | ||
78 | # export ROOT_PASSWORD | ||
79 | # if ! check_password "${ROOT_PASSWORD}" "${ROOT_PASSWORD_RETYPE}" | ||
80 | # then | ||
81 | # rundialog_root_password_dialog | ||
82 | # fi | ||
83 | # ;; | ||
84 | # esac | ||
85 | |||
86 | root_password_dialog | ||
87 | case $? in | ||
88 | -1) die "Error!" ;; | ||
89 | 255) die "aborted by user" ;; | ||
90 | |||
91 | 1) | ||
92 | root_password_dialog | ||
93 | ;; | ||
94 | |||
95 | 0) | ||
96 | #export ROOT_PASSWORD | ||
97 | #if ! check_password "${ROOT_PASSWORD}" "${ROOT_PASSWORD_RETYPE}" | ||
98 | #then | ||
99 | # rundialog_root_password_dialog | ||
100 | #fi | ||
101 | |||
102 | # root username is array item 0! | ||
103 | ROOT_PASSWORD="${ROOT_USER_SETUP[1]}" | ||
104 | ROOT_PASSWORD_RETYPE="${ROOT_USER_SETUP[2]}" | ||
105 | # check array len | ||
106 | if [ ${#ROOT_USER_SETUP[*]} -ne 3 ] | ||
107 | then | ||
108 | messagebox "Warning" "You must re-type the password!" 10 40 | ||
109 | rundialog_root_password_dialog | ||
110 | fi | ||
111 | if ! check_password "${ROOT_PASSWORD}" "${ROOT_PASSWORD_RETYPE}" | ||
112 | then | ||
113 | rundialog_root_password_dialog | ||
114 | fi | ||
115 | export ROOT_PASSWORD | ||
116 | ;; | ||
117 | esac | ||
118 | |||
119 | debug "ROOT_PASSWORD='${ROOT_PASSWORD}'" | ||
120 | } | ||
121 | |||
122 | rundialog_add_user_dialog() | ||
123 | { | ||
124 | # add_user_dialog | ||
125 | # case $? in | ||
126 | # -1) die "Error!" ;; | ||
127 | # 255) die "aborted by user" ;; | ||
128 | # | ||
129 | # 1) | ||
130 | # rundialog_root_password_dialog | ||
131 | # rundialog_add_user_dialog | ||
132 | # ;; | ||
133 | # | ||
134 | # 0) | ||
135 | # export USER_NAME | ||
136 | # export USER_PASSWORD | ||
137 | # if [[ -z ${USER_NAME} ]] | ||
138 | # then | ||
139 | # messagebox "Warning" "No username given!" 10 40 | ||
140 | # rundialog_add_user_dialog | ||
141 | # fi | ||
142 | # if ! check_password "${USER_PASSWORD}" "${USER_PASSWORD_RETYPE}" | ||
143 | # then | ||
144 | # rundialog_add_user_dialog | ||
145 | # fi | ||
146 | # ;; | ||
147 | # esac | ||
148 | |||
149 | add_user_dialog | ||
150 | case $? in | ||
151 | -1) die "Error!" ;; | ||
152 | 255) die "aborted by user" ;; | ||
153 | |||
154 | 1) | ||
155 | rundialog_root_password_dialog | ||
156 | rundialog_add_user_dialog | ||
157 | ;; | ||
158 | |||
159 | 0) | ||
160 | # export USER_NAME | ||
161 | # export USER_PASSWORD | ||
162 | # if [[ -z ${USER_NAME} ]] | ||
163 | # then | ||
164 | # messagebox "Warning" "No username given!" 10 40 | ||
165 | # rundialog_add_user_dialog | ||
166 | # fi | ||
167 | # if ! check_password "${USER_PASSWORD}" "${USER_PASSWORD_RETYPE}" | ||
168 | # then | ||
169 | # rundialog_add_user_dialog | ||
170 | # fi | ||
171 | |||
172 | USER_NAME="${USER_SETUP[0]}" | ||
173 | USER_PASSWORD="${USER_SETUP[1]}" | ||
174 | USER_PASSWORD_RETYPE="${USER_SETUP[2]}" | ||
175 | # check array len | ||
176 | if [ ${#USER_SETUP[*]} -ne 3 ] | ||
177 | then | ||
178 | if [[ -z ${USER_SETUP[0]} ]] | ||
179 | then | ||
180 | messagebox "Warning" "No username given!" 10 40 | ||
181 | else | ||
182 | messagebox "Warning" "You must re-type the password!" 10 40 | ||
183 | fi | ||
184 | rundialog_add_user_dialog | ||
185 | fi | ||
186 | if ! check_password "${USER_PASSWORD}" "${USER_PASSWORD_RETYPE}" | ||
187 | then | ||
188 | rundialog_add_user_dialog | ||
189 | fi | ||
190 | export USER_NAME | ||
191 | export USER_PASSWORD | ||
192 | ;; | ||
193 | esac | ||
194 | |||
195 | debug "USER_NAME='${USER_NAME}'" | ||
196 | debug "USER_PASSWORD='${USER_PASSWORD}'" | ||
197 | debug "USER_PASSWORD_RETYPE='${USER_PASSWORD_RETYPE}'" | ||
198 | } | ||
199 | |||
200 | main_usermanagement() | ||
201 | { | ||
202 | rundialog_root_password_dialog | ||
203 | rundialog_add_user_dialog | ||
204 | } |
Properties
Name | Value |
---|---|
svn:keywords | Id |