parent
298a711fe6
commit
c2068dfc11
@ -0,0 +1,440 @@
|
|||||||
|
diff --git a/usr/share/rear/rescue/NBU/default/460_prepare_netbackup_systemd.sh b/usr/share/rear/rescue/NBU/default/460_prepare_netbackup_systemd.sh
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..f7423e0a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/usr/share/rear/rescue/NBU/default/460_prepare_netbackup_systemd.sh
|
||||||
|
@@ -0,0 +1,41 @@
|
||||||
|
+# 460_prepare_netbackup_systemd.sh
|
||||||
|
+# prepare systemd units for NBU (only if NBU version >=7.x)
|
||||||
|
+
|
||||||
|
+# set in 450_prepare_netbackup.sh
|
||||||
|
+[[ $NBU_version -lt 7 ]] && return # NBU is using xinetd when version <7.x
|
||||||
|
+
|
||||||
|
+# Skip if systemd is not used.
|
||||||
|
+has_binary systemctl || return 0
|
||||||
|
+
|
||||||
|
+# Local functions that are 'unset' at the end of this script:
|
||||||
|
+
|
||||||
|
+function get_unit_path () {
|
||||||
|
+ systemctl show -P FragmentPath $1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+function get_unit_dropin_paths () {
|
||||||
|
+ systemctl show -P DropInPaths $1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+local unit_file_path
|
||||||
|
+local i
|
||||||
|
+local unit
|
||||||
|
+
|
||||||
|
+for unit in vxpbx_exchanged.service netbackup.service ; do
|
||||||
|
+ unit_file_path="$( get_unit_path $unit )"
|
||||||
|
+ if [ -n "$unit_file_path" ]; then
|
||||||
|
+ cp $v "$unit_file_path" $ROOTFS_DIR/etc/systemd/system
|
||||||
|
+ ln -s ../$unit $ROOTFS_DIR/etc/systemd/system/default.target.wants || Error "Failed to enable Netbackup service $unit in the rescue system"
|
||||||
|
+ Log "Enabled Netbackup service $unit in the rescue system"
|
||||||
|
+ for i in $( get_unit_dropin_paths $unit ) ; do
|
||||||
|
+ mkdir -p $ROOTFS_DIR/etc/systemd/system/$unit.d
|
||||||
|
+ cp $v $i $ROOTFS_DIR/etc/systemd/system/$unit.d
|
||||||
|
+ done
|
||||||
|
+ fi
|
||||||
|
+done
|
||||||
|
+
|
||||||
|
+# Local functions must be 'unset' because bash does not support 'local function ...'
|
||||||
|
+# cf. https://unix.stackexchange.com/questions/104755/how-can-i-create-a-local-function-in-my-bashrc
|
||||||
|
+unset -f get_unit_path
|
||||||
|
+unset -f get_unit_dropin_paths
|
||||||
|
+unset -f unit_is_enabled
|
||||||
|
diff --git a/usr/share/rear/skel/default/etc/scripts/run-automatic-rear b/usr/share/rear/skel/default/etc/scripts/run-automatic-rear
|
||||||
|
new file mode 100755
|
||||||
|
index 00000000..6edc657a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/usr/share/rear/skel/default/etc/scripts/run-automatic-rear
|
||||||
|
@@ -0,0 +1,82 @@
|
||||||
|
+#!/bin/bash
|
||||||
|
+
|
||||||
|
+source /etc/scripts/system-setup-functions.sh
|
||||||
|
+
|
||||||
|
+# In debug mode run the automated 'rear recover' also with debug options.
|
||||||
|
+# Because the kernel command line option 'debug' means 'set -x' for the system setup scripts
|
||||||
|
+# it also means '-D' (i.e. 'set -x') for the automated 'rear recover' run:
|
||||||
|
+if rear_debug ; then
|
||||||
|
+ rear_debug_options='-D'
|
||||||
|
+else
|
||||||
|
+ rear_debug_options=''
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+# Launch rear recover automatically:
|
||||||
|
+if automatic_recovery ; then
|
||||||
|
+ choices=( "View Relax-and-Recover log file(s)"
|
||||||
|
+ "Go to Relax-and-Recover shell"
|
||||||
|
+ )
|
||||||
|
+ echo -e "\nLaunching 'rear recover' automatically\n"
|
||||||
|
+ if rear $rear_debug_options recover ; then
|
||||||
|
+ echo -e "\n'rear recover' finished successfully\n"
|
||||||
|
+ choices+=( "Reboot" )
|
||||||
|
+ else
|
||||||
|
+ echo -e "\n'rear recover' failed, check the Relax-and-Recover log file(s)\n"
|
||||||
|
+ fi
|
||||||
|
+ PS3="Select what to do "
|
||||||
|
+ select choice in "${choices[@]}" ; do
|
||||||
|
+ case "$REPLY" in
|
||||||
|
+ (1)
|
||||||
|
+ # Do not assume the ReaR log file is named rear-$HOSTNAME.log
|
||||||
|
+ # the user can have specified any name as LOGFILE:
|
||||||
|
+ less /var/log/rear/*
|
||||||
|
+ ;;
|
||||||
|
+ (2)
|
||||||
|
+ echo "" > /etc/issue
|
||||||
|
+ echo "" > /etc/motd
|
||||||
|
+ break
|
||||||
|
+ ;;
|
||||||
|
+ (3)
|
||||||
|
+ reboot
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+ for (( i=1 ; i <= ${#choices[@]} ; i++ )) ; do
|
||||||
|
+ echo "$i) ${choices[$i-1]}"
|
||||||
|
+ done
|
||||||
|
+ done 2>&1
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+# Launch rear recover automatically in unattended mode
|
||||||
|
+# i.e. with automated reboot after successful 'rear recover':
|
||||||
|
+if unattended_recovery ; then
|
||||||
|
+ choices=( "View Relax-and-Recover log file(s)"
|
||||||
|
+ "Go to Relax-and-Recover shell"
|
||||||
|
+ )
|
||||||
|
+ echo -e "\nLaunching 'rear recover' automatically in unattended mode\n"
|
||||||
|
+ if rear $rear_debug_options recover ; then
|
||||||
|
+ echo -e "\n'rear recover' finished successfully\n"
|
||||||
|
+ echo -e "\nRebooting in 30 seconds (Ctrl-C to interrupt)\n"
|
||||||
|
+ sleep 30
|
||||||
|
+ reboot
|
||||||
|
+ else
|
||||||
|
+ echo -e "\n'rear recover' failed, check the Relax-and-Recover log file(s)\n"
|
||||||
|
+ PS3="Select what to do "
|
||||||
|
+ select choice in "${choices[@]}" ; do
|
||||||
|
+ case "$REPLY" in
|
||||||
|
+ (1)
|
||||||
|
+ # Do not assume the ReaR log file is named rear-$HOSTNAME.log
|
||||||
|
+ # the user can have specified any name as LOGFILE:
|
||||||
|
+ less /var/log/rear/*
|
||||||
|
+ ;;
|
||||||
|
+ (2)
|
||||||
|
+ echo "" > /etc/issue
|
||||||
|
+ echo "" > /etc/motd
|
||||||
|
+ break
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+ for (( i=1 ; i <= ${#choices[@]} ; i++ )) ; do
|
||||||
|
+ echo "$i) ${choices[$i-1]}"
|
||||||
|
+ done
|
||||||
|
+ done 2>&1
|
||||||
|
+ fi
|
||||||
|
+fi
|
||||||
|
diff --git a/usr/share/rear/skel/default/etc/scripts/system-setup b/usr/share/rear/skel/default/etc/scripts/system-setup
|
||||||
|
index 1dc7f1e8..17487ac7 100755
|
||||||
|
--- a/usr/share/rear/skel/default/etc/scripts/system-setup
|
||||||
|
+++ b/usr/share/rear/skel/default/etc/scripts/system-setup
|
||||||
|
@@ -9,36 +9,7 @@
|
||||||
|
# (e.g. "ls foo*bar" becomes plain "ls" without "foo*bar: No such file or directory" error).
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
|
-# Use an artificial array to get the kernel command line parameters as array elements
|
||||||
|
-kernel_command_line=( $( cat /proc/cmdline ) )
|
||||||
|
-
|
||||||
|
-function rear_debug() {
|
||||||
|
- for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
|
||||||
|
- test "debug" = "$kernel_command_line_parameter" && return 0
|
||||||
|
- done
|
||||||
|
- return 1
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-function unattended_recovery() {
|
||||||
|
- for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
|
||||||
|
- test "unattended" = "$kernel_command_line_parameter" && return 0
|
||||||
|
- done
|
||||||
|
- return 1
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-function automatic_recovery() {
|
||||||
|
- # The unattended recovery mode implies automatic recovery (see the implementations below)
|
||||||
|
- # so that in unattended mode the automatic recovery code below must not be run
|
||||||
|
- # otherwise first the automatic recovery code and then the unattended recovery code
|
||||||
|
- # get run automatically one after the other where the unattended recovery fails
|
||||||
|
- # because for two subsequent 'rear recover' the second one fails:
|
||||||
|
- unattended_recovery && return 1
|
||||||
|
- for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
|
||||||
|
- test "auto_recover" = "$kernel_command_line_parameter" && return 0
|
||||||
|
- test "automatic" = "$kernel_command_line_parameter" && return 0
|
||||||
|
- done
|
||||||
|
- return 1
|
||||||
|
-}
|
||||||
|
+source /etc/scripts/system-setup-functions.sh
|
||||||
|
|
||||||
|
# The 'sleep 1' is used as workaround to avoid whatever inexplicable actual reason
|
||||||
|
# that at least on SLES12 some initial output lines of this script would get lost
|
||||||
|
@@ -135,84 +106,3 @@ echo -e "\nRelax-and-Recover rescue system is ready\n"
|
||||||
|
# Wait two seconds so that the user can read the 'Relax-and-Recover rescue system is ready' message
|
||||||
|
# on his screen before the screen gets cleared and replaced by the login screen:
|
||||||
|
sleep 2
|
||||||
|
-
|
||||||
|
-# In debug mode run the automated 'rear recover' also with debug options.
|
||||||
|
-# Because the kernel command line option 'debug' means 'set -x' for the system setup scripts
|
||||||
|
-# it also means '-D' (i.e. 'set -x') for the automated 'rear recover' run:
|
||||||
|
-if rear_debug ; then
|
||||||
|
- rear_debug_options='-D'
|
||||||
|
-else
|
||||||
|
- rear_debug_options=''
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-# Launch rear recover automatically:
|
||||||
|
-if automatic_recovery ; then
|
||||||
|
- choices=( "View Relax-and-Recover log file(s)"
|
||||||
|
- "Go to Relax-and-Recover shell"
|
||||||
|
- )
|
||||||
|
- echo -e "\nLaunching 'rear recover' automatically\n"
|
||||||
|
- # The recover workflow is always verbose (see usr/sbin/rear):
|
||||||
|
- if rear $rear_debug_options recover ; then
|
||||||
|
- echo -e "\n'rear recover' finished successfully\n"
|
||||||
|
- choices+=( "Reboot" )
|
||||||
|
- else
|
||||||
|
- echo -e "\n'rear recover' failed, check the Relax-and-Recover log file(s)\n"
|
||||||
|
- fi
|
||||||
|
- PS3="Select what to do "
|
||||||
|
- select choice in "${choices[@]}" ; do
|
||||||
|
- case "$REPLY" in
|
||||||
|
- (1)
|
||||||
|
- # Do not assume the ReaR log file is named rear-$HOSTNAME.log
|
||||||
|
- # the user can have specified any name as LOGFILE:
|
||||||
|
- less /var/log/rear/*
|
||||||
|
- ;;
|
||||||
|
- (2)
|
||||||
|
- echo "" > /etc/issue
|
||||||
|
- echo "" > /etc/motd
|
||||||
|
- break
|
||||||
|
- ;;
|
||||||
|
- (3)
|
||||||
|
- reboot
|
||||||
|
- ;;
|
||||||
|
- esac
|
||||||
|
- for (( i=1 ; i <= ${#choices[@]} ; i++ )) ; do
|
||||||
|
- echo "$i) ${choices[$i-1]}"
|
||||||
|
- done
|
||||||
|
- done 2>&1
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-# Launch rear recover automatically in unattended mode
|
||||||
|
-# i.e. with automated reboot after successful 'rear recover':
|
||||||
|
-if unattended_recovery ; then
|
||||||
|
- choices=( "View Relax-and-Recover log file(s)"
|
||||||
|
- "Go to Relax-and-Recover shell"
|
||||||
|
- )
|
||||||
|
- echo -e "\nLaunching 'rear recover' automatically in unattended mode\n"
|
||||||
|
- # The recover workflow is always verbose (see usr/sbin/rear):
|
||||||
|
- if rear $rear_debug_options recover ; then
|
||||||
|
- echo -e "\n'rear recover' finished successfully\n"
|
||||||
|
- echo -e "\nRebooting in 30 seconds (Ctrl-C to interrupt)\n"
|
||||||
|
- sleep 30
|
||||||
|
- reboot
|
||||||
|
- else
|
||||||
|
- echo -e "\n'rear recover' failed, check the Relax-and-Recover log file(s)\n"
|
||||||
|
- PS3="Select what to do "
|
||||||
|
- select choice in "${choices[@]}" ; do
|
||||||
|
- case "$REPLY" in
|
||||||
|
- (1)
|
||||||
|
- # Do not assume the ReaR log file is named rear-$HOSTNAME.log
|
||||||
|
- # the user can have specified any name as LOGFILE:
|
||||||
|
- less /var/log/rear/*
|
||||||
|
- ;;
|
||||||
|
- (2)
|
||||||
|
- echo "" > /etc/issue
|
||||||
|
- echo "" > /etc/motd
|
||||||
|
- break
|
||||||
|
- ;;
|
||||||
|
- esac
|
||||||
|
- for (( i=1 ; i <= ${#choices[@]} ; i++ )) ; do
|
||||||
|
- echo "$i) ${choices[$i-1]}"
|
||||||
|
- done
|
||||||
|
- done 2>&1
|
||||||
|
- fi
|
||||||
|
-fi
|
||||||
|
diff --git a/usr/share/rear/skel/default/etc/scripts/system-setup-functions.sh b/usr/share/rear/skel/default/etc/scripts/system-setup-functions.sh
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..c320cf88
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/usr/share/rear/skel/default/etc/scripts/system-setup-functions.sh
|
||||||
|
@@ -0,0 +1,30 @@
|
||||||
|
+# Use an artificial array to get the kernel command line parameters as array elements
|
||||||
|
+kernel_command_line=( $( cat /proc/cmdline ) )
|
||||||
|
+
|
||||||
|
+function rear_debug() {
|
||||||
|
+ for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
|
||||||
|
+ test "debug" = "$kernel_command_line_parameter" && return 0
|
||||||
|
+ done
|
||||||
|
+ return 1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+function unattended_recovery() {
|
||||||
|
+ for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
|
||||||
|
+ test "unattended" = "$kernel_command_line_parameter" && return 0
|
||||||
|
+ done
|
||||||
|
+ return 1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+function automatic_recovery() {
|
||||||
|
+ # The unattended recovery mode implies automatic recovery (see the implementations below)
|
||||||
|
+ # so that in unattended mode the automatic recovery code below must not be run
|
||||||
|
+ # otherwise first the automatic recovery code and then the unattended recovery code
|
||||||
|
+ # get run automatically one after the other where the unattended recovery fails
|
||||||
|
+ # because for two subsequent 'rear recover' the second one fails:
|
||||||
|
+ unattended_recovery && return 1
|
||||||
|
+ for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
|
||||||
|
+ test "auto_recover" = "$kernel_command_line_parameter" && return 0
|
||||||
|
+ test "automatic" = "$kernel_command_line_parameter" && return 0
|
||||||
|
+ done
|
||||||
|
+ return 1
|
||||||
|
+}
|
||||||
|
diff --git a/usr/share/rear/skel/default/etc/systemd/system/default.target.wants/.gitignore b/usr/share/rear/skel/default/etc/systemd/system/default.target.wants/.gitignore
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..d6b7ef32
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/usr/share/rear/skel/default/etc/systemd/system/default.target.wants/.gitignore
|
||||||
|
@@ -0,0 +1,2 @@
|
||||||
|
+*
|
||||||
|
+!.gitignore
|
||||||
|
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/automatic-rear.service b/usr/share/rear/skel/default/usr/lib/systemd/system/automatic-rear.service
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..ee3187a8
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/automatic-rear.service
|
||||||
|
@@ -0,0 +1,13 @@
|
||||||
|
+[Unit]
|
||||||
|
+Description=Run Relax-and-Recover recovery automatically if requested
|
||||||
|
+Wants=network-online.target
|
||||||
|
+After=network-online.target
|
||||||
|
+
|
||||||
|
+[Service]
|
||||||
|
+Type=oneshot
|
||||||
|
+ExecStart=/etc/scripts/run-automatic-rear
|
||||||
|
+StandardInput=tty
|
||||||
|
+RemainAfterExit=yes
|
||||||
|
+
|
||||||
|
+[Install]
|
||||||
|
+WantedBy=multi-user.target
|
||||||
|
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/getty@.service b/usr/share/rear/skel/default/usr/lib/systemd/system/getty@.service
|
||||||
|
index bf858ca8..abafd8b5 100644
|
||||||
|
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/getty@.service
|
||||||
|
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/getty@.service
|
||||||
|
@@ -6,6 +6,8 @@ Description=Getty on %I
|
||||||
|
Documentation=man:agetty(8)
|
||||||
|
After=systemd-user-sessions.service plymouth-quit-wait.service
|
||||||
|
After=sysinit.service
|
||||||
|
+# Automatic ReaR uses the system console
|
||||||
|
+After=automatic-rear.service
|
||||||
|
|
||||||
|
# If additional gettys are spawned during boot then we should make
|
||||||
|
# sure that this is synchronized before getty.target, even though
|
||||||
|
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target b/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target
|
||||||
|
index c5ea1cca..a88e219f 100644
|
||||||
|
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target
|
||||||
|
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Multi-User
|
||||||
|
-Requires=sysinit.target
|
||||||
|
+Requires=sysinit.target basic.target
|
||||||
|
AllowIsolate=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target.wants/automatic-rear.service b/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target.wants/automatic-rear.service
|
||||||
|
new file mode 120000
|
||||||
|
index 00000000..3e8a4161
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target.wants/automatic-rear.service
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+../automatic-rear.service
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target b/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..c3edfeb4
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target
|
||||||
|
@@ -0,0 +1,14 @@
|
||||||
|
+# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
+#
|
||||||
|
+# This file is part of systemd.
|
||||||
|
+#
|
||||||
|
+# systemd is free software; you can redistribute it and/or modify it
|
||||||
|
+# under the terms of the GNU Lesser General Public License as published by
|
||||||
|
+# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+
|
||||||
|
+[Unit]
|
||||||
|
+Description=Network is Online
|
||||||
|
+Documentation=man:systemd.special(7)
|
||||||
|
+Documentation=https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
|
||||||
|
+After=network.target
|
||||||
|
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target.wants/sysinit.service b/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target.wants/sysinit.service
|
||||||
|
new file mode 120000
|
||||||
|
index 00000000..ed660a10
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target.wants/sysinit.service
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+../sysinit.service
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/rsyslog.service b/usr/share/rear/skel/default/usr/lib/systemd/system/rsyslog.service
|
||||||
|
index ac171e0f..18fa17b5 100644
|
||||||
|
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/rsyslog.service
|
||||||
|
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/rsyslog.service
|
||||||
|
@@ -1,6 +1,5 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Relax-and-Recover run-syslog script
|
||||||
|
-DefaultDependencies=no
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.service b/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.service
|
||||||
|
index ee22fafc..b34b2fe8 100644
|
||||||
|
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.service
|
||||||
|
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.service
|
||||||
|
@@ -1,9 +1,14 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Initialize Rescue System
|
||||||
|
-After=systemd-udevd.service
|
||||||
|
+DefaultDependencies=no
|
||||||
|
+After=systemd-udevd.service rear-boot-helper.service
|
||||||
|
+Before=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/etc/scripts/system-setup
|
||||||
|
StandardInput=tty
|
||||||
|
RemainAfterExit=yes
|
||||||
|
+
|
||||||
|
+[Install]
|
||||||
|
+WantedBy=network-online.target
|
||||||
|
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.target b/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.target
|
||||||
|
index 4187ef67..2a16369b 100644
|
||||||
|
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.target
|
||||||
|
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.target
|
||||||
|
@@ -4,3 +4,5 @@
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=System Initialization
|
||||||
|
+Wants=sysinit.service rear-boot-helper.service
|
||||||
|
+After=sysinit.service rear-boot-helper.service
|
||||||
|
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/syslog.socket b/usr/share/rear/skel/default/usr/lib/systemd/system/syslog.socket
|
||||||
|
index 9a0064c0..3fb02344 100644
|
||||||
|
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/syslog.socket
|
||||||
|
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/syslog.socket
|
||||||
|
@@ -4,7 +4,6 @@
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Syslog Socket
|
||||||
|
-DefaultDependencies=no
|
||||||
|
Before=sockets.target syslog.target
|
||||||
|
|
||||||
|
[Socket]
|
@ -0,0 +1,32 @@
|
|||||||
|
commit 4f03a10d4866efc9b6920a3878e6397d170742f9
|
||||||
|
Author: Johannes Meixner <jsmeix@suse.com>
|
||||||
|
Date: Thu Jul 20 15:11:52 2023 +0200
|
||||||
|
|
||||||
|
Merge pull request #3027 from rmetrich/shrinking_file
|
||||||
|
|
||||||
|
In build/GNU/Linux/100_copy_as_is.sh
|
||||||
|
ensure to really get all COPY_AS_IS files copied by using
|
||||||
|
'tar ... -i' when extracting to avoid a false regular exit of 'tar'
|
||||||
|
in particular when padding zeroes get added when a file being read shrinks
|
||||||
|
because for 'tar' (without '-i') two consecutive 512-blocks of zeroes mean EOF,
|
||||||
|
cf. https://github.com/rear/rear/pull/3027
|
||||||
|
|
||||||
|
diff --git a/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh b/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
|
||||||
|
index ec55f331..0e402b01 100644
|
||||||
|
--- a/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
|
||||||
|
+++ b/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
|
||||||
|
@@ -92,9 +92,13 @@ done >$copy_as_is_exclude_file
|
||||||
|
# COPY_AS_IS+=( /path/to/directory/* )
|
||||||
|
# which are used in our scripts and by users in their etc/rear/local.conf
|
||||||
|
# cf. https://github.com/rear/rear/pull/2405#issuecomment-633512932
|
||||||
|
+# Using '-i' when extracting is necessary to avoid a false regular exit of 'tar'
|
||||||
|
+# in particular when padding zeroes get added when a file being read shrinks
|
||||||
|
+# because for 'tar' (without '-i') two consecutive 512-blocks of zeroes mean EOF,
|
||||||
|
+# cf. https://github.com/rear/rear/pull/3027
|
||||||
|
# FIXME: The following code fails if file names contain characters from IFS (e.g. blanks),
|
||||||
|
# cf. https://github.com/rear/rear/issues/1372
|
||||||
|
-if ! tar -v -X $copy_as_is_exclude_file -P -C / -c ${COPY_AS_IS[*]} 2>$copy_as_is_filelist_file | tar $v -C $ROOTFS_DIR/ -x 1>/dev/null ; then
|
||||||
|
+if ! tar -v -X $copy_as_is_exclude_file -P -C / -c ${COPY_AS_IS[*]} 2>$copy_as_is_filelist_file | tar $v -C $ROOTFS_DIR/ -x -i 1>/dev/null ; then
|
||||||
|
Error "Failed to copy files and directories in COPY_AS_IS minus COPY_AS_IS_EXCLUDE"
|
||||||
|
fi
|
||||||
|
Log "Finished copying files and directories in COPY_AS_IS minus COPY_AS_IS_EXCLUDE"
|
@ -0,0 +1,25 @@
|
|||||||
|
commit 2aa7b47354bdf5863071c8b479d29c99aad05ecb
|
||||||
|
Author: Johannes Meixner <jsmeix@suse.com>
|
||||||
|
Date: Fri Jul 24 13:02:45 2020 +0200
|
||||||
|
|
||||||
|
Update 240_reassign_luks_keyfiles.sh
|
||||||
|
|
||||||
|
Use ReaR specific TMP_DIR (not TMPDIR or hardcoded /tmp)
|
||||||
|
|
||||||
|
diff --git a/usr/share/rear/finalize/GNU/Linux/240_reassign_luks_keyfiles.sh b/usr/share/rear/finalize/GNU/Linux/240_reassign_luks_keyfiles.sh
|
||||||
|
index d989c3fb..358f3950 100644
|
||||||
|
--- a/usr/share/rear/finalize/GNU/Linux/240_reassign_luks_keyfiles.sh
|
||||||
|
+++ b/usr/share/rear/finalize/GNU/Linux/240_reassign_luks_keyfiles.sh
|
||||||
|
@@ -24,9 +24,9 @@ awk '
|
||||||
|
while read target_name source_device original_keyfile; do
|
||||||
|
Log "Re-assigning keyfile $original_keyfile to LUKS device $target_name ($source_device)"
|
||||||
|
|
||||||
|
- # The scheme for generating a temporary keyfile path must be the same here and in the 'layout/prepare' stage.
|
||||||
|
- temp_keyfile="${TMPDIR:-/tmp}/LUKS-keyfile-$target_name"
|
||||||
|
- [ -f "$temp_keyfile" ] || BugError "temporary keyfile $temp_keyfile not found"
|
||||||
|
+ # The scheme for generating a temporary keyfile path must be the same here and in the 'layout/prepare' stage:
|
||||||
|
+ temp_keyfile="$TMP_DIR/LUKS-keyfile-$target_name"
|
||||||
|
+ test -f "$temp_keyfile" || BugError "temporary LUKS keyfile $temp_keyfile not found"
|
||||||
|
|
||||||
|
target_keyfile="$TARGET_FS_ROOT/$original_keyfile"
|
||||||
|
|
@ -0,0 +1,46 @@
|
|||||||
|
commit ad720ad788be1d653da31be36fca5e886e314ddb
|
||||||
|
Author: Pavel Cahyna <pcahyna@redhat.com>
|
||||||
|
Date: Thu Aug 24 11:41:25 2023 +0200
|
||||||
|
|
||||||
|
Remove the lvmdevices file at the end of recovery
|
||||||
|
|
||||||
|
The file /etc/lvm/devices/system.devices restricts LVM to disks with
|
||||||
|
given (hardware) IDs (serial numbers, WWNs). See lvmdevices(8).
|
||||||
|
|
||||||
|
Unfortunately, when restoring to different disks than in the original
|
||||||
|
system, it will mean that LVM is broken in the recovered system (it
|
||||||
|
won't find any disks). Therefore it is safer to remove the file to
|
||||||
|
force the old behavior where LVM scans all disks. This used to be the
|
||||||
|
LVM default (use_devicesfile=0).
|
||||||
|
|
||||||
|
diff --git a/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh b/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..a51e6bca
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh
|
||||||
|
@@ -0,0 +1,25 @@
|
||||||
|
+# Adapted from 260_rename_diskbyid.sh
|
||||||
|
+
|
||||||
|
+# Remove /etc/lvm/devices/system.devices
|
||||||
|
+# The file restricts LVM to disks with given (hardware) IDs (serial
|
||||||
|
+# numbers, WWNs). See lvmdevices(8).
|
||||||
|
+# Unfortunately, when restoring to different disks than in the original
|
||||||
|
+# system, it will mean that LVM is broken in the recovered system (it
|
||||||
|
+# won't find any disks). Therefore it is safer to remove the file to
|
||||||
|
+# force the old behavior where LVM scans all disks. This used to be the
|
||||||
|
+# LVM default (use_devicesfile=0).
|
||||||
|
+
|
||||||
|
+# There may be other files under /etc/lvm/devices, but they are not used
|
||||||
|
+# by default
|
||||||
|
+
|
||||||
|
+local file=/etc/lvm/devices/system.devices
|
||||||
|
+local realfile
|
||||||
|
+
|
||||||
|
+realfile="$TARGET_FS_ROOT/$file"
|
||||||
|
+# OK if file not found
|
||||||
|
+test -f "$realfile" || return 0
|
||||||
|
+mv $v "$realfile" "${realfile}.rearbak"
|
||||||
|
+LogPrint "Renamed LVM devices file $realfile to ${realfile}.rearbak
|
||||||
|
+to prevent LVM problems in the recovered system, verify that the file
|
||||||
|
+is correct after booting the recovered system and move it back, or
|
||||||
|
+regenerate it using vgimportdevices."
|
@ -0,0 +1,82 @@
|
|||||||
|
commit 4af486794d45adbda7567361d8dcc658599dcd2c
|
||||||
|
Author: Johannes Meixner <jsmeix@suse.com>
|
||||||
|
Date: Tue Aug 8 14:44:16 2023 +0200
|
||||||
|
|
||||||
|
Merge pull request #3031 from rear/jsmeix-USB-Secure-Boot
|
||||||
|
|
||||||
|
Secure Boot support for OUTPUT=USB:
|
||||||
|
In output/USB/Linux-i386/100_create_efiboot.sh
|
||||||
|
added SECURE_BOOT_BOOTLOADER related code that is based
|
||||||
|
on the code in output/ISO/Linux-i386/250_populate_efibootimg.sh
|
||||||
|
with some adaptions to make it work within the existing USB code.
|
||||||
|
The basic idea for Secure Boot booting of the ReaR recovery system
|
||||||
|
is to "just copy" the (signed) EFI binaries of the Linux distribution
|
||||||
|
(shim*.efi and grub*.efi as first and second stage UEFI bootloaders)
|
||||||
|
instead of let ReaR make its own EFI binary via build_bootx86_efi()
|
||||||
|
see https://github.com/rear/rear/pull/3031
|
||||||
|
|
||||||
|
diff --git a/usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh b/usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh
|
||||||
|
index f4659306..fd631c44 100644
|
||||||
|
--- a/usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh
|
||||||
|
+++ b/usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh
|
||||||
|
@@ -29,6 +29,44 @@ mount $EFI_PART $EFI_MPT || Error "Failed to mount EFI partition '$EFI_PART' at
|
||||||
|
mkdir -p $EFI_DST || Error "Failed to create directory '$EFI_DST'"
|
||||||
|
|
||||||
|
# Copy boot loader
|
||||||
|
+# The SECURE_BOOT_BOOTLOADER related code below is based on the code in output/ISO/Linux-i386/250_populate_efibootimg.sh
|
||||||
|
+# because I <jsmeix@suse.de> noticed that Secure Boot works with ISO at least for me, cf.
|
||||||
|
+# https://github.com/rear/rear/pull/3025#issuecomment-1635876186
|
||||||
|
+# but not with USB, cf.
|
||||||
|
+# https://github.com/rear/rear/pull/3025#issuecomment-1643774477
|
||||||
|
+# so I tried to re-use the ISO Secure Boot code for USB
|
||||||
|
+# which made Secure Boot "just work" for me with USB
|
||||||
|
+# but I had to do some (minor) adaptions to make it work
|
||||||
|
+# within the existing USB code, cf.
|
||||||
|
+# https://github.com/rear/rear/pull/3031#issuecomment-1653443454
|
||||||
|
+# Copy UEFI bootloader:
|
||||||
|
+if test -f "$SECURE_BOOT_BOOTLOADER" ; then
|
||||||
|
+ # For a technical description of Shim see https://mjg59.dreamwidth.org/19448.html
|
||||||
|
+ # Shim is a signed EFI binary that is a first stage bootloader
|
||||||
|
+ # that loads and executes another (signed) EFI binary
|
||||||
|
+ # which normally is a second stage bootloader
|
||||||
|
+ # which normally is a GRUB EFI binary
|
||||||
|
+ # which normally is available as a file named grub*.efi
|
||||||
|
+ # so when SECURE_BOOT_BOOTLOADER is used as UEFI_BOOTLOADER
|
||||||
|
+ # (cf. rescue/default/850_save_sysfs_uefi_vars.sh)
|
||||||
|
+ # then Shim (usually shim.efi) must be copied as EFI/BOOT/BOOTX64.efi
|
||||||
|
+ # and Shim's second stage bootloader must be also copied where Shim already is.
|
||||||
|
+ DebugPrint "Using '$SECURE_BOOT_BOOTLOADER' as first stage Secure Boot bootloader BOOTX64.efi"
|
||||||
|
+ cp -L $v "$SECURE_BOOT_BOOTLOADER" "$EFI_DST/BOOTX64.efi" || Error "Failed to copy SECURE_BOOT_BOOTLOADER '$SECURE_BOOT_BOOTLOADER' to $EFI_DST/BOOTX64.efi"
|
||||||
|
+ # When Shim is used, its second stage bootloader can be actually anything
|
||||||
|
+ # named grub*.efi (second stage bootloader is Shim compile time option), see
|
||||||
|
+ # http://www.rodsbooks.com/efi-bootloaders/secureboot.html#initial_shim
|
||||||
|
+ local uefi_bootloader_dirname="$( dirname $SECURE_BOOT_BOOTLOADER )"
|
||||||
|
+ local second_stage_UEFI_bootloader_files="$( echo $uefi_bootloader_dirname/grub*.efi )"
|
||||||
|
+ # Avoid 'nullglob' pitfall when nothing matches .../grub*.efi which would result
|
||||||
|
+ # an invalid "cp -v /var/tmp/.../EFI/BOOT/" command that fails
|
||||||
|
+ # cf. https://github.com/rear/rear/issues/1921
|
||||||
|
+ test "$second_stage_UEFI_bootloader_files" || Error "Could not find second stage Secure Boot bootloader $uefi_bootloader_dirname/grub*.efi"
|
||||||
|
+ DebugPrint "Using second stage Secure Boot bootloader files: $second_stage_UEFI_bootloader_files"
|
||||||
|
+ cp -L $v $second_stage_UEFI_bootloader_files $EFI_DST/ || Error "Failed to copy second stage Secure Boot bootloader files"
|
||||||
|
+else
|
||||||
|
+ cp -L $v "$UEFI_BOOTLOADER" "$EFI_DST/BOOTX64.efi" || Error "Failed to copy UEFI_BOOTLOADER '$UEFI_BOOTLOADER' to $EFI_DST/BOOTX64.efi"
|
||||||
|
+fi
|
||||||
|
cp $v $UEFI_BOOTLOADER "$EFI_DST/BOOTX64.efi" || Error "Failed to copy UEFI_BOOTLOADER '$UEFI_BOOTLOADER' to $EFI_DST/BOOTX64.efi"
|
||||||
|
|
||||||
|
# Copy kernel
|
||||||
|
@@ -93,7 +131,14 @@ EOF
|
||||||
|
create_grub2_cfg ${EFI_DIR}/kernel ${EFI_DIR}/$REAR_INITRD_FILENAME > ${EFI_DST}/grub.cfg
|
||||||
|
|
||||||
|
# Create bootloader, this overwrite BOOTX64.efi copied in previous step ...
|
||||||
|
- build_bootx86_efi ${EFI_DST}/BOOTX64.efi ${EFI_DST}/grub.cfg "/boot" "$UEFI_BOOTLOADER"
|
||||||
|
+ # Create BOOTX86.efi but only if we are NOT secure booting.
|
||||||
|
+ # We are not able to create signed boot loader
|
||||||
|
+ # so we need to reuse existing one.
|
||||||
|
+ # See issue #1374
|
||||||
|
+ # build_bootx86_efi () can be safely used for other scenarios.
|
||||||
|
+ if ! test -f "$SECURE_BOOT_BOOTLOADER" ; then
|
||||||
|
+ build_bootx86_efi ${EFI_DST}/BOOTX64.efi ${EFI_DST}/grub.cfg "/boot" "$UEFI_BOOTLOADER"
|
||||||
|
+ fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
BugError "Neither grub 0.97 nor 2.0"
|
@ -0,0 +1,41 @@
|
|||||||
|
commit 1cd41052f7a7cd42ea14ea53b7280c73624aba3f
|
||||||
|
Author: Johannes Meixner <jsmeix@suse.com>
|
||||||
|
Date: Mon Mar 21 12:14:21 2022 +0100
|
||||||
|
|
||||||
|
Merge pull request #2774 from rear/jsmeix-1024-USB_UEFI_PART_SIZE
|
||||||
|
|
||||||
|
In default.conf increase USB_UEFI_PART_SIZE to 1024 MiB,
|
||||||
|
cf. https://github.com/rear/rear/pull/1205
|
||||||
|
in particular to also make things work by default when additional
|
||||||
|
third-party kernel modules and firmware (e.g. from Nvidia) are used,
|
||||||
|
cf. https://github.com/rear/rear/issues/2770#issuecomment-1068935688
|
||||||
|
|
||||||
|
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
|
||||||
|
index 8faa56aa..17a764cb 100644
|
||||||
|
--- a/usr/share/rear/conf/default.conf
|
||||||
|
+++ b/usr/share/rear/conf/default.conf
|
||||||
|
@@ -872,13 +872,20 @@ USB_PARTITION_ALIGN_BLOCK_SIZE="8"
|
||||||
|
# in MiB when formatting a medium by the format workflow.
|
||||||
|
# If USB_UEFI_PART_SIZE is empty or invalid (i.e. not an unsigned integer larger than 0)
|
||||||
|
# the user must interactively enter a valid value while running the format workflow.
|
||||||
|
-# The default value of 400 MiB should be sufficiently big and it is in compliance
|
||||||
|
-# with the 8 MiB partition alignment default value ( 400 = 8 * 50 )
|
||||||
|
-# and even with a 16 MiB partition alignment value ( 400 = 16 * 25 )
|
||||||
|
+# The default value of 1024 MiB should be sufficiently big
|
||||||
|
# cf. https://github.com/rear/rear/pull/1205
|
||||||
|
+# in particular when third-party kernel modules and firmware (e.g. from Nvidia) are used
|
||||||
|
+# cf. https://github.com/rear/rear/issues/2770#issuecomment-1068935688
|
||||||
|
+# and 1024 MiB is in compliance with the 8 MiB partition alignment value ( 1024 = 8 * 128 )
|
||||||
|
+# and also with higher 2^n MiB partition alignment values.
|
||||||
|
+# Furthermore the default value of 1024 MiB results that the FAT filesystem of the ESP
|
||||||
|
+# will be in compliance with that the ESP should officially use a FAT32 filesystem
|
||||||
|
+# because mkfs.vfat automatically makes a FAT32 filesystem starting at 512 MiB
|
||||||
|
+# (a FAT16 ESP works in most cases but causes issues with certain UEFI firmware)
|
||||||
|
+# cf. https://github.com/rear/rear/issues/2575
|
||||||
|
# The value of USB_UEFI_PART_SIZE will be rounded to the nearest
|
||||||
|
# USB_PARTITION_ALIGN_BLOCK_SIZE chunk:
|
||||||
|
-USB_UEFI_PART_SIZE="400"
|
||||||
|
+USB_UEFI_PART_SIZE="1024"
|
||||||
|
#
|
||||||
|
# Default boot option (i.e. what gets booted automatically after some timeout)
|
||||||
|
# when EXTLINUX boots the USB stick or USB disk or other disk device on BIOS systems.
|
@ -0,0 +1,21 @@
|
|||||||
|
commit ead05a460d3b219372f47be888ba6011c7fd3318
|
||||||
|
Author: Pavel Cahyna <pcahyna@redhat.com>
|
||||||
|
Date: Tue Aug 22 12:32:04 2023 +0200
|
||||||
|
|
||||||
|
Fix downstream only bug
|
||||||
|
|
||||||
|
\$IsInArray -> IsInArray - it is a shell function, not a variable.
|
||||||
|
|
||||||
|
diff --git a/usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh b/usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh
|
||||||
|
index d34ab335..a65a9c8e 100644
|
||||||
|
--- a/usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh
|
||||||
|
+++ b/usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh
|
||||||
|
@@ -246,7 +246,7 @@ create_lvmvol() {
|
||||||
|
local warnraidline
|
||||||
|
|
||||||
|
if [ $is_thin -eq 0 ] ; then
|
||||||
|
- ifline="if IsInArray $vg \"\${create_logical_volumes[@]}\" && ! \$IsInArray $vg \"\${create_thin_volumes_only[@]}\" ; then"
|
||||||
|
+ ifline="if IsInArray $vg \"\${create_logical_volumes[@]}\" && ! IsInArray $vg \"\${create_thin_volumes_only[@]}\" ; then"
|
||||||
|
else
|
||||||
|
ifline="if IsInArray $vg \"\${create_logical_volumes[@]}\" ; then"
|
||||||
|
fi
|
Loading…
Reference in new issue