Method code for $sys.configure_core()

[Turn off line numbering]
  1: var list, l, x, t, err, s;
  2: 
  3: if (caller() != $admin)
  4:     (> .perms(sender()) <);
  5: s = sender();
  6: 
  7: // if there is nothing left to config, leave..
  8: if (configured) {
  9:     if (!(list = config_set.set_difference(configured.keys())))
 10:         return;
 11: } else {
 12:     configured = #[];
 13: }
 14: .add_to_system(s);
 15: 
 16: // wait for other things to finish printing messages to them
 17: pause();
 18: pause();
 19: 
 20: // expand on this as we go
 21: s.tell(["*" * 78, strfmt("%78{*}c", " Welcome to ColdCore "), "*" * 78]);
 22: s.tell("This is an interactive configuration system which any admin who connects (until it is completed) is sent through.  You must complete this configuration before you can do anything else.  You can skip a specific question at any time by typing '@skip'.  Suggested default values will be enclosed in square brackets.  Pressing enter without any value will use the default value.".wrap_lines(78).mmap('center, 78));
 23: s.tell("*" * 78);
 24: 
 25: // first question please
 26: if (!configured.contains('new_user_class)) {
 27:     s.tell("What class should new users be created as?  Available classes:");
 28:     list = filter x in ($user.descendants()) where ('general_cache in x.flags() && x != $guest);
 29:     t = .get_new_user_class();
 30:     list = map x in (list) to (list == t ? x + " (current class)" : x);
 31:     s.tell(list.prefix("    "));
 32:     while (!l) {
 33:         refresh();
 34:         l = (> s.prompt("New User Class [" + t + "] ") <);
 35:         if (l == "@skip") {
 36:             s.tell("Skipping..");
 37:             break;
 38:         }
 39:         if (l) {
 40:             catch any {
 41:                 l = $object_lib.to_dbref(l);
 42:                 if (!(l in list))
 43:                     s.tell("Invalid selection, try again.");
 44:             } with {
 45:                 s.tell("Invalid selection '" + l + "'");
 46:                 continue;
 47:             }
 48:         } else {
 49:             l = t;
 50:         }
 51:         .set_setting("new-user-class", $sys, l);
 52:         configured = configured.add('new_user_class, 1);
 53:         s.tell("New User Class set to: " + l);
 54:     }
 55:     s.tell(["", "You can set this at any time, with the command:"]);
 56:     s.tell("  @set $sys:new-user-class=" + l);
 57: }
 58: refresh();
 59: 
 60: // server name/title
 61: if (!configured.contains('server_name)) {
 62:     s.tell(["", "---"]);
 63:     t = $motd.server_name();
 64:     l = (> s.prompt("What is your server name? [" + t + "] ") <) || t;
 65:     if (l == "@skip") {
 66:         s.tell("Skipping..");
 67:     } else {
 68:         $motd.set_setting("server-name", $motd, l);
 69:         configured = configured.add('server_name, 1);
 70:         s.tell("Server name set to: " + l);
 71:     }
 72:     s.tell(["", "You can set this at any time, with the command:"]);
 73:     s.tell("  @set $motd:server-name=" + l);
 74: }
 75: refresh();
 76: if (!configured.contains('server_title)) {
 77:     s.tell(["", "---"]);
 78:     t = $motd.server_title();
 79:     l = (> s.prompt("What is your server title? [" + t + "] ") <) || t;
 80:     if (l == "@skip") {
 81:         s.tell("Skipping..");
 82:     } else {
 83:         $motd.set_setting("server-title", $motd, l);
 84:         configured = configured.add('server_title, 1);
 85:         s.tell("Server title set to: " + l);
 86:     }
 87:     s.tell(["", "You can set this at any time, with the command:"]);
 88:     s.tell("  @set $motd:server-title=" + l);
 89: }
 90: refresh();
 91: if (!configured.contains('daemons)) {
 92:     s.tell(["", "---"]);
 93:     while (1) {
 94:         refresh();
 95:         list = $daemon.children().setremove($login_daemon);
 96:         s.tell("Which network daemons do you want to have automatically startup,");
 97:         s.tell("Other than $login_daemon.  Available daemons:");
 98:         t = filter l in (startup['objects]) where (l.is($daemon));
 99:         for l in (list) {
100:             if (l in t)
101:                 s.tell(strfmt("  %20s (auto starting)", l));
102:             else
103:                 s.tell("  " + l);
104:         }
105:         l = (> s.prompt("Auto-Start: [" + t.join(", ") + "] ") <);
106:         if (l == "@skip") {
107:             s.tell("Skipping..");
108:             break;
109:         } else if (!l) {
110:             s.tell("Using existing daemons: " + t.join(", "));
111:             configured = configured.add('daemons, 1);
112:             break;
113:         } else {
114:             err = 0;
115:             for x in (l.explode_english_list()) {
116:                 catch any {
117:                     .set_setting("startup-objects", $sys, "+" + x);
118:                     s.tell("Added " + x + " as a startup daemon.");
119:                 } with {
120:                     s.tell("Unable to add '" + x + "' as a daemon:");
121:                     s.tell("=> " + traceback()[1][2]);
122:                     err++;
123:                 }
124:             }
125:             if (!err) {
126:                 configured = configured.add('daemons, 1);
127:                 break;
128:             }
129:             s.tell("Errors occurred...");
130:         }
131:     }
132:     s.tell(["", "You can set this at any time, with the command:"]);
133:     s.tell("  @set $sys:startup-objects=OBJECTS...");
134: }
135: 
136: // Other things to add: HTTP Virtual Hosting info,
137: // Let them know, if they actually saw anything..
138: s.tell(["", strfmt("%79{*}c", " Configuration Complete ")]);
139: 
140: // $#Edited: 04 Feb 98 14:50 $brandon
141: // $#Edited: 06 Mar 98 13:34 $brandon
142: // $#Edited: 24 Sep 98 16:53 $user_nolan
143: // $#Edited: 16 Dec 98 04:48 $brandon
144: // $#Edited: 27 Aug 01 11:07 $user_lynx

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark