fix(install): silence pre-install requirement-check noise

On a fresh install the requirement checks run before the things they
probe exist, leaking raw command stderr:

- check_install_type.sh: `$( (id -u "$user") )` printed
  "id: 'dockerinstall': no such user" to the terminal AND — since id's
  error goes to stderr, not the captured stdout — the next line's
  `[[ "$ISUSER" == *"no such user"* ]]` could never match, so the
  rootless-user-absent branch was dead. Add `2>&1` (matching siblings on
  lines 25/31): no leak, and the check now works.
- grep on $sysctl (the rootless marker conf, absent until rootless is set
  up) printed "grep: /etc/sysctl.d/99-libreportal-rootless.conf: No such
  file or directory". Add -s to the four $sysctl greps
  (check_docker_rootless, rootless_start_setup, rootless_docker x2);
  "marker absent" is still detected (non-zero exit), just without the
  file-not-found message.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-24 21:57:38 +01:00
parent 1962115ab3
commit 97aeeed8b6
4 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@ checkDockerRootlessRequirement()
{
if [[ $CFG_DOCKER_INSTALL_TYPE == "rootless" ]]; then
### Docker Rootless
if grep -q "ROOTLESS" $sysctl; then
if grep -qs "ROOTLESS" $sysctl; then
isSuccessful "Docker Rootless appears to be installed."
else
isNotice "Docker Rootless does not appear to be installed."

View File

@ -31,7 +31,7 @@ checkInstallTypeRequirement()
ISACT=$( (runSystem systemctl is-active docker ) 2>&1 )
elif [[ $CFG_DOCKER_INSTALL_TYPE == "rootless" ]]; then
# Used for checking the rootless user
local ISUSER=$( (id -u "$CFG_DOCKER_INSTALL_USER"))
local ISUSER=$( (id -u "$CFG_DOCKER_INSTALL_USER") 2>&1 )
if [[ "$ISUSER" == *"no such user"* ]]; then
ISACT=$(command -v docker &> /dev/null)
fi

View File

@ -53,7 +53,7 @@ installDockerRootless()
echo ""
echo "---- $menu_number. Updating the sysctl file for Updating Debian 10."
echo ""
if sudo grep -q "kernel.unprivileged_userns_clone=1" $sysctl; then
if sudo grep -qs "kernel.unprivileged_userns_clone=1" $sysctl; then
isNotice "kernel.unprivileged_userns_clone=1 already exists in $sysctl"
else
local result=$(echo "kernel.unprivileged_userns_clone=1" | sudo tee -a $sysctl > /dev/null)
@ -181,7 +181,7 @@ EOL"
echo ""
# Update sysctl file
if ! grep -qF "# DOCKER ROOTLESS SYSCTL START" "$sysctl"; then
if ! grep -qsF "# DOCKER ROOTLESS SYSCTL START" "$sysctl"; then
local result=$(echo '# DOCKER ROOTLESS SYSCTL START' | sudo tee -a "$sysctl" > /dev/null)
checkSuccess "Adding rootless header to sysctl"

View File

@ -2,7 +2,7 @@
installDockerRootlessStartSetup()
{
if sudo grep -q "ROOTLESS" $sysctl; then
if sudo grep -qs "ROOTLESS" $sysctl; then
isSuccessful "Docker Rootless appears to be installed."
else
installDockerRootless;