[rhel7-branch] Make network+repo defined in kickstart work
by Vratislav Podzimek
If a kickstart is fetched from a disk (or any other non-network device) and it
defines some network configuration, we need to setup such configuration in
dracut so that it can be used for fetching the root image. At the same time we
also need to make sure our netroot script works with the data gathered from such
kickstart.
Vratislav Podzimek (2):
Make our manual triggering on network in dracut work (#1082500)
Make sure we work with fresh data when trying to do netroot
dracut/anaconda-lib.sh | 5 ++++-
dracut/anaconda-netroot.sh | 6 ++++++
2 files changed, 10 insertions(+), 1 deletion(-)
--
2.1.0
8 years, 10 months
[anaconda][rhel7-branch/master][PATCH] Show an alternative prompt if a hub contains only a single spoke (#1199234)
by Martin Kolman
Otherwise it is not readily apparent that the user needs to press
1 to enter the single visible spoke.
This is currently most relevant for Initial Setup which shows only
the EULA spoke if user has already been created during the installation.
Resolves: rhbz#1199234
Signed-off-by: Martin Kolman <mkolman(a)redhat.com>
---
pyanaconda/ui/tui/hubs/__init__.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/pyanaconda/ui/tui/hubs/__init__.py b/pyanaconda/ui/tui/hubs/__init__.py
index e89bf71..525b68e 100644
--- a/pyanaconda/ui/tui/hubs/__init__.py
+++ b/pyanaconda/ui/tui/hubs/__init__.py
@@ -114,3 +114,22 @@ class TUIHub(TUIObject, common.Hub):
print(_("Please complete all spokes before continuing"))
return False
return key
+
+ def prompt(self, args=None):
+ """Show an alternative prompt if the hub contains only one spoke.
+ Otherwise it is not readily apparent that the user needs to press
+ 1 to enter the single visible spoke.
+
+ :param args: optional argument passed from switch_screen calls
+ :type args: anything
+
+ :return: returns text to be shown next to the prompt for input or None
+ to skip further input processing
+ :rtype: str|None
+ """
+ if self._spoke_count == 1:
+ single_spoke_title = self._spokes.values()[0].title
+ return _(u" Please make your choice from [ '1' to enter the %s spoke | 'q' to quit |\n"
+ " 'c' to continue | 'r' to refresh]: " % single_spoke_title)
+ else:
+ return super(TUIHub, self).prompt(args)
--
2.4.3
8 years, 10 months
[initial-setup][rhel7-branch][PATCH 0/3] Externally triggered reconfig mode
by Martin Kolman
This patch set adds initial support for running Initial setup in an externally triggered reconfig mode.
It's making use of the already preset reconfig mode (used for example on Fedora ARM images) that can
be enabled from kickstart but makes it possible to trigger it externally without the need to touch
the kickstart generated by Anaconda.
How to use this:
1) touch /etc/reconfigSys
2) systemctl enable initial-setup-graphical.service
3) reboot
4) reconfigure your system
5) click on the "finish configuration" button
6) reboot
Why "/etc/reconfigSys" ?
Looks like we have been using this file some time in the past[0] to trigger a system reconfiguration,
so I've decided to reuse the same path.
[0] http://web.mit.edu/~linux/rh-7.1/src/cmu_installer/anaconda-7.1/docs/reco...
Martin Kolman (3):
Add support for externally triggered reconfig mode (#1110439)
Read the kickstart from previous IS if available (#1110439)
Don't show the EULA spoke in reconfig mode if license is already
accepted (#1110439)
initial_setup/__main__.py | 35 +++++++++++++++++++++++++++++++++--
initial_setup/gui/spokes/eula.py | 7 ++++++-
2 files changed, 39 insertions(+), 3 deletions(-)
--
2.4.3
8 years, 10 months
[RHEL7.2 - PATCH 2 of 2] Enable Custom GRUB2 Password Utility (#985962)
by Robert Marshall
Changes the output of the GRUB2 password selection to output
the encrypted and hashed password to a file in /boot/grub2.
Code change depends on the commit in GRUB2 that adds the
friendly GRUB2 password change utility.
Resolves: rhbz#985962
---
pyanaconda/bootloader.py | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 2e1f8ec..5a9d1ce 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -1393,6 +1393,7 @@ class GRUB2(GRUB):
packages = ["grub2"]
_config_file = "grub.cfg"
_config_dir = "grub2"
+ _passwd_file = "user.cfg"
defaults_file = "/etc/default/grub"
terminal_type = "console"
@@ -1522,17 +1523,13 @@ class GRUB2(GRUB):
if not self.password and not self.encrypted_password:
return
- users_file = iutil.getSysroot() + "/etc/grub.d/01_users"
+ # don't like using hard coded /boot/grub2/ - better call here?
+ users_file = iutil.getSysroot() + "/boot/grub2/" + self._passwd_file
header = open(users_file, "w")
- header.write("#!/bin/sh -e\n\n")
- header.write("cat << \"EOF\"\n")
# XXX FIXME: document somewhere that the username is "root"
- header.write("set superusers=\"root\"\n")
- header.write("export superusers\n")
self._encrypt_password()
- password_line = "password_pbkdf2 root " + self.encrypted_password
+ password_line = "GRUB2_PASSWORD=" + self.encrypted_password
header.write("%s\n" % password_line)
- header.write("EOF\n")
header.close()
iutil.eintr_retry_call(os.chmod, users_file, 0o700)
--
1.8.3.1
8 years, 10 months
[RHEL7.2 - PATCH 1 of 2] Add friendly grub2 password config tool (#985962)
by Robert Marshall
Provided a tool for users to reset the grub2 root user password
without having to alter the grub.cfg. The hashed password now
lives in a root-only-readable configuration file.
Resolves: rhbz#985962
---
Makefile.util.def | 13 ++++++
configure.ac | 1 +
util/grub-setpassword.in | 105 +++++++++++++++++++++++++++++++++++++++++++++++
util/grub.d/01_users.in | 11 +++++
4 files changed, 130 insertions(+)
create mode 100755 util/grub-setpassword.in
create mode 100644 util/grub.d/01_users.in
diff --git a/Makefile.util.def b/Makefile.util.def
index 3ac7572..e2821a2 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -438,6 +438,12 @@ script = {
};
script = {
+ name = '01_users';
+ common = util/grub.d/01_users.in;
+ installdir = grubconf;
+};
+
+script = {
name = '10_windows';
common = util/grub.d/10_windows.in;
installdir = grubconf;
@@ -713,6 +719,13 @@ script = {
};
script = {
+ name = grub-setpassword;
+ common = util/grub-setpassword.in;
+ mansection = 8;
+ installdir = sbin;
+};
+
+script = {
name = grub-mkconfig_lib;
common = util/grub-mkconfig_lib.in;
installdir = noinst;
diff --git a/configure.ac b/configure.ac
index 671bf49..e4f6934 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath])
grub_TRANSFORM([grub-mkrescue])
grub_TRANSFORM([grub-probe])
grub_TRANSFORM([grub-reboot])
+grub_TRANSFORM([grub-setpassword])
grub_TRANSFORM([grub-rpm-sort])
grub_TRANSFORM([grub-script-check])
grub_TRANSFORM([grub-set-default])
diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in
new file mode 100755
index 0000000..fc0ccf1
--- /dev/null
+++ b/util/grub-setpassword.in
@@ -0,0 +1,105 @@
+#!/bin/sh -e
+
+grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
+PACKAGE_VERSION="@PACKAGE_VERSION@"
+PACKAGE_NAME="@PACKAGE_NAME@"
+self=`basename $0`
+
+# Usage: usage
+# Print the usage.
+usage () {
+ cat <<EOF
+Usage: $0 [OPTION] [SOURCE]
+Run GRUB script in a Qemu instance.
+
+ -h, --help print this message and exit
+ -v, --version print the version information and exit
+ -o, --output_path choose a custom output path for user.cfg
+
+$0 prompts the user to set a password on the grub bootloader. The password
+is written to a file named user.cfg.
+
+Report bugs at https://bugzilla.redhat.com.
+EOF
+}
+
+argument () {
+ opt=$1
+ shift
+
+ if test $# -eq 0; then
+ gettext_printf "%s: option requires an argument -- \`%s'\n" "$self" "$opt" 1>&2
+ exit 1
+ fi
+ echo $1
+}
+
+# Ensure that it's the root user running this script
+if [ "${EUID}" -ne 0 ]; then
+ echo "The grub bootloader password may only be set by root."
+ usage
+ exit 2
+fi
+
+# Check the arguments.
+while test $# -gt 0
+do
+ option=$1
+ shift
+
+ case "$option" in
+ -h | --help)
+ usage
+ exit 0 ;;
+ -v | --version)
+ echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
+ exit 0 ;;
+ -o | --output)
+ OUTPUT_PATH=`argument $option "$@"`; shift ;;
+ --output=*)
+ OUTPUT_PATH=`echo "$option" | sed 's/--output=//'` ;;
+ -o=*)
+ OUTPUT_PATH=`echo "$option" | sed 's/-o=//'` ;;
+ esac
+done
+
+# set user input or default path for user.cfg file
+if [ -z "${OUTPUT_PATH}" ]; then
+ OUTPUT_PATH="${grubdir}"
+fi
+
+if [ ! -d "${OUTPUT_PATH}" ]; then
+ echo "${OUTPUT_PATH} does not exist."
+ usage
+ exit 2;
+fi
+
+ttyopt=$(stty -g)
+stty -echo
+# prompt & confirm new grub2 root user password
+echo -n "Enter password: "
+read PASSWORD
+echo
+echo -n "Confirm password: "
+read PASSWORD_CONFIRM
+echo
+stty ${ttyopt}
+
+# Capture Tool Output
+MYPASS=$(( echo "${PASSWORD}" ; echo "${PASSWORD_CONFIRM}" ) | \
+ /usr/bin/grub2-mkpasswd-pbkdf2 2>&1 | \
+ grep -v "[eE]nter password:" | \
+ sed -e "s/PBKDF2 hash of your password is //")
+# Handle tool errors
+if ERROR_CHECK=$(echo "${MYPASS}" | grep -o "error: .*") ; then
+ echo "${ERROR_CHECK}"
+elif [ -n "${MYPASS}" ]; then
+ echo "GRUB2_PASSWORD=${MYPASS}" 2>&1 > "${grubdir}/user.cfg"
+ echo "The bootloader password has been set."
+ exit 0
+else
+ echo "Unhandled error."
+fi
+
+# If the password file wasn't created, then it's an error state
+exit 1
diff --git a/util/grub.d/01_users.in b/util/grub.d/01_users.in
new file mode 100644
index 0000000..facd409
--- /dev/null
+++ b/util/grub.d/01_users.in
@@ -0,0 +1,11 @@
+#!/bin/sh -e
+cat << EOF
+if [ -f \${prefix}/user.cfg ]; then
+ source \${prefix}/user.cfg
+ if [ -n \${GRUB2_PASSWORD} ]; then
+ set superusers="root"
+ export superusers
+ password_pbkdf2 root \${GRUB2_PASSWORD}
+ fi
+fi
+EOF
--
1.8.3.1
8 years, 10 months
[blivet][rhel7-branch] Tear down devices recursively when finding existing installations
by Vratislav Podzimek
When trying to find existing installations we setup and mount devices (to check
if they have /etc/fstab). Setting a device up results in its parents being setup
too (recursively) so when tearing the device down we should also tear its
parents (recursively) down so that they are not left activated as that could
cause problems later (as for example in the bug where a thin pool was
activated/setup on setup of a thin LV and never deactivated/torn down).
Resolves: rhbz#1182229
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
blivet/__init__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 47cb1dd..9c8bfac 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -3000,7 +3000,7 @@ def findExistingInstallations(devicetree):
device.format.mount(options=options, mountpoint=getSysroot())
except Exception: # pylint: disable=broad-except
log_exception_info(log.warning, "mount of %s as %s failed", [device.name, device.format.type])
- device.teardown()
+ device.teardown(recursive=True)
continue
if not os.access(getSysroot() + "/etc/fstab", os.R_OK):
@@ -3021,7 +3021,7 @@ def findExistingInstallations(devicetree):
{"product": product, "version": version, "arch": architecture}
(mounts, swaps) = parseFSTab(devicetree, chroot=_sysroot)
- device.teardown()
+ device.teardown(recursive=True)
if not mounts and not swaps:
# empty /etc/fstab. weird, but I've seen it happen.
continue
--
2.1.0
8 years, 10 months
[PATCH] There's a python3 anaconda now, so ditch the temporary false positives.
by Chris Lumens
---
tests/pylint/runpylint.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/tests/pylint/runpylint.py b/tests/pylint/runpylint.py
index 64badd4..558297f 100755
--- a/tests/pylint/runpylint.py
+++ b/tests/pylint/runpylint.py
@@ -17,11 +17,7 @@ class BlivetLintConfig(PocketLintConfig):
FalsePositive(r"Method 'doTask' is abstract in class 'Task' but is not overridden"),
FalsePositive(r"Method 'doTask' is abstract in class 'UnimplementedTask' but is not overridden"),
FalsePositive(r"No value for argument 'member_count' in unbound method call$"),
- FalsePositive(r"No value for argument 'smallest_member_size' in unbound method call$"),
-
- # FIXME: These are temporary, until there's a python3 anaconda.
- FalsePositive(r"Unable to import 'pyanaconda'$"),
- FalsePositive(r"Unable to import 'pyanaconda.*'$"),
+ FalsePositive(r"No value for argument 'smallest_member_size' in unbound method call$")
]
@property
--
2.4.3
8 years, 10 months