[unmount] merge with upstream master branch

This commit is contained in:
Philip 2018-01-14 15:53:41 -05:00
parent 78671a1547
commit 666ea16303
3 changed files with 50 additions and 28 deletions

View File

@ -1,18 +0,0 @@
### Umount Module
---------
This module represents the last part of the installation, the unmounting of partitions used for the install. It is also the last place where it is possible to copy files to the target system, thus the best place to copy an installation log.
You can either use the default ```/root/.cache/Calamares/Calamares/Calamares.log```
to copy or if you want to use the full output of ```sudo calamares -d``` to create a log you will need to include a log creation to your launcher script or add it to the used calamares.desktop, example of a launcher script:
```
#!/bin/sh
sudo /usr/bin/calamares -d > installation.log
```
Example desktop line:
```
Exec=sudo /usr/bin/calamares -d > installation.log
```
Set the source and destination path of your install log in umount.conf.
If you do not wish to use the copy of an install log feature, no action needed, the default settings do not execute the copy of an install log in this module.

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
# === This file is part of Calamares - <https://github.com/calamares> ===
#
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
# Copyright 2016, Anke Boersma <demm@kaosx.us>
@ -55,11 +55,18 @@ def run():
"destLog" in libcalamares.job.configuration):
log_source = libcalamares.job.configuration["srcLog"]
log_destination = libcalamares.job.configuration["destLog"]
# Relocate log_destination into target system
log_destination = '{!s}/{!s}'.format(root_mount_point, log_destination)
# Make sure source is a string
log_source = '{!s}'.format(log_source)
# copy installation log before umount
if os.path.exists('{!s}'.format(log_source)):
shutil.copy2('{!s}'.format(log_source), '{!s}/{!s}'.format(
root_mount_point, log_destination))
if os.path.exists(log_source):
try:
shutil.copy2(log_source, log_destination)
except Exception as e:
libcalamares.utils.debug("WARNING Could not preserve file {!s}, "
"error {!s}".format(log_source, e))
if not root_mount_point:
return ("No mount point for root partition in globalstorage",

View File

@ -1,9 +1,42 @@
### Umount Module
#
# This module represents the last part of the installation, the unmounting
# of partitions used for the install. It is also the last place where it
# is possible to copy files to the target system, thus the best place to
# copy an installation log.
#
# This module has two configuration keys:
# srcLog location in the live system where the log is
# destLog location in the target system to copy the log
#
# You can either use the default source path (which is
# `/root/.cache/Calamares/Calamares/Calamares.log` ) to copy the regular log,
# or if you want to use the full output of `sudo calamares -d` you will need
# to redirect standard output, for instance in a launcher script or
# in the desktop file.
#
# Example launcher script:
#
# ```
# #!/bin/sh
# sudo /usr/bin/calamares -d > installation.log
# ```
#
# Example desktop line:
#
# ```
# Exec=sudo /usr/bin/calamares -d > installation.log
# ```
#
# If no source and destination are set, no copy is attempted. If the
# copy fails for some reason, a warning is printed but the installation
# does not fail.
---
#srcLog: "/path/to/installation.log"
#destLog: "/var/log/installation.log"
# example when using the Calamares created log:
#srcLog: "/root/.cache/Calamares/Calamares/Calamares.log"
#destLog: "/var/log/Calamares.log"
# example when creating with a sudo calamares -d log:
# example when using the normal Calamares log:
srcLog: "/root/.cache/Calamares/Calamares/Calamares.log"
destLog: "/var/log/Calamares.log"
# example when using a log created by `sudo calamares -d`:
#srcLog: "/home/live/installation.log"
#destLog: "/var/log/installation.log"