1372
1372
bool home_found = false;
1373
1373
dst_root = null;
1375
foreach(var mnt in fstab_list){
1375
foreach(var fs_entry in fstab_list){
1377
1377
// skip mounting for non-system devices
1379
if (!mnt.is_for_system_directory()){
1379
if (!fs_entry.is_for_system_directory()){
1383
1383
// find device by name or uuid
1385
Device mnt_dev = null;
1386
if (mnt.device_uuid.length > 0){
1387
mnt_dev = Device.get_device_by_uuid(mnt.device_uuid);
1385
Device dev_fstab = null;
1386
if (fs_entry.device_uuid.length > 0){
1387
dev_fstab = Device.get_device_by_uuid(fs_entry.device_uuid);
1390
mnt_dev = Device.get_device_by_name(mnt.device);
1390
dev_fstab = Device.get_device_by_name(fs_entry.device_string);
1393
// replace mapped name with parent device
1393
if (dev_fstab == null){
1395
if (mnt_dev == null){
1398
Note: This is required since the mapped name may be different on running system.
1399
Since we don't have the same mapped name, we cannot resolve the device without
1400
identifying the parent partition
1396
Check if the device mentioned in fstab entry is a mapped device.
1397
If it is, then try finding the parent device which may be available on the current system.
1398
Prompt user to unlock it if found.
1401
Mapped name may be different on running system, or it may be same.
1402
Since it is not reliable, we will try to identify the parent intead of the mapped device.
1403
if (mnt.device.has_prefix("/dev/mapper/")){
1404
string mapped_name = mnt.device.replace("/dev/mapper/","");
1405
foreach(var entry in crypttab_list){
1406
if (entry.mapped_name == mapped_name){
1407
mnt.device = entry.device;
1405
if (fs_entry.device_string.has_prefix("/dev/mapper/")){
1407
string mapped_name = fs_entry.device_string.replace("/dev/mapper/","");
1409
foreach(var crypt_entry in crypttab_list){
1411
if (crypt_entry.mapped_name == mapped_name){
1413
// we found the entry for the mapped device
1414
fs_entry.device_string = crypt_entry.device_string;
1416
if (fs_entry.device_uuid.length > 0){
1418
// we have the parent's uuid. get the luks device and prompt user to unlock it.
1419
var dev_luks = Device.get_device_by_uuid(fs_entry.device_uuid);
1421
if (dev_luks != null){
1423
string msg_out, msg_err;
1424
var dev_unlocked = Device.luks_unlock(
1425
dev_luks, "", "", parent_window, out msg_out, out msg_err);
1427
if (dev_unlocked != null){
1428
dev_fstab = dev_unlocked;
1429
update_partitions();
1432
dev_fstab = dev_luks; // map to parent
1437
// nothing to do: we don't have the parent's uuid
1413
// try again - find device by name or uuid
1415
if (mnt.device_uuid.length > 0){
1416
mnt_dev = Device.get_device_by_uuid(mnt.device_uuid);
1419
mnt_dev = Device.get_device_by_name(mnt.device);
1423
if (mnt_dev != null){
1446
if (dev_fstab != null){
1425
1448
log_debug("added: dev: %s, path: %s, options: %s".printf(
1426
mnt_dev.device, mnt.mount_point, mnt.options));
1449
dev_fstab.device, fs_entry.mount_point, fs_entry.options));
1428
mount_list.add(new MountEntry(mnt_dev, mnt.mount_point, mnt.options));
1451
mount_list.add(new MountEntry(dev_fstab, fs_entry.mount_point, fs_entry.options));
1430
if (mnt.mount_point == "/"){
1453
if (fs_entry.mount_point == "/"){
1454
dst_root = dev_fstab;
1435
1458
log_debug("missing: dev: %s, path: %s, options: %s".printf(
1436
mnt.device, mnt.mount_point, mnt.options));
1459
fs_entry.device_string, fs_entry.mount_point, fs_entry.options));
1438
mount_list.add(new MountEntry(null, mnt.mount_point, mnt.options));
1461
mount_list.add(new MountEntry(null, fs_entry.mount_point, fs_entry.options));
1441
if (mnt.mount_point == "/"){
1464
if (fs_entry.mount_point == "/"){
1442
1465
root_found = true;
1444
if (mnt.mount_point == "/boot"){
1467
if (fs_entry.mount_point == "/boot"){
1445
1468
boot_found = true;
1447
if (mnt.mount_point == "/home"){
1470
if (fs_entry.mount_point == "/home"){
1448
1471
home_found = true;
1452
1475
if (!root_found){
1476
log_debug("added null entry: /");
1453
1477
mount_list.add(new MountEntry(null, "/", "")); // add root entry
1456
1480
if (!boot_found){
1481
log_debug("added null entry: /boot");
1457
1482
mount_list.add(new MountEntry(null, "/boot", "")); // add boot entry
1460
1485
if (!home_found){
1486
log_debug("added null entry: /home");
1461
1487
mount_list.add(new MountEntry(null, "/home", "")); // add home entry