char suggested_url[SIZ];
/*
- * Set an entry in inittab to the desired state
+ * Delete an entry from /etc/inittab
*/
void delete_init_entry(char *which_entry)
{
fclose(fp);
chmod("/etc/init.d/webcit", 0755);
+
+ /* Set up the run levels. */
+ system("/bin/rm -f /etc/rc?.d/[SK]??webcit 2>/dev/null");
+ system("for x in 2 3 4 5 ; do [ -d /etc/rc$x.d ] && ln -s /etc/init.d/webcit /etc/rc$x.d/S84webcit ; done 2>/dev/null");
+ system("for x in 0 6 S; do [ -d /etc/rc$x.d ] && ln -s /etc/init.d/webcit /etc/rc$x.d/K15webcit ; done 2>/dev/null");
+
}
*/
if (!access("/var/run", W_OK)) {
install_init_scripts();
- }
- /* FIXME
- for (a=0; a<=3; ++a) {
- progress("Starting the WebCit service...", a, 3);
- if (a == 0) start_the_service();
- sleep(1);
- }
- */
+ if (!access("/etc/init.d/webcit", X_OK)) {
+ for (a=0; a<=2; ++a) {
+ progress("Restarting the WebCit service...", a, 3);
+ if (a == 0) system("/etc/init.d/webcit stop >/dev/null 2>&1");
+ if (a == 1) system("/etc/init.d/webcit start >/dev/null 2>&1");
+ sleep(1);
+ }
+ }
- sprintf(aaa,
- "Setup is finished. You may now log in.\n"
- "Point your web browser at %s\n", suggested_url
- );
- important_message("Setup finished", aaa);
+ sprintf(aaa,
+ "Setup is finished. You may now log in.\n"
+ "Point your web browser at %s\n", suggested_url
+ );
+ important_message("Setup finished", aaa);
+ }
- /* else {
+ else {
important_message("Setup finished",
"Setup is finished. You may now start the server.");
- } */
+ }
cleanup(0);
return 0;