Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinstall While Retaining Home #95

Merged
merged 38 commits into from May 22, 2018
Merged

Reinstall While Retaining Home #95

merged 38 commits into from May 22, 2018

Conversation

mmstick
Copy link
Member

@mmstick mmstick commented May 10, 2018

What has changed

  • A new distinst_install_options_new() method is exposed in the C API.
    • When supplied with a reference to a Disks, it will create multiple lists of install options.
    • Those options may then be used within an InstallOption to apply the option to a Disks.
    • A RecoveryOption can be used to perform a recovery install
    • A RefreshOption can install onto and reuse partitions from an existing install, and thereby be used to perform a factory reset, refresh retaining user accounts, or upgrades
    • A EraseOption will erase an entire disk and install with a default configuration, either encrypted or unencrypted
  • When config.old_root is set, an install will retain home.
    • This will require that the partition where /home exists in Disks is not set to be formatted.
    • It will also require that an existing / partition was specified in Config.
    • A different / partition with a different filesystem may be specified, but only if /home is on a separate partition and is not set to be formatted.
    • User accounts will be backed up based on the contents of /home, from /etc/passwd, /etc/group, etc/shadow, and etc/gshadow.
    • The user account will be based on the home field in /etc/passwd.
    • The user group will be based on the group ID field in /etc/passwd.
    • This method will do the install after backing up the user account info.
    • Then on post-install, it will append them to the new install.
    • The /etc/timezone & /etc/localtime settings will also be restored.
    • NetworkManager network connections will also be restored.
  • Small improvement to DiskOps so that physical devices within Disks will not go through the process of executing disk operations.
  • Some changes to use unowned uint8[] in the C/Vala API instead of string where possible.
  • A new device_map_exists() function for the C/Vala API, to be used in the decrypt menu
  • A new device_layout_hash() function can be used to know when to reload devices & options

What the frontend will need to do

  • A view for allowing the user to select from a list of installation options
  • Ability to decrypt existing LUKS devices to detect more installation options
  • An erase option will simply apply the default disk configuration
  • A refresh option can either be a reset to wipe user accounts and files, or retain them

Install options to support?

  • Fresh install (wipe the disk & install with default config)
  • Refresh (reinstall while retaining home & user accounts)
  • Reset (reinstall without retaining home or user accounts)
  • Custom install

@mmstick
Copy link
Member Author

mmstick commented May 16, 2018

I have just succeeded in doing a reinstall which retained user accounts (passwords & data).

cargo build --release --examples
sudo target/release/examples/default-install erase $DEVICE

# Reboot and create account, then reboot back

sudo target/release/examples/default-install retain

# Select discovered device on $DEVICE, then reboot and try to log in

@mmstick
Copy link
Member Author

mmstick commented May 17, 2018

I believe this is ready for review now.

@jackpot51 jackpot51 requested review from jackpot51 and brs17 May 18, 2018 16:34
@@ -141,6 +141,42 @@ pub unsafe extern "C" fn distinst_installer_on_status(

/// Install using this installer
#[no_mangle]
pub unsafe extern "C" fn distinst_installer_install_and_retain_home(
Copy link
Member

@jackpot51 jackpot51 May 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps retain_home should be added to the config? Maybe as a flag?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try that

Copy link
Member

@jackpot51 jackpot51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I like this better with the config option

- If config.old_root is set, then an install will be performed which retains home
Checks if the given name already exists as a device in the device map
@jackpot51
Copy link
Member

Is this ready to merge @mmstick ?

@mmstick mmstick merged commit 497de11 into master_bionic May 22, 2018
@mmstick
Copy link
Member Author

mmstick commented May 22, 2018

@jackpot51 Yes, it is ready. I'll be adding more PRs in the future to improve it further.

@jackpot51 jackpot51 deleted the autoinstall branch May 22, 2018 19:10
@jackpot51
Copy link
Member

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants