installer: Always take the root directory's /dev.
authorSascha Wildner <saw@online.de>
Mon, 17 Dec 2012 21:13:38 +0000 (22:13 +0100)
committerSascha Wildner <saw@online.de>
Mon, 17 Dec 2012 21:13:38 +0000 (22:13 +0100)
Taking /dev relative to the directory we want to copy from was fine
until we got devfs, because we shipped actual device nodes in /dev
until then.

It only continued working because the directory we copy from is always
the distribution media's root directory currently.

usr.sbin/installer/dfuibe_installer/flow.c
usr.sbin/installer/dfuibe_installer/fn_configure.c
usr.sbin/installer/dfuibe_installer/fn_disk.c
usr.sbin/installer/dfuibe_installer/fn_install.c
usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c
usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c
usr.sbin/installer/libinstaller/diskutil.c

index 68127c6..c6b49bf 100644 (file)
@@ -1423,14 +1423,14 @@ state_setup_remote_installation_server(struct i_fn_args *a)
                            a->os_root, cmd_name(a, "INETD"));
                        command_add(cmds, "%s%s %svar/db/dhcpd.leases",
                            a->os_root, cmd_name(a, "TOUCH"), a->os_root);
-                       command_add(cmds, "%s%s -cf /etc/dhcpd.conf >%sdev/null 2>&1",
-                           a->os_root, cmd_name(a, "DHCPD"), a->os_root);
-                       command_add(cmds, "%s%s >%sdev/null 2>&1",
-                           a->os_root, cmd_name(a, "RPCBIND"), a->os_root);
-                       command_add(cmds, "%s%s -ln >%sdev/null 2>&1",
-                           a->os_root, cmd_name(a, "MOUNTD"), a->os_root);
-                       command_add(cmds, "%s%s -u -t -n 6 >%sdev/null 2>&1",
-                           a->os_root, cmd_name(a, "NFSD"), a->os_root);
+                       command_add(cmds, "%s%s -cf /etc/dhcpd.conf >/dev/null 2>&1",
+                           a->os_root, cmd_name(a, "DHCPD"));
+                       command_add(cmds, "%s%s >/dev/null 2>&1",
+                           a->os_root, cmd_name(a, "RPCBIND"));
+                       command_add(cmds, "%s%s -ln >/dev/null 2>&1",
+                           a->os_root, cmd_name(a, "MOUNTD"));
+                       command_add(cmds, "%s%s -u -t -n 6 >/dev/null 2>&1",
+                           a->os_root, cmd_name(a, "NFSD"));
 
                        if (commands_execute(a, cmds)) {
                                inform(a->c, _("NetBoot installation services are now started."));
index 3b44c77..699732c 100644 (file)
@@ -1363,9 +1363,8 @@ mount_target_system(struct i_fn_args *a)
         * Mount the target's / and read its /etc/fstab.
         */
        if (use_hammer == 0) {
-               command_add(cmds, "%s%s %sdev/%s %s%s",
+               command_add(cmds, "%s%s /dev/%s %s%s",
                    a->os_root, cmd_name(a, "MOUNT"),
-                   a->os_root,
                    subpartition_get_device_name(a_subpart),
                    a->os_root, a->cfg_root);
                cmd = command_add(cmds,
@@ -1376,9 +1375,8 @@ mount_target_system(struct i_fn_args *a)
                    a->os_root, a->cfg_root, a->tmp);
                command_set_failure_mode(cmd, COMMAND_FAILURE_IGNORE);
        } else {
-               command_add(cmds, "%s%s %sdev/%s %sboot",
+               command_add(cmds, "%s%s /dev/%s %sboot",
                    a->os_root, cmd_name(a, "MOUNT"),
-                   a->os_root,
                    subpartition_get_device_name(a_subpart),
                    a->os_root);
                cmd = command_add(cmds,
@@ -1405,27 +1403,24 @@ mount_target_system(struct i_fn_args *a)
                            a->os_root);
                        fn_get_passphrase(a);
                        command_add(cmds,
-                           "%s%s -d /tmp/t1 luksOpen %sdev/`%s%s \"^vfs\\.root\\.realroot=\" %st2 |"
+                           "%s%s -d /tmp/t1 luksOpen /dev/`%s%s \"^vfs\\.root\\.realroot=\" %st2 |"
                            "%s%s -Fhammer: '{print $2;}' |"
                            "%s%s -F: '{print $1;}'` root",
                            a->os_root, cmd_name(a, "CRYPTSETUP"),
-                           a->os_root,
                            a->os_root, cmd_name(a, "GREP"),
                            a->tmp,
                            a->os_root, cmd_name(a, "AWK"),
                            a->os_root, cmd_name(a, "AWK"));
                        command_add(cmds,
-                           "%s%s %sdev/mapper/root %s%s",
+                           "%s%s /dev/mapper/root %s%s",
                            a->os_root, cmd_name(a, "MOUNT_HAMMER"),
-                           a->os_root,
                            a->os_root, a->cfg_root);
                } else {
                        command_add(cmds,
-                           "%s%s %sdev/`%s%s \"^vfs\\.root\\.mountfrom\" %sboot/loader.conf |"
+                           "%s%s /dev/`%s%s \"^vfs\\.root\\.mountfrom\" %sboot/loader.conf |"
                            "%s%s -Fhammer: '{print $2;}' |"
                            "%s%s 's/\"//'` %s%s",
                            a->os_root, cmd_name(a, "MOUNT_HAMMER"),
-                           a->os_root,
                            a->os_root, cmd_name(a, "GREP"),
                            a->os_root,
                            a->os_root, cmd_name(a, "AWK"),
index c56c7f3..939d57a 100644 (file)
@@ -295,9 +295,8 @@ fn_wipe_start_of_disk(struct i_fn_args *a)
            "LAST CHANCE to cancel!"), disk_get_desc(storage_get_selected_disk(a->s)))) {
                cmds = commands_new();
                command_add(cmds,
-                   "%s%s if=%sdev/zero of=%sdev/%s bs=32k count=16",
+                   "%s%s if=/dev/zero of=/dev/%s bs=32k count=16",
                    a->os_root, cmd_name(a, "DD"),
-                   a->os_root, a->os_root,
                    disk_get_device_name(storage_get_selected_disk(a->s)));
                if (commands_execute(a, cmds)) {
                        inform(a->c, _("Start of disk was successfully wiped."));
@@ -339,9 +338,8 @@ fn_wipe_start_of_slice(struct i_fn_args *a)
            disk_get_desc(storage_get_selected_disk(a->s)))) {
                /* XXX check to make sure this slice is not mounted first */
                cmds = commands_new();
-               command_add(cmds, "%s%s if=%sdev/zero of=%sdev/%s bs=32k count=16",
+               command_add(cmds, "%s%s if=/dev/zero of=/dev/%s bs=32k count=16",
                    a->os_root, cmd_name(a, "DD"),
-                   a->os_root, a->os_root,
                    slice_get_device_name(storage_get_selected_slice(a->s)));
                if (commands_execute(a, cmds)) {
                        inform(a->c, _("Start of primary partition was successfully wiped."));
@@ -381,10 +379,10 @@ ask_to_wipe_boot_sector(struct i_fn_args *a, struct commands *fcmds)
                        case 1:
                                cmds = commands_new();
                                command_add(cmds,
-                                   "%s%s | %s%s -B %sdev/%s",
+                                   "%s%s | %s%s -B /dev/%s",
                                    a->os_root, cmd_name(a, "YES"),
                                    a->os_root, cmd_name(a, "FDISK"),
-                                   a->os_root, disk);
+                                   disk);
                                if (commands_execute(a, cmds)) {
                                        inform(a->c, _("Boot sector successfully initialized."));
                                } else {
@@ -564,11 +562,10 @@ fn_create_cdboot_floppy(struct i_fn_args *a)
        case 1:
                cmds = commands_new();
                command_add(cmds, "%s%s -c %sboot/cdboot.flp.bz2 | "
-                   "%s%s of=%sdev/fd0 bs=32k",
+                   "%s%s of=/dev/fd0 bs=32k",
                    a->os_root, cmd_name(a, "BUNZIP2"),
                    a->os_root,
-                   a->os_root, cmd_name(a, "DD"),
-                   a->os_root);
+                   a->os_root, cmd_name(a, "DD"));
                if (commands_execute(a, cmds))
                        inform(a->c, _("CDBoot floppy successfully created!"));
                else
index 95a5d9f..ea4337c 100644 (file)
@@ -160,10 +160,9 @@ fn_install_os(struct i_fn_args *a)
                    sp != NULL; sp = subpartition_next(sp)) {
                        if (!subpartition_is_swap(sp))
                                continue;
-                       command_add(cmds, "%s%s %sdev/%s",
+                       command_add(cmds, "%s%s /dev/%s",
                            a->os_root,
                            cmd_name(a, "SWAPON"),
-                           a->os_root,
                            subpartition_is_encrypted(sp) ?
                            "mapper/swap" : subpartition_get_device_name(sp));
                }
@@ -188,17 +187,15 @@ fn_install_os(struct i_fn_args *a)
             sp != NULL; sp = subpartition_next(sp)) {
                if (strcmp(subpartition_get_mountpoint(sp), "/") == 0) {
                        if (use_hammer == 1) {
-                               command_add(cmds, "%s%s %sdev/%s %smnt%s",
+                               command_add(cmds, "%s%s /dev/%s %smnt%s",
                                    a->os_root, cmd_name(a, "MOUNT_HAMMER"),
-                                   a->os_root,
                                    subpartition_is_encrypted(sp) ?
                                    "mapper/root" : subpartition_get_device_name(sp),
                                    a->os_root,
                                    subpartition_get_mountpoint(sp));
                        } else {
-                               command_add(cmds, "%s%s %sdev/%s %smnt%s",
+                               command_add(cmds, "%s%s /dev/%s %smnt%s",
                                    a->os_root, cmd_name(a, "MOUNT"),
-                                   a->os_root,
                                    subpartition_get_device_name(sp),
                                    a->os_root,
                                    subpartition_get_mountpoint(sp));
@@ -218,9 +215,8 @@ fn_install_os(struct i_fn_args *a)
                        if (subpartition_get_capacity(sp) < storage_get_memsize(a->s))
                                continue;
 
-                       command_add(cmds, "%s%s -v %sdev/%s",
+                       command_add(cmds, "%s%s -v /dev/%s",
                            a->os_root, cmd_name(a, "DUMPON"),
-                           a->os_root,
                            subpartition_is_encrypted(sp) ?
                            "mapper/swap" : subpartition_get_device_name(sp));
 
@@ -243,16 +239,14 @@ fn_install_os(struct i_fn_args *a)
                                if (subpartition_is_tmpfsbacked(sp))
                                        continue;
                                if (subpartition_is_encrypted(sp)) {
-                                       command_add(cmds, "%s%s %sdev/mapper/%s %smnt%s",
+                                       command_add(cmds, "%s%s /dev/mapper/%s %smnt%s",
                                            a->os_root, cmd_name(a, "MOUNT"),
-                                           a->os_root,
                                            subpartition_get_mountpoint(sp) + 1,
                                            a->os_root,
                                            subpartition_get_mountpoint(sp));
                                } else {
-                                       command_add(cmds, "%s%s %sdev/%s %smnt%s",
+                                       command_add(cmds, "%s%s /dev/%s %smnt%s",
                                            a->os_root, cmd_name(a, "MOUNT"),
-                                           a->os_root,
                                            subpartition_get_device_name(sp),
                                            a->os_root,
                                            subpartition_get_mountpoint(sp));
@@ -263,9 +257,8 @@ fn_install_os(struct i_fn_args *a)
                            a->os_root, cmd_name(a, "MKDIR"),
                            a->os_root,
                            subpartition_get_mountpoint(sp));
-                       command_add(cmds, "%s%s %sdev/%s %smnt%s",
+                       command_add(cmds, "%s%s /dev/%s %smnt%s",
                            a->os_root, cmd_name(a, "MOUNT"),
-                           a->os_root,
                            subpartition_get_device_name(sp),
                            a->os_root,
                            subpartition_get_mountpoint(sp));
index cb2679a..39cff8e 100644 (file)
@@ -212,40 +212,34 @@ create_subpartitions(struct i_fn_args *a)
                        if (subpartition_is_swap(sp) &&
                            subpartition_is_encrypted(sp)) {
                                command_add(cmds,
-                                   "%s%s -d /tmp/t1 luksFormat %sdev/%s",
+                                   "%s%s -d /tmp/t1 luksFormat /dev/%s",
                                    a->os_root, cmd_name(a, "CRYPTSETUP"),
-                                   a->os_root,
                                    subpartition_get_device_name(sp));
                                command_add(cmds,
-                                   "%s%s -d /tmp/t1 luksOpen %sdev/%s swap",
+                                   "%s%s -d /tmp/t1 luksOpen /dev/%s swap",
                                    a->os_root, cmd_name(a, "CRYPTSETUP"),
-                                   a->os_root,
                                    subpartition_get_device_name(sp));
                        }
                        continue;
                }
 
                if (strcmp(subpartition_get_mountpoint(sp), "/boot") == 0) {
-                       command_add(cmds, "%s%s %sdev/%s",
+                       command_add(cmds, "%s%s /dev/%s",
                            a->os_root, cmd_name(a, "NEWFS"),
-                           a->os_root,
                            subpartition_get_device_name(sp));
                } else {
                        if (subpartition_is_encrypted(sp)) {
                                command_add(cmds,
-                                   "%s%s -d /tmp/t1 luksFormat %sdev/%s",
+                                   "%s%s -d /tmp/t1 luksFormat /dev/%s",
                                    a->os_root, cmd_name(a, "CRYPTSETUP"),
-                                   a->os_root,
                                    subpartition_get_device_name(sp));
                                command_add(cmds,
-                                   "%s%s -d /tmp/t1 luksOpen %sdev/%s root",
+                                   "%s%s -d /tmp/t1 luksOpen /dev/%s root",
                                    a->os_root, cmd_name(a, "CRYPTSETUP"),
-                                   a->os_root,
                                    subpartition_get_device_name(sp));
                        }
-                       command_add(cmds, "%s%s -f -L ROOT %sdev/%s",
+                       command_add(cmds, "%s%s -f -L ROOT /dev/%s",
                            a->os_root, cmd_name(a, "NEWFS_HAMMER"),
-                           a->os_root,
                            subpartition_is_encrypted(sp) ?
                            "mapper/root" : subpartition_get_device_name(sp));
                }
index d824a39..a71e55a 100644 (file)
@@ -208,14 +208,12 @@ create_subpartitions(struct i_fn_args *a)
                        if (subpartition_is_swap(sp) &&
                            subpartition_is_encrypted(sp)) {
                                command_add(cmds,
-                                   "%s%s -d /tmp/t1 luksFormat %sdev/%s",
+                                   "%s%s -d /tmp/t1 luksFormat /dev/%s",
                                    a->os_root, cmd_name(a, "CRYPTSETUP"),
-                                   a->os_root,
                                    subpartition_get_device_name(sp));
                                command_add(cmds,
-                                   "%s%s -d /tmp/t1 luksOpen %sdev/%s swap",
+                                   "%s%s -d /tmp/t1 luksOpen /dev/%s swap",
                                    a->os_root, cmd_name(a, "CRYPTSETUP"),
-                                   a->os_root,
                                    subpartition_get_device_name(sp));
                        }
                        continue;
@@ -224,30 +222,26 @@ create_subpartitions(struct i_fn_args *a)
                if (subpartition_is_encrypted(sp) &&
                    strcmp(subpartition_get_mountpoint(sp), "/") != 0) {
                        command_add(cmds,
-                           "%s%s -d /tmp/t1 luksFormat %sdev/%s",
+                           "%s%s -d /tmp/t1 luksFormat /dev/%s",
                            a->os_root, cmd_name(a, "CRYPTSETUP"),
-                           a->os_root,
                            subpartition_get_device_name(sp));
                        command_add(cmds,
-                           "%s%s -d /tmp/t1 luksOpen %sdev/%s %s",
+                           "%s%s -d /tmp/t1 luksOpen /dev/%s %s",
                            a->os_root, cmd_name(a, "CRYPTSETUP"),
-                           a->os_root,
                            subpartition_get_device_name(sp),
                            subpartition_get_mountpoint(sp) + 1);
-                       command_add(cmds, "%s%s%s -b %ld -f %ld %sdev/mapper/%s",
+                       command_add(cmds, "%s%s%s -b %ld -f %ld /dev/mapper/%s",
                            a->os_root, cmd_name(a, "NEWFS"),
                            subpartition_is_softupdated(sp) ? " -U" : "",
                            subpartition_get_bsize(sp),
                            subpartition_get_fsize(sp),
-                           a->os_root,
                            subpartition_get_mountpoint(sp) + 1);
                } else {
-                       command_add(cmds, "%s%s%s -b %ld -f %ld %sdev/%s",
+                       command_add(cmds, "%s%s%s -b %ld -f %ld /dev/%s",
                            a->os_root, cmd_name(a, "NEWFS"),
                            subpartition_is_softupdated(sp) ? " -U" : "",
                            subpartition_get_bsize(sp),
                            subpartition_get_fsize(sp),
-                           a->os_root,
                            subpartition_get_device_name(sp));
                }
        }
index a2da8a3..82fa689 100644 (file)
@@ -941,9 +941,8 @@ remove_all_mappings(const struct i_fn_args *a)
 {
        FILE *p;
 
-       if ((p = aura_popen("%s%s -1 %sdev/mapper | %s%s -vw control | %s%s -n 1 %s%s luksClose", "r",
+       if ((p = aura_popen("%s%s -1 /dev/mapper | %s%s -vw control | %s%s -n 1 %s%s luksClose", "r",
                    a->os_root, cmd_name(a, "LS"),
-                   a->os_root,
                    a->os_root, cmd_name(a, "GREP"),
                    a->os_root, cmd_name(a, "XARGS"),
                    a->os_root, cmd_name(a, "CRYPTSETUP"))) != NULL)