home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * $Id: inst_finish.ycp,v 1.158.4.2 2000/03/27 15:28:27 kkaempf Exp $
- *
- * Module: inst_finish.ycp
- *
- * Author: Klaus KΣmpf
- * Mathias Kettner
- *
- * Purpose: This module finishes the installation, writes
- * some files (rc_config fstab ... and so on).
- *
- * user_settings:
- * ro: entire user_settings
- * ro: "mouse"
- * ro: "rpassword"
- * ro: "targets"
- * ro: "keyboard"
- * ro: "softwaresel"
- * ro: "language"
- * ro: "timezone"
- * ro: "mouse"
- * ro: "console_font"
- * ro: "console_screenmap"
- * ro: "console_unicodemap"
- * ro: "console_magic"
- * ro: "alldisks"
- * ro: "whole_disk"
- * ro: "loginname"
- * ro: "upassword"
- * ro: "have_x11"
- * ro: "root_device"
- * ro: "swap_device"
- * ro: "modules"
- *
- * "rw" read/write
- * "ro" readonly
-
- * Writes:
- * /mnt/var/lib/YaST2/runme_at_boot run yast2 after initial boot
- * /mnt/var/lib/YaST2/settings.ycp save settings
- * /mnt/var/lib/YaST2/hwprobe.ycp
- * `Write(.etc.shadow.root,
- * `Write(.etc.rcconfig,
- * `Write(.etc.rcconfig.sendmailconfig,
- * `Write(.mnt.etc.fstab,
- * `Write(.yast2.inf.rootpart,
- * `Write(.yast2.inf.swappart,
- */
- {
- string architecture = lookup (user_settings, "architecture", default_architecture);
-
- // --------------------------------------------------------------
- // Tell new boot scripts to launch yast2, once the
- // new system has done its virgin boot. The Write call
- // creates any missing directory :-). Also write the
- // user settings to a file. This file is readably only for root!
- // It contains a root password (in crypted form).
-
- Write("/mnt/var/lib/YaST2/runme_at_boot", nil);
- Write("/mnt/var/lib/YaST2/settings.ycp", user_settings, 0600);
- SCR(`Write(.dumpto.mnt.var.lib.YaST2.hwprobe, SCR(`Read(.probe.byclass))));
-
- // debug
- SCR(`Write(.dumpto.mnt.var.lib.YaST2.user_settings, user_settings));
-
- // --------------------------------------------------------------
- // Inform YaST1 about the installation image
-
- SCR(`Write(.mnt.var.lib.yast.installinf, "MediaInfo: 2 /dev/cdrom"));
- SCR(`Write(.mnt.var.lib.yast.systeminf, "ELF=\"1\"\nHAS_LIVE_CD=\"1\""));
-
- // generate /mnt/var/lib/YaST/update.inf from /tmp/info and /tmp/update.in_
- if (0 != Shell ("create_update_inf"))
- _debug("Couldn't create update.info");
-
- // --------------------------------------------------------------
- // Create mount point for YaST1
-
- Mkdir("/mnt/var/adm/mount");
-
-
- // --------------------------------------------------------------
- // Symlink (/mnt)/dev/cdromX to all real cdrom devices
-
- list cddevices = [];
-
- // link /dev/cdrom -> /dev/sr0 (/dev/hdb or whatever)
-
- define symlink_cdrom (map cdinfo, integer number) ``{
- string cddevice = lookup (cdinfo, "dev_name", "");
- string linkname = "/dev/cdrom";
- if (number > 0)
- linkname = linkname + number;
-
- cddevices = add (cddevices, linkname);
-
- if (cddevice != "") {
- y2log (.debug, "inst_finish", 1, sformat("Generating symlink: %1 -> %2", cddevice, linkname));
- Symlink (cddevice, "/mnt" + linkname);
- }
- };
-
- integer cdnum = 0;
- list cddrives = SCR(`Read(.probe.byclass.storage_device.cdrom));
- foreach (`drive, cddrives, ``{
- symlink_cdrom (drive, cdnum);
- cdnum = cdnum + 1;
- });
-
- // --------------------------------------------------------------
- // Symlink (/mnt)/dev/mouse to real mouse device
-
- map mouseinfo = lookup (user_settings, "mouse", $[]);
- string mousedevice = lookup (mouseinfo, "device", "");
- string gpm_param = "";
- if (mousedevice != "") {
- Symlink (mousedevice, "/mnt/dev/mouse");
-
- // if we have a mouse device, set gpm_param
- gpm_param = lookup (mouseinfo, "gpm", "");
- if (gpm_param != "")
- gpm_param = "-t " + gpm_param + " -m /dev/mouse";
- }
-
-
- // --------------------------------------------------------------
- // Set root password
-
- if (!SCR(`Write(.etc.shadow.root, lookup(user_settings, "rpassword", ""))))
- {
- // Error msg
- UI(`DisplayMessage(_("\
- The root password could not be set!\n\
- You won't be able to login!")));
- }
-
-
- // --------------------------------------------------------------
- // get targets
- // first build map of module names (remove duplicates)
- // then make list of modules as string
- // FIXME: should only include module needed for root-device
-
- map moduleMap = lookup (user_settings, "modules", $[]);
-
- list modules_name = [];
- list modules_conf = [];
- // collect module names and modules.conf entries
- foreach (`mname, `mconf, moduleMap, ``{
- if ((mname != "")
- && (!contains (modules_name, mname)))
- modules_name = add (modules_name, mname);
- if ((mconf != "")
- && (!contains (modules_conf, mconf)))
- modules_conf = add (modules_conf, mconf);
- });
-
- // make module names to one long string
- // start with modules from linuxrc
-
- map install_inf = SCR(`Read(.etc.install_inf));
- list initrdmodules = lookup (install_inf, "initrd_modules", []);
- foreach (`mname, modules_name, ``{
- if (!contains (initrdmodules, mname))
- initrdmodules = add (initrdmodules, mname);
- });
-
- string confmodules = "";
- string install_alias = lookup (install_inf, "alias", "");
- if (install_alias != "")
- confmodules = "alias "+install_alias+"\n";
-
- string start_usb = "no";
- integer usb_type = lookup (user_settings, "usb_type", 0);
- // 1 (uhci) oder 2 (ohci)
- if (usb_type == 1) {
- if (!contains (initrdmodules, "usbcore"))
- initrdmodules = add (initrdmodules, "usbcore");
- start_usb = "yes";
- confmodules = confmodules + "alias usb-hostadapter usb-uhci\n";
- }
- else if (usb_type == 2) {
- if (!contains (initrdmodules, "usbcore"))
- initrdmodules = add (initrdmodules, "usbcore");
- start_usb = "yes";
- confmodules = confmodules + "alias usb-hostadapter usb-ohci-hcd\n";
- }
-
- // make modules.conf entries as one string with \n
-
- foreach (`mconf, modules_conf, ``{
- confmodules = confmodules + mconf + "\n";
- });
-
- // now re-construct string of modules for initrd
-
- string rc_initrd = "";
- foreach (`mname, initrdmodules, ``{
- if (rc_initrd != "")
- rc_initrd = rc_initrd + " ";
- rc_initrd = rc_initrd + mname;
- });
-
- y2log (.milestone, "inst_finish", 1, sformat("Modules for the initrd: %1", initrdmodules));
- y2log (.milestone, "inst_finish", 2, sformat("Entries in modules.conf: %1", confmodules));
- y2log (.milestone, "inst_finish", 3, sformat("Entries in rc.config: %1", rc_initrd));
-
- // if needed, re-write /etc/modules.conf
-
- if (confmodules != "") {
- WriteString ("/tmp/add-modules.conf",
- "# Added by YaST2, do not change\n"
- + confmodules
- + "# End of YaST2 additions\n");
- Shell ("cat /mnt/etc/modules.conf /tmp/add-modules.conf > /tmp/new-modules.conf");
- Shell ("cp /tmp/new-modules.conf /mnt/etc/modules.conf");
- }
-
- // --------------------------------------------------------------
- // get console keyboard
-
- string keyboard_name = lookup (user_settings, "keyboard", "english-us");
- list keyboard_desc = lookup (ReadY2("keyboard.ycp"), keyboard_name, []);
- string console_keyboard = lookup (select (keyboard_desc, 1), "ncurses", "qwerty/us.map.gz" );
-
-
- // --------------------------------------------------------------
- // check for Kde vs. Gnome, see inst_xf86config
-
- list current_sel = lookup(user_settings, "softwaresel", []);
- string default_wm = "kde";
- if (contains (current_sel, .Minimal)
- && contains (current_sel, .Gnome)
- && (!contains (current_sel, .Kde)))
- default_wm = "gnome";
-
- string rc_lang = lookup(user_settings, "language", default_language);
-
- map lang2yast1 = $[
- "en_GB" : "english",
- "en_US" : "english",
- "en" : "english",
- "de_DE" : "german",
- "de_CH" : "german",
- "de" : "german",
- "br_FR" : "french",
- "fr_FR" : "french",
- "fr_CH" : "french",
- "fr" : "french",
- "it_IT" : "italian",
- "es_ES" : "spanish",
- "nl_NL" : "dutch",
- "pt_PT" : "portuguese",
- "pt_BR" : "brazilian",
- "hu_HU" : "hungarian",
- "pl_PL" : "polish",
- "el_GR" : "greek",
- "ru_RU.KOI8-R" : "russian",
- "cs_CZ" : "czech",
- "sk_SK" : "slovak"
- ];
-
- string lang4yast1 = lookup(lang2yast1, rc_lang, "english");
-
- string start_gpm = "yes";
- if (lookup (user_settings, "mouse", $[]) == $[])
- start_gpm = "no";
-
- // Set default values in rc.config + timezone + mouse
- map varmap = $[
- "KEYTABLE" : [ console_keyboard, "Keyboard mapping for the text console."],
- "GMT" : [ "", "Set to \"-u\" if your system clock is set to GMT, otherwise \"\"."],
- "START_INETD" : [ "yes", "Start the inet daemon in multi-user? (\"yes\" or \"no\")"],
- "START_PORTMAP" : [ "yes", "Start portmap? (\"yes\" or \"no\") Needed for nfsserver or NIS"],
- "START_USB" : [ start_usb, "Start USB module ?"],
- "NETCONFIG" : [ "", "Number of network cards: \"_0\" for one, \"_0 _1 _2 _3\" for four cards" ],
- "NFS_SERVER" : [ "no", "Should the NFS server be started on this host? (\"yes\" or \"no\")"],
- "START_GPM" : [ start_gpm, "Should gpm be started on this machine? (\"yes\" or \"no\")"],
- "GPM_PARAM" : [ gpm_param, "gpm will be started in runlevel 2 with this parameters" ],
- "FQHOSTNAME" : [ "linux.local", "The fully qualfied hostname of this computer"],
- "SEARCHLIST" : [ "local", "Domain searchlist that should be used in /etc/resolv.conf" ],
- "NAMESERVER" : [ "", "Space separated list of nameservers that should be used for /etc/resolv.conf" ],
- "LANGUAGE" : [ lang4yast1, "The language setting for the old YaST"],
- "RC_LANG" : [ rc_lang, "The language setting for the old YaST"],
- "TIMEZONE" : [ lookup(user_settings, "timezone", "Europe/Berlin"), "The timezone setting"],
- "MOUSE" : [ lookup(lookup(user_settings, "mouse", $[ "device":"/dev/psaux" ]), "device", "/dev/psaux"), "The Unix device for the mouse" ],
- "INITRD_MODULES" : [ rc_initrd, "The module for initrd during boot" ],
- "DEFAULT_WM" : [ default_wm, "run kde or gnome as default wm" ],
- "USE_KERNEL_NFSD" : [ "yes", "should the kernel based NFS server be started on this host"],
- "CONSOLE_FONT" : [ lookup(user_settings, "console_font", ""), "Load this console font upon bootup:" ],
- "CONSOLE_SCREENMAP" : [ lookup(user_settings, "console_screenmap", ""), "Does your console font need a screenmap? Insert it into CONSOLE_SCREENMAP."],
- "CONSOLE_UNICODEMAP" : [ lookup(user_settings, "console_unicodemap", ""), "some fonts/keymap need a unicode map (TRANSLATION in former releases)." ],
- "CONSOLE_MAGIC" : [ lookup(user_settings, "console_magic", ""), "special magic to switch console" ]
- ];
-
- if (!SCR(`Write(.etc.rcconfig, varmap))) {
- // Error msg
- UI(`DisplayMessage(_("Couldn't write values to /etc/rc.config")));
- }
-
-
- // --------------------------------------------------------------
- // Set default value for sendmail.rc.config
- varmap = $[
- "FROM_HEADER" : [ "", "From:-Line in email and News postings"],
- "SENDMAIL_TYPE" : [ "yes", "generate sendmail.cf from parameters in rc.config"]
- ];
-
- if (!SCR(`Write(.etc.rcconfig.sendmailconfig, varmap))) {
- // Error msg
- UI(`DisplayMessage(_("Couldn't write values to /etc/rc.config.d/sendmail.rc.config")));
- }
-
-
- // --------------------------------------------------------------
- // Write fstab
- //
- // data: targets
- // cddevices
- //
-
- // filesystems for /dos
- list fsid_dostypes = [ 1, 4 ]; /* FAT12, FAT16 */
- // filesystems for /windows
- list fsid_wintypes = [ 6, 11, 12, 14 ]; /* FAT32, Win95-Fat32, Win95LBA, Win95-Fat16 */
- list fsid_ntfstypes = [ 7 ]; /* NTFS */
- // filesystems mounted read-only
- list fsid_readonly = [ 7 ];
-
- // check partitions list for primary partitions with dos/win id
- // returns list of [ partition-device, partition-name ] entries
- // target is "/dev/?da" (i.e. full device, w/o paritition numbers)
-
- // The filesystem ids for the FAT partitions
- integer fsid_empty = 0;
- integer fsid_native = 131;
- integer fsid_swap = 130;
- integer fsid_extended = 5;
-
- list fstab = [];
- integer other_nr = 1; // count other mounts
- integer foreign_nr = 0; // count dos/win mounts
- string foreign_ids = "CDEFGHIJKLMNOPQRSTUVW";
-
- string foreign_primary = ""; // might be windows boot partition
- string cmd4boot_message = ""; // cmd for /boot/message to explain lilo options
-
- if (architecture != "i386")
- foreign_primary = "X";
-
- // convert partitions to fstab entries
- // return map (might be empty)
-
- define onepartition2fstab (string device, map partition) ``{
- if (lookup (partition, "delete", false)
- || (lookup (partition, "type") == `extended))
- return $[];
-
- string spec = device + lookup (partition, "nr");
- string file = lookup (partition, "mount", "");
- integer fsid = lookup (partition, "fsid", 0);
- symbol used_fs = lookup (partition, "used_fs", `ext2);
- string vfstype = "unknown";
- integer freq = 0;
- integer passno = 0;
- string mntops = "defaults";
-
- if (file == "/")
- passno = 1;
- else if (file != "")
- passno = 2;
-
- if (fsid == fsid_swap) {
- // Only use our new swap partition
- if (file == "") return $[];
- vfstype = "swap";
- }
- else if (fsid == fsid_native) {
- if (used_fs == `reiser)
- vfstype = "reiserfs";
- else
- vfstype = "ext2";
- freq = 1;
- if (file == "") {
- file = "/data" + other_nr;
- if (!Mkdir("/mnt" + file))
- return;
- // Don't mount and fsck this filesystem during boot, its
- // state is unknown.
- mntops = "noauto,user";
- vfstype = "auto";
- freq = 0;
- other_nr = other_nr + 1;
- }
- }
- else if (contains (fsid_dostypes, fsid)) { // dos type
- vfstype = "auto";
- if (contains (fsid_readonly, fsid))
- mntops = "ro,noauto,user";
- else
- mntops = "noauto,user";
- freq = 0;
- if (file == "") {
- file = "/dos/" + substring (foreign_ids, foreign_nr, 1);
- }
- Mkdir ("/mnt"+file);
- if ((foreign_primary == "")
- && (lookup (partition, "type") == `primary)) {
- foreign_primary = spec + " dos";
- cmd4boot_message = "echo 'dos -> Boot DOS' > /mnt/boot/message";
- }
- foreign_nr = foreign_nr + 1;
- }
- else if (contains (fsid_ntfstypes, fsid)) { // dos type
- vfstype = "ntfs";
- if (contains (fsid_readonly, fsid))
- mntops = "ro,noauto,user";
- else
- mntops = "noauto,user";
- freq = 0;
- if (file == "") {
- file = "/windows/" + substring (foreign_ids, foreign_nr, 1);
- }
- Mkdir ("/mnt"+file);
- if ((foreign_primary == "")
- && (lookup (partition, "type") == `primary)) {
- foreign_primary = spec + " nt";
- cmd4boot_message = "echo 'nt -> Boot Windows NT' > /mnt/boot/message";
- }
- foreign_nr = foreign_nr + 1;
- }
- else if (contains (fsid_wintypes, fsid)) { // win type
- vfstype = "vfat";
- if (contains (fsid_readonly, fsid))
- mntops = "ro,noauto,user";
- else
- mntops = "noauto,user";
- freq = 0;
- if (file == "") {
- file = "/windows/" + substring (foreign_ids, foreign_nr, 1);
- }
- Mkdir ("/mnt"+file);
- if ((foreign_primary == "")
- && (lookup (partition, "type") == `primary)) {
- foreign_primary = spec + " windows";
- cmd4boot_message = "echo 'windows -> Boot Windows' > /mnt/boot/message";
- }
- foreign_nr = foreign_nr + 1;
- } else
- return $[]; // unknown type
-
- return ($["spec":spec, "file":file, "vfstype":vfstype,
- "mntops":mntops, "freq":freq, "passno":passno]);
- };
-
-
- define allpartitions2fstab (string device, list partitions) ``{
- if (size (partitions) == 0)
- return;
- foreach (`partition, partitions, ``{
- map fstabentry = onepartition2fstab (device, partition);
- if (fstabentry != $[])
- fstab = add (fstab, fstabentry);
- });
- };
-
- map targetMap = lookup (user_settings, "targets", $[]);
-
- foreach (`tdevice, `tdata, targetMap, ``{
- list partitions = lookup (tdata, "partitions", []);
- allpartitions2fstab (tdevice, partitions);
- });
-
- fstab = add (fstab,
- $["spec":"proc", "file":"/proc", "vfstype":"proc",
- "mntops":"defaults", "freq":0, "passno":0]);
- if (start_usb == "yes") {
- fstab = add (fstab,
- $["spec":"usbdevfs", "file":"/proc/bus/usb", "vfstype":"usbdevfs",
- "mntops":"defaults", "freq":0, "passno":0]);
- }
- fstab = add (fstab,
- $["spec":"devpts", "file":"/dev/pts", "vfstype":"devpts",
- "mntops":"defaults", "freq":0, "passno":0]);
-
- // add all cd-drives to fstab
-
- cdnum = 0;
-
- foreach (`cd, cddevices, ``{
- string cdmount = "";
- cdmount = "/cdrom";
- if (cdnum > 0)
- cdmount = cdmount + cdnum;
- Mkdir ("/mnt"+cdmount);
- fstab = add (fstab,
- $["spec":cd, "file":cdmount, "vfstype":"auto",
- "mntops":"ro,noauto,user,exec", "freq":0, "passno":0]);
- cdnum = cdnum + 1;
- });
-
- fstab = add (fstab,
- $["spec":"/dev/fd0", "file":"/floppy", "vfstype":"auto",
- "mntops":"noauto,user", "freq":0, "passno":0]);
-
- if (test_mode)
- y2log (.milestone, "inst_finish", 1, "fstab: "+fstab);
- else
- SCR(`Write(.mnt.etc.fstab, fstab));
-
-
- // --------------------------------------------------------------
- // boot concept
- if ((foreign_primary != "") && (foreign_primary != "X")) {
- user_settings = add (user_settings, "other_lilo", " -o \""+foreign_primary+"\"");
- if (cmd4boot_message != "")
- Shell (cmd4boot_message);
- }
-
- // --------------------------------------------------------------
- // create 1st user from installation dialog
-
- string loginname = lookup (user_settings, "loginname", "");
- string upassword = lookup (user_settings, "upassword", "");
- string uid = "500"; // FIXME: should be looked up dynamically (first free above 500)
-
- integer ret = 0;
- if (!test_mode)
- Shell(sformat("chroot /mnt useradd -G dialout,uucp,video,audio -u %1 -m -p %2 %3", uid, upassword, loginname));
-
- // inform the user, that the user login could not be created
- if ( ret != 0 )
- {
- _debug ("useradd - error:", ret);
- // Error msg
- UI(`DisplayMessage(_("An error occurred during creation of the user login!")));
- }
-
- // clear screen after useradd, but probably on wrong tty ?!
- // Shell ("echo ''");
-
-
- // Run depmod to update modules.dep
- if (!test_mode)
- Shell("chroot /mnt /sbin/depmod -a -F /boot/System.map-`uname -r` `uname -r`");
-
- // Set default runlevel to 3, if X11 packages are installed
- // also make symlink to real X-Server
-
- if (!test_mode && (lookup (user_settings, "have_x11", false) == true)) {
- string xservername = lookup (user_settings, "xservername", "");
- if (xservername == "") {
- // Oops, x11 choosen without xservername ?!
- Shell ("cp /usr/X11R6/bin/XF86_FBDev /mnt/usr/X11R6/bin");
- xservername = "XF86_FBDev";
- }
- Shell("chroot /mnt ln -snf /usr/X11R6/bin/"+xservername+" /var/X11R6/bin/X");
- Shell("sed -e 's/^id:[0-9sSa-cA-C]*:initdefault:/id:3:initdefault:/' /mnt/etc/inittab >/tmp/inittab && cp /tmp/inittab /mnt/etc");
-
- }
-
- // FIXME
- // one more hack to ease testing
- // this effectively overwrites the y2base.rpm and yast2.rpm just installed
-
- // if (lookup (install_inf, "bootmode", "") == "Net") {
- // Shell ("cp /bin/y2bignfat /mnt/bin/y2bignfat");
- // Shell ("cp -a /lib/YaST2/* /mnt/lib/YaST2");
- // }
-
- // Tell linuxrc where swap and root is
- // Tell linuxrc to reboot on an SMP system
-
- if (SCR(`Read(.probe.has_smp))) {
- SCR(`Write(.yast2.inf.rootpart, "reboot"));
- user_settings = add (user_settings, "made_reboot", true);
- }
- else {
- if (SCR(`Read(.probe.has_pcmcia)))
- user_settings = add (user_settings, "made_reboot", true);
- SCR(`Write(.yast2.inf.rootpart, lookup(user_settings, "root_device", "")));
- }
-
- SCR(`Write(.yast2.inf.swappart, lookup(user_settings, "swap_device", "")));
- SCR(`Write(.yast2.inf.language, lookup(user_settings, "yast1_language", "")));
- SCR(`Write(.yast2.inf.keymap, lookup(user_settings, "yast1_keymap", "")));
-
- // --------------------------------------------------------------
- // Copy YaST2 log files into installed system
-
- Shell("cp /var/log/y2log* /mnt/var/log");
-
- // --------------------------------------------------------------
- // Copy /etc/install.inf and /etc/XF86Config into built system so that the
- // second phase of the installation can find it.
-
- Shell("cp /etc/install.inf /etc/yast.inf /mnt/etc");
-
- string mouse_type = lookup (install_inf, "mouse_type", "PS/2");
- map mouseMap = lookup (user_settings, "mouse", $[]);
- string new_mouse = lookup (mouseMap, "xf86", mouse_type);
- if (mouse_type == new_mouse) {
- // keep mouse
- Shell("cp /etc/XF86Config /mnt/etc");
- }
- else {
- // replace with probed type
- Shell("sed -e \"s#"+mouse_type+"#"+new_mouse+"#\" /etc/XF86Config >/mnt/etc/XF86Config");
- }
-
- // --------------------------------------------------------------
- // Copy syslinux files into installed system
-
- Shell("cp /usr/sbin/syslinux /mnt/usr/sbin/syslinux");
-
- // --------------------------------------------------------------
- // Write LILO (not on PPC)
-
- if (architecture != "ppc")
- CallFunction (`inst_writelilo());
-
- // --------------------------------------------------------------
- // message after first round of packet installation
- // now the installed system is run and more packages installed
- // just warn the user that the screen is going back to text mode
- // and yast2 will come up again.
- // dont mention this "going back to text mode" here, maybe this
- // wont be necessary in the final version
-
- // we should tell the user to remove the cd on an SMP or Laptop system
- // where we do a hard reboot. However, the cdrom is still mounted here
- // and cant be removed.
-
- UI(`DisplayMessage(_("Now booting your system...")));
-
- // --------------------------------------------------------------
- // Unmount all mounted devices (from inst_prepdisk)
-
- map mountPoints = lookup(user_settings, "mountpoints", mountPoints);
- list umountList = [];
-
- // go through mountPoints collecting pathes in umountList
-
- foreach (`mountpoint,`mountval,mountPoints, ``{
- if ((mountpoint != "swap")
- && (select (mountval, 1) == fsid_native)) {
- umountList = add (umountList, mountpoint);
- }
- });
-
- // now unmount all mountpoints in reverse order !
-
- if (usb_type != 0)
- Shell ("/bin/umount /mnt/proc/bus/usb");
- Shell ("/bin/umount /mnt/proc");
-
- integer umountLength = size (umountList);
- while (umountLength > 0) {
- umountLength = umountLength - 1;
- Shell ("/bin/umount /mnt"+select (umountList, umountLength));
- }
-
- return `next;
- }
-