Commit graph

109 commits

Author SHA1 Message Date
5dc03bc40d Fix subscription-manger issues.
After a RHEL conversion any attempt to run subscription-manager would result in
an error.  this was due to the RedHat certs having been replaced on the system
during the migration.  To fix this we now copy any subscription-manager certs to
a temporary directory and if they have been removed during the migration we copy
them back at the finish.  This means that subscription-manager now won't stop
working after a migration from RHEL.
2021-06-21 05:10:24 +12:00
51378a2efc Merge branch 'main' of github.com:pajamian/rocky-tools into main 2021-06-21 00:12:40 +12:00
fe473ae20b Add color back in
We previously removed color because (1) it was outputting the color codes to the
log file, which we do not want and (2) nobody could agree on what colors to use.
I've reintroduced color now fixing (1) by allowing for separate output to the
log file and the console and only sending the color codes to the console and (2)
well, I've changed the blue for info messages to cyan, hopefully everyone's
happy with that, but I'm open to suggestions on the info color.

There are now three more file descriptors for specialized output control, making a total of 5:

fd1 - This sends to stdout and to the log file.
fd2 - This sends to stderr and the log file.
fd3 - This just sends to stdout.
fd4 - This just sends to stderr.
fd5 - This just sends to the logfile.

There are also three additional functions:

msg_format - Intended to be used by infomsg and errmsg, this accepts a variable
name and one or more string args.  If there is just one string after the
variable name then it is copied to the variable verbatim.  If there is more than
one then it is taken to be a format specifier and additional args to be passed
to printf (output going to the variable).

infomsg - This will accept either a single arg which contains a verbatim string
or multiple format / args to be processed by printf.  The output of this will be
sent to the log file and also color coded and sent to stdout.

errmsg - Like infomsg but it uses the error color and sends output to stderr
instead of stdout.
2021-06-21 00:01:02 +12:00
d94098d26d
Merge pull request #33 from pajamian/main
Minor change: Don't output /etc/issue when migration is complete.
2021-06-13 10:58:43 -04:00
c7f8aae697 Merge branch 'main' of github.com:pajamian/rocky-tools into main 2021-06-13 15:08:49 +12:00
a4faff4b22 Don't output /etc/issue
/etc/issue used to contain a nice ascii-art RockyLinux logo that we would output
when this script was finished, but it doesn't anymore so there is no longer any
value to outputting this file.
2021-06-13 15:06:49 +12:00
2d4a24b5fc
Merge pull request #32 from pajamian/main
Move some checks to the top of the script.
2021-06-12 09:00:16 -04:00
72927f398e Group bash tests together 2021-06-13 00:36:43 +12:00
b587a7e7a4 Move more tests to the top
Test for teh bash version and root at the top as well, to avoid errors from
commands that otherwise get run before the tests.
2021-06-13 00:30:05 +12:00
5051fc5312 Test for bash at the top.
Put a test for bash at the top to make sure that people don't try to run in
POSIX sh mode.
2021-06-12 23:58:38 +12:00
Louis Abel
20c7162a9f
Merge pull request #31 from electroniceel/migrate2rocky-subdir
Move migrate2rocky into it's own subdirectory.
2021-06-11 11:44:21 -07:00
Electronic Eel
750ed26f99 Move migrate2rocky into it's own subdirectory.
Clean up the rocky-tools root dir, the mirror script has it's own subdir too.
This makes rocky-tools scale better. As this breaks existing links, we should
do it as early as possible, before GA.
2021-06-11 19:17:16 +02:00
Louis Abel
761a27fecd
Merge pull request #26 from netzwergehh/patch-1
Create mirrorsync.sh
2021-06-11 09:28:21 -07:00
a1a23bea8d
Merge pull request #28 from pajamian/main
Katello Notes
2021-06-04 20:10:03 -04:00
d3affffb67 Fix typo 2021-06-05 12:05:35 +12:00
8b30d758e4 Add pre_check for Katello
Missed adding the function call in previous commit.
2021-06-05 11:55:09 +12:00
d3070e9493 Bail on Katello systems.
Katello breaks EL systems to the point where migrate2rocky can't properly
migrate them and any attempt to do so causes major corruption.  This prevents
migrate2rocky from running on Katello systems.
2021-06-05 11:51:02 +12:00
3dbad4d658 Merge branch 'main' of github.com:pajamian/rocky-tools into main 2021-06-05 11:33:09 +12:00
aafffd330d Fix Typo 2021-06-05 11:32:23 +12:00
4fc1c1db1a Merge branch 'rocky-linux:main' into main 2021-06-05 11:31:32 +12:00
c38eeaecba Add note to README about katello systems 2021-06-05 11:30:45 +12:00
7d8e7ae627
Merge pull request #27 from pajamian/main
Fix various issues found by shellcheck + Fix issues when migrating from CentOS 8.3 after 8.4 dropped
2021-06-04 07:35:35 -04:00
844896ad6b Fix rpm and dnf package spec issues
When attempting to check if a package exists for a particular provide string
what happened is if an older version of the package was on the system but a
newer version in the repositories then the older (system) version would be
returned by dnf provides, but this could not be translated into a package name
with dnf repoquery because that specific version could not be found in the
repos.  The solution was to check rpm first to translate the package name on the
system and then dnf repoquery if rpm doesn't find it.

This brought to light issues when passing arrays of package names to rpm and dnf
which might happen to contain an empty element.  In this case rpm and dnf would
consider the empty arg an indicator that it should match all packages on the
system, or all available packages.  While we should try to avoid passing arrays
with empty elements, this highlighed a need to make rpm and dnf safer in this
regard, and so there are now saferpm and sfednf functions which simply strip any
empty args before calling the appropriate command with the rest of the args
untouched.

This commit also fixes an issue with output column formatting.
2021-06-04 22:11:15 +12:00
ef1cfd1fb9 Fix various issues found by shellcheck
Shellcheck found various issues that have cropped up over time.  This commit
fixes those issues.
2021-06-04 02:16:43 +12:00
Dennis Körner
77cc1be64a
Update README.md 2021-06-03 14:02:41 +02:00
Dennis Körner
fd3994bff4
Update README.md 2021-06-03 14:01:55 +02:00
Dennis Körner
b9f58f2cdc
Create example.crontab 2021-06-03 14:01:01 +02:00
Dennis Körner
15ed2e33ab
Create README.md 2021-06-03 13:59:05 +02:00
Dennis Körner
7ee8e846fc
Rename mirrorsync.sh to mirror/mirrorsync.sh 2021-06-03 13:25:03 +02:00
Dennis Körner
b3875ce3de
Update mirrorsync.sh 2021-06-03 12:53:19 +02:00
Dennis Körner
06d824e9df
Update mirrorsync.sh
Redirect stderr of kill to /dev/null
2021-06-03 12:44:27 +02:00
Dennis Körner
343a2269b2
Update mirrorsync.sh
Removed calling rsync by explicit path
2021-06-03 12:40:08 +02:00
Dennis Körner
cddbf9fc58
Update mirrorsync.sh
Added quotes to --exclude parameter
2021-06-03 12:27:41 +02:00
Dennis Körner
f80797de04
Update mirrorsync.sh
Added dead process check to file locking
2021-06-03 12:25:32 +02:00
Dennis Körner
00a6125036
Update mirrorsync.sh
Changed variable names to lowerspace
Added doublequotes to variable usage
Converted opts to an array
Doublebrackets instead of [ ]
Changed to printf instead of echo for logging
Added force to rm
2021-06-03 11:53:55 +02:00
Dennis Körner
b8e86fbb1c
Update mirrorsync.sh
Changed backticks to $()
2021-06-03 11:14:26 +02:00
Dennis Körner
2c764f7532
Update mirrorsync.sh
Changed slashes path composition
2021-06-03 11:08:55 +02:00
Dennis Körner
b5d7170a04
Update mirrorsync.sh 2021-06-03 11:02:33 +02:00
Dennis Körner
fee7412056
Create mirrorsync.sh
Initial version with simple locking and low stress rsyncing
2021-06-02 23:33:51 +02:00
Louis Abel
f2da5e4a8c
Merge pull request #25 from electroniceel/gpg-signature-validation
Do GPG signature checking for the whole migration process
2021-06-02 09:24:41 -07:00
Louis Abel
f88440e889
Merge pull request #24 from pajamian/main
Add MIT license.
2021-06-02 09:24:26 -07:00
Electronic Eel
3ed1aec1bd Do GPG signature checking for the whole migration process
Before this commit, the Rocky system packages like rocky-repos,
rocky-release and similar, were not checked for their gpg signature,
while the rest of the packages were signature checked.
While the system packages were downloaded from https://dl.rockylinux.org,
this still created the risk that someone could attack the CDN infrastructure
behind dl.rockylinux.org and place malicous files there.

With this patch the GPG key is downloaded separately and then compared
against a checksum contained in the script. This adds an extra layer of
security.
2021-06-02 15:16:56 +02:00
e27f9759cb Add MIT license. 2021-06-01 17:11:37 +12:00
Neil Hanlon
de8c952285
Merge pull request #22 from electroniceel/efi-secure-boot
Check if EFI secure boot is enabled
2021-05-31 20:30:52 -04:00
773b2c0d6f
Merge pull request #21 from pajamian/main
Add a "Known Issues" section to README file
2021-05-31 20:30:34 -04:00
932e19384d
Merge branch 'main' into main 2021-05-31 20:30:27 -04:00
Neil Hanlon
6312ce9d19
Merge pull request #23 from electroniceel/upstream-url
Add the repo URL to the comments and documentation.
2021-05-31 20:26:14 -04:00
Electronic Eel
50dac4a735 Check if EFI secure boot is enabled and notify user to disable it in this case. 2021-05-31 17:30:23 +02:00
Electronic Eel
55b70e0913 Add the repo URL to the comments and documentation.
In case the script gets copied around and mirrored, the end user should see
where to get the latest version.
2021-05-31 17:13:33 +02:00
1500f7ec4e Tweak code for known RHEL issue 2021-05-31 21:15:15 +12:00