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

cleanup linux-functions.sh as preparation for issue1202 #1352

Conversation

jsmeix
Copy link
Member

@jsmeix jsmeix commented May 9, 2017

cleanup linux-functions.sh and some related code
in 390_copy_binaries…_libraries.sh and
in _input-output-functions.sh as a preparation step
that is related to solve issue1202

…_libraries.sh and in _input-output-functions.sh as a preparation step that is related to solve issue1202
@jsmeix jsmeix added cleanup enhancement Adaptions and new features labels May 9, 2017
@jsmeix jsmeix added this to the ReaR v2.1 milestone May 9, 2017
@jsmeix jsmeix assigned jsmeix and unassigned jsmeix May 9, 2017
@jsmeix
Copy link
Member Author

jsmeix commented May 9, 2017

This is a major cleanup.
I did "rear mkrescue" with and without that changes
on my SLES12 test system.
I compared the contents in the two /tmp/rear.XXXX/rootfs
and both contain same files (in particular same binaries
and same kernel modules).
Of course also "rear recover" still works with that changes for me
so that from my current point of view it looks promising...

@jsmeix
Copy link
Member Author

jsmeix commented May 9, 2017

In linux-functions.sh I removed the leftover functions
FindDrivers has_module has_any_module add_module cp_bin rpmtopdir
because those functions are nowhere called (has_module was only
called by has_any_module and add_module).
Here my results in current rear master (without that cleanup):

# for f in FindDrivers has_module has_any_module add_module cp_bin rpmtopdir ; do echo $f ; find usr/sbin/rear usr/share/rear/ | xargs grep "$f" ; echo ; done

FindDrivers
usr/share/rear/lib/linux-functions.sh:FindDrivers() {

has_module
usr/share/rear/lib/linux-functions.sh:has_module () {
usr/share/rear/lib/linux-functions.sh:          has_module "$module" && return 0
usr/share/rear/lib/linux-functions.sh:          has_module "$module" || modules="$modules $module"

has_any_module
usr/share/rear/lib/linux-functions.sh:has_any_module () {

add_module
usr/share/rear/lib/linux-functions.sh:add_module () {

cp_bin
usr/share/rear/lib/linux-functions.sh:cp_bin () {

rpmtopdir
usr/share/rear/lib/linux-functions.sh:function rpmtopdir () {

@jsmeix
Copy link
Member Author

jsmeix commented May 9, 2017

In linux-functions.sh in the ResolveModules function
I removed usage of print_modprobeconf because
that variable was nowhere set in the code before:

# find usr/sbin/rear usr/share/rear/ | xargs grep 'print_modprobeconf'

usr/share/rear/lib/linux-functions.sh:                  if [ "$print_modprobeconf" = 1 ]; then
usr/share/rear/lib/linux-functions.sh:                          print_modprobeconf=0

and I removed usage of $boot_dir/etc/modprobe.conf
because boot_dir is not set in any script that runs before
build/GNU/Linux/400_copy_modules.sh
which is the only script that calls ResolveModules
so that $boot_dir is always empty in ResolveModules.
FYI:
boot_dir is used later in output/default/940_grub2_rescue.sh as

local boot_dir="/boot"

but that is useless for ResolveModules and 940_grub2_rescue.sh
is only run when GRUB_RESCUE is 'true'.

@jsmeix
Copy link
Member Author

jsmeix commented May 9, 2017

If there are no furious objections
I would like to merge it tomorrow.

For the fun of it:
There is now a nice 'awk' gem where the plain code
is totally incomprehensible without explanatory comments
(at least for me).

@jsmeix jsmeix merged commit 3bef888 into rear:master May 10, 2017
@jsmeix jsmeix deleted the cleanup_linux-functions.sh_as_a_preparation_related_to_issue1202 branch May 10, 2017 08:49
@jsmeix jsmeix added fixed / solved / done and removed enhancement Adaptions and new features labels May 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant