-
-
Notifications
You must be signed in to change notification settings - Fork 254
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Markus Storm <markus.storm@gmx.net>
Signed-off-by: Markus Storm <markus.storm@gmx.net>
build-image/first-boot.bash
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, changed that
build-image/first-boot.bash
Outdated
echo "OK" | ||
fi | ||
echo -n "$(timestamp) [openHABian] Changing default password... " | ||
# shellcheck disable=SC2154 | ||
if [[ -v ${userpw} ]]; then |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Fixes: #1982