PERFORCE change 18051 for review

Adam Migus amigus at freebsd.org
Tue Sep 24 07:09:07 GMT 2002


http://people.freebsd.org/~peter/p4db/chv.cgi?CH=18051

Change 18051 by amigus at amigus_ganymede on 2002/09/24 00:08:58

	Hook scripts into kde installer.  This (again) is quite ugly but
	(again) it works.  The scripts and the "mls_install_files" directory
	must be in the working directory of kmlsinstaller.

Affected files ...

.. //depot/projects/trustedbsd/misc/kmlsinstall/kmlsinstaller.cc#5 edit

Differences ...

==== //depot/projects/trustedbsd/misc/kmlsinstall/kmlsinstaller.cc#5 (text+ko) ====

@@ -47,10 +47,14 @@
 #include <qvbox.h>
 #include <qwidget.h>
 
+#include <stdlib.h>	/* for system() */
+
 #include "kmlsinstaller.moc"
 
 KMLSInstaller::KMLSInstaller() : KMainWindow()
 {
+	char sysbuf[4096], *p;
+	int error;
 
  	exit_ok = true;
 
@@ -194,53 +198,156 @@
 	progressdialog->setMinimumDuration(0);
 
 	progressdialog->setLabelText("TrustedBSD MLS Installation\n"
-	    "Searching system");
+	    "Installing kernel module");
 	progressdialog->setProgress(0);
-	sleep(1);
+	
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "mac_install_kernel_module.pl ");
+	p = strcat(p, "--module-file mls_install_files/mac_mls.ko ");
+	p = strcat(p, "--module-directory /boot/kernel");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
 
 	progressdialog->setLabelText("TrustedBSD MLS Installation\n"
-	    "Installing kernel module");
+	    "Installing user module");
 	progressdialog->setProgress(1);
-	sleep(1);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "mac_install_user_module.pl ");
+	p = strcat(p, "--library-directory /usr/lib ");
+	p = strcat(p, "mls_install_files/libmac_mls.a ");
+	p = strcat(p, "mls_install_files/libmac_mls_p.a ");
+	p = strcat(p, "mls_install_files/libmac_mls.so ");
+	p = strcat(p, "mls_install_files/libmac_mls.so.1");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
 
 	progressdialog->setLabelText("TrustedBSD MLS Installation\n"
-	    "Installing user module");
+	    "Updating loader.conf");
 	progressdialog->setProgress(2);
-	sleep(1);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "mac_update_loader_conf.pl ");
+	p = strcat(p, "--loader-config-file /boot/loader.conf ");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
 
 	progressdialog->setLabelText("TrustedBSD MLS Installation\n"
-	    "Updating loader.conf");
+	    "Updating mac.conf");
 	progressdialog->setProgress(3);
-	sleep(1);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "mac_update_mac_conf.pl ");
+	p = strcat(p, "--mac-config-file /etc/mac.conf ");
+	p = strcat(p, "--label-name mls ");
+	p = strcat(p, "--module-name mac_mls ");
+	p = strcat(p, "--module-library libmac_mls.so.1 ");
+	p = strcat(p, "file ifnet process");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
 
 	progressdialog->setLabelText("TrustedBSD MLS Installation\n"
-	    "Updating mac.conf");
+	    "Install boot program");
 	progressdialog->setProgress(4);
-	sleep(1);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "install -m 555 -o root -g wheel ");
+	p = strcat(p, "mac_boot.pl /usr/local/sbin");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "install -m 555 -o root -g wheel ");
+	p = strcat(p, "mac_default_label.pl /usr/local/sbin");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "touch /etc/.mac_installed");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
 
 	progressdialog->setLabelText("TrustedBSD MLS Installation\n"
-	    "Enable first-boot labeling event");
+	    "Enable boot program");
 	progressdialog->setProgress(5);
-	sleep(1);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "mac_enable_boot.pl ");
+	p = strcat(p, "--etc-directory /etc ");
+	p = strcat(p, "--rc-directory /etc/rc.d ");
+	p = strcat(p, "etc:mls_install_files/mac_default_labels ");
+	p = strcat(p, "etc:mls_install_files/mac_boot.conf ");
+	p = strcat(p, "rc:mls_install_files/mac_mls_init ");
+	p = strcat(p, "rc:mls_install_files/mac_mls_fix_x");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
 
 	progressdialog->setLabelText("TrustedBSD MLS Installation\n"
 	    "Updating login.conf");
 	progressdialog->setProgress(6);
-	sleep(1);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "mac_update_login_conf.pl ");
+	p = strcat(p, "--login-config-file /etc/login.conf ");
+	p = strcat(p, "--user default ");
+	p = strcat(p, "--label \"mls/low(low-low)\" ");
+	p = strcat(p, "--tty-label \"mls/low(low-low)\" ");
+	p = strcat(p, "--do-backup");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "mac_update_login_conf.pl ");
+	p = strcat(p, "--login-config-file /etc/login.conf ");
+	p = strcat(p, "--user root ");
+	p = strcat(p, "--label \"mls/low(low-high)\" ");
+	p = strcat(p, "--tty-label \"mls/low(low-high)\"");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "mac_update_login_conf.pl ");
+	p = strcat(p, "--login-config-file /etc/login.conf ");
+	p = strcat(p, "--user so ");
+	p = strcat(p, "--label \"mls/high(low-high)\" ");
+	p = strcat(p, "--tty-label \"mls/high(low-high)\"");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "cap_mkdb /etc/login.conf");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
 
 	progressdialog->setLabelText("TrustedBSD MLS Installation\n"
 	    "Adding Security Officer account");
 	progressdialog->setProgress(7);
-	sleep(1);
+	memset(sysbuf, NULL, sizeof (sysbuf));
+	p = sysbuf;
+	p = strcat(p, "mac_add_so_account.pl ");
+	p = strcat(p, "--username so ");
+	p = strcat(p, "--real-name \"Security Officer\" ");
+	p = strcat(p, "--shell /usr/local/bin/bash");
+	error = system(sysbuf);
+	if (error)
+		fprintf(stderr, "\'%s\' returned %d\n", sysbuf, error);
 
 	progressdialog->setLabelText("TrustedBSD MLS Installation\n"
-	    "Configuring Apache run-time label");
+	    "Install complete");
 	progressdialog->setProgress(8);
-	sleep(1);
-
-	progressdialog->setLabelText("TrustedBSD MLS Installation\n"
-	    "Install complete");
-	progressdialog->setProgress(9);
 
 	QMessageBox::information(this, "MLS Installation Complete!",
 	    "MLS support is now installed; reboot the system to start MLS.");
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list