home *** CD-ROM | disk | FTP | other *** search
- /**
- * File: modules/DirInstall.ycp
- * Package: Instalation into a Directory
- * Summary: Instalation into a Directory settings, input and output functions
- * Authors: Anas Nashif <nashif@suse.de>
- *
- * $Id: DirInstall.ycp 33515 2006-10-19 11:04:46Z lslezak $
- *
- */
- {
- textdomain "packager";
- module "DirInstall";
- import "Mode";
- import "Stage";
- import "HTML";
- import "ProductControl";
- import "String";
-
- global boolean runme_at_boot = false;
- global string target = "/var/tmp/dirinstall";
-
- global boolean makeimage = false;
- global string image_dir = "";
- global string image_name = "";
-
-
- global string dirinstall_control_file =
- "/usr/share/YaST2/control/dirinstall.xml";
-
- global boolean installing_into_dir = false;
-
- list<list<string> > filesystems = [
- ["/proc", "proc", "proc" ],
- ["/sys", "sysfs", "sysfs" ],
- ];
-
- list<string> mounted_fs = [];
-
- global void InitProductControl () {
- if (Stage::normal())
- {
- ProductControl::custom_control_file = dirinstall_control_file;
-
- if (!ProductControl::Init())
- {
- y2error("control file %1 not found", ProductControl::custom_control_file );
- }
- } else {
- installing_into_dir =false;
- }
-
-
- }
-
- global void DirInstall()
- {
- InitProductControl ();
- }
-
- global string Propose()
- {
- string color = "red";
- list<string> tmp = [];
- // Proposal for dirinstall installation
- tmp = add (tmp, sformat (_("Target Directory: %1"), HTML::Colorize(DirInstall::target, color)));
-
- // Proposal for backup during update
- tmp = add (tmp, sformat (_("Run YaST and SuSEconfig at First Boot: %1"), HTML::Colorize(DirInstall::runme_at_boot
- // part of label in proposal
- ? _("Yes"):
- // part of label in proposal
- _("No"), color) ));
- // Proposal for dirinstall installation
- tmp = add (tmp, sformat (_("Create Image: %1"), HTML::Colorize(DirInstall::makeimage ? _("Yes"): _("No"), color) ));
- return HTML::List (tmp);
-
- }
-
- global void MountFilesystems () {
- mounted_fs = [];
- foreach (list<string> descr, filesystems, {
- string mp = descr[0]:"";
- string dev = descr[1]:"";
- string type = descr[2]:"";
- mp = target + mp;
- WFM::Execute (.local.bash, sformat ("test -d '%1' || mkdir -p '%1'", String::Quote (mp)));
- WFM::Execute (.local.bash, sformat ("/bin/mount -t %1 %2 '%3'",
- type, dev, String::Quote (mp)));
- mounted_fs = add (mounted_fs, mp);
- });
- y2milestone ("Mounted filesystems: %1", mounted_fs);
- }
-
- global void UmountFilesystems () {
- y2milestone ("Mounted filesystems: %1", mounted_fs);
- foreach (string mp, mounted_fs, {
- WFM::Execute (.local.bash, sformat ("/bin/umount '%1'", String::Quote (mp)));
- });
- mounted_fs = [];
- }
-
- global void FinishPackageManager () {
- Pkg::SourceFinishAll ();
- Pkg::TargetFinish ();
- }
- }
-