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

fix passwd change via initial openhabian.conf #1983

Merged
merged 3 commits into from
Feb 28, 2025
Merged

fix passwd change via initial openhabian.conf #1983

merged 3 commits into from
Feb 28, 2025

Conversation

mstormi
Copy link
Contributor

@mstormi mstormi commented Feb 26, 2025

Fixes: #1982

@@ -70,17 +70,23 @@ if is_raspbian || is_raspios; then
rm -f "/etc/sudoers.d/010_pi-nopasswd"
fi

echo -n "$(timestamp) [openHABian] Changing default username and password... "
echo -n "$(timestamp) [openHABian] Changing default username ... "
# shellcheck disable=SC2154
if [[ -v ${userName} ]] || ! id "$defaultUserAndGroup" &> /dev/null || id "$userName" &> /dev/null; then
Copy link
Member

Choose a reason for hiding this comment

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

OK, so I understand the changes you are making but I think there might be an issue from older versions.

What does the -v flag do? I can't find it in the bash manual, I believe the -v instances should be replaced with -n right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, changed that

echo "OK"
fi
echo -n "$(timestamp) [openHABian] Changing default password... "
# shellcheck disable=SC2154
if [[ -v ${userpw} ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

# shellcheck disable=SC2154
if [[ -v ${userName} ]] || ! id "$defaultUserAndGroup" &> /dev/null || id "$userName" &> /dev/null; then
if [[ -n ${userName} ]] || ! id "$defaultUserAndGroup" &> /dev/null || id "$userName" &> /dev/null; then
Copy link
Member

Choose a reason for hiding this comment

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

Now that I think about it, I think in this context we should probably be using -Z because we want to check that it's not set, right?

Sorry for the confusion the first time around.

echo "OK"
fi
echo -n "$(timestamp) [openHABian] Changing default password... "
# shellcheck disable=SC2154
if [[ -n ${userpw} ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Signed-off-by: Markus Storm <[email protected]>
@mstormi
Copy link
Contributor Author

mstormi commented Feb 28, 2025

right, changed that

@ecdye ecdye merged commit 0a677aa into main Feb 28, 2025
11 checks passed
@ecdye ecdye deleted the pwdfix branch February 28, 2025 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On installing openhabian the password defined in openhabian.config is ignored.
2 participants