Skip to content

scripts: config-lib improve get_local_hostname fallback#1402

Merged
pstorz merged 3 commits intobareos:masterfrom
bruno-at-bareos:dev/bruno/master/scripts-config-lib-fix-missing-commands
Apr 6, 2023
Merged

scripts: config-lib improve get_local_hostname fallback#1402
pstorz merged 3 commits intobareos:masterfrom
bruno-at-bareos:dev/bruno/master/scripts-config-lib-fix-missing-commands

Conversation

@bruno-at-bareos
Copy link
Contributor

@bruno-at-bareos bruno-at-bareos commented Mar 7, 2023

  • Improve get_local_hostname to fallback gracefully if hostname command is missing.

We would like to also secure the pre-installation of the diverse tools used
full list

awk
cat
chgrp
chmod
chown
command
cp
cut
date
dirname
echo
find
getcap
getent
grep
groupadd
id
mkdir
mktemp
mv
openssl
printf
rm
sed
setcap
sort
uname
useradd
usermod

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Required Backports have been created
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR

@bruno-at-bareos bruno-at-bareos force-pushed the dev/bruno/master/scripts-config-lib-fix-missing-commands branch 2 times, most recently from 79896c2 to d40dba0 Compare March 20, 2023 12:59
@arogge
Copy link
Member

arogge commented Mar 20, 2023

On my RHEL 8 the required programs boil down to:

coreutils-8.30-13.el8.x86_64
findutils-4.6.0-20.el8.x86_64
gawk-4.2.1-4.el8.x86_64
glibc-common-2.28-211.el8.x86_64
libcap-2.48-4.el8.x86_64
openssl-1.1.1k-7.el8_6.x86_64
sed-4.5-5.el8.x86_64
shadow-utils-4.6-17.el8.x86_64

@bruno-at-bareos bruno-at-bareos marked this pull request as ready for review March 21, 2023 12:46
@bruno-at-bareos
Copy link
Contributor Author

Hi @arogge I've now checked debian and rpm both got their requirement set in pre mode. For Freebsd using pkg which $(which command) didn't reveal any additional package to add, so seems to be safe.

For the .spec file we maybe want to optimize a bit the gcc section (especially the one for suse) they define it like this

%if 0%{?suse_version} > 1500
BuildRequires: gcc12 gcc12-c++
%else
%if 0%{?sle_version} >= 120500
BuildRequires: gcc11 gcc11-c++
%endif
%endif

if that make sense, I can add it.

@bruno-at-bareos bruno-at-bareos requested a review from arogge March 21, 2023 12:52
@bruno-at-bareos
Copy link
Contributor Author

as discussed today, need to implement newer gcc on all platforms

@bruno-at-bareos bruno-at-bareos force-pushed the dev/bruno/master/scripts-config-lib-fix-missing-commands branch from c26139b to da7715e Compare March 27, 2023 09:46
arogge
arogge previously requested changes Mar 27, 2023
Copy link
Member

@arogge arogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, more nitpicking. 😺

@bruno-at-bareos bruno-at-bareos force-pushed the dev/bruno/master/scripts-config-lib-fix-missing-commands branch from 71fb93f to a4679a4 Compare March 28, 2023 12:37
@bruno-at-bareos bruno-at-bareos requested a review from arogge March 28, 2023 12:38
@pstorz pstorz removed the request for review from arogge April 6, 2023 13:22
bruno-at-bareos and others added 3 commits April 6, 2023 15:33
- improve get_local_hostname by using POSIX `uname` command
  part of coreutils.
- failback to /etc/hostname with short hostname or hard to
  localhost.

Signed-off-by: Bruno Friedmann <bruno.friedmann@bareos.com>
- bareos.spec:
  + replace pwdutils by real shadow package
  + replace tabs by space
  + add all needed Requires(pre)
- debian/control.bareos-common
  + Pre-Depends adjustement
  + Depends move gawk and openssl to Pre-

Signed-off-by: Bruno Friedmann <bruno.friedmann@bareos.com>
@pstorz pstorz force-pushed the dev/bruno/master/scripts-config-lib-fix-missing-commands branch from 89ef998 to 6cdcbc8 Compare April 6, 2023 13:33
@pstorz pstorz merged commit be09d33 into bareos:master Apr 6, 2023
@bruno-at-bareos bruno-at-bareos deleted the dev/bruno/master/scripts-config-lib-fix-missing-commands branch January 15, 2024 13:47
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.

3 participants