bluez-tools: Add package bluezetools
[feed/packages.git] / net / seafile-server / patches / 033-seahub-do-not-create-admin.patch
1 --- a/scripts/check_init_admin.py
2 +++ b/scripts/check_init_admin.py
3 @@ -310,7 +310,7 @@ def create_admin(email, passwd):
4 def ask_admin_email():
5 print()
6 print('----------------------------------------')
7 - print('It\'s the first time you start the seafile server. Now let\'s create the admin account')
8 + print('Let\'s create the admin account')
9 print('----------------------------------------')
10 def validate(email):
11 # whitespace is not allowed
12 @@ -350,8 +350,15 @@ def ask_admin_password():
13
14 rpc = RPC()
15
16 -def main():
17 +def main(argv):
18 + if len(argv) > 1 and argv[1] == 'has-admin':
19 + sys.exit(1 if need_create_admin() else 0)
20 +
21 if not need_create_admin():
22 + print('')
23 + print('A seafile admin account already exists.')
24 + print('Log into seahub to add additional accounts.')
25 + print('If you cannot log in, run reset-seafile-admin to add a new admin account.')
26 return
27
28 password_file = os.path.join(os.environ['SEAFILE_CENTRAL_CONF_DIR'], 'admin.txt')
29 @@ -369,7 +376,7 @@ def main():
30
31 if __name__ == '__main__':
32 try:
33 - main()
34 + main(sys.argv)
35 except KeyboardInterrupt:
36 print('\n\n\n')
37 print(Utils.highlight('Aborted.'))
38 @@ -379,3 +386,4 @@ if __name__ == '__main__':
39 print()
40 print(Utils.highlight('Error happened during creating seafile admin.'))
41 print()
42 + sys.exit(1)
43 --- a/scripts/seahub.sh
44 +++ b/scripts/seahub.sh
45 @@ -250,7 +250,10 @@ function stop_seahub () {
46
47 function check_init_admin() {
48 check_init_admin_script=${INSTALLPATH}/check_init_admin.py
49 - if ! $PYTHON $check_init_admin_script; then
50 + if ! $PYTHON $check_init_admin_script has-admin; then
51 + echo "Error: there is no seafile admin account."
52 + echo "Have you run create-seafile-admin before this?"
53 + echo ""
54 exit 1
55 fi
56 }