Skip to content

Commit

Permalink
TRITON-1873 TRITON-1692 broke linux-prepare-image for Alpine Linux
Browse files Browse the repository at this point in the history
Reviewed by: Pedro Palazón Candel <pedro@joyent.com>
Approved by: Pedro Palazón Candel <pedro@joyent.com>
  • Loading branch information
Mike Gerdts committed Aug 20, 2019
1 parent 515a2ff commit bbf7b89
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tools/prepare-image/linux-prepare-image
Expand Up @@ -98,9 +98,14 @@ function cleanup_root() {
history -c
history -w || true

# Remove or set password for root. If root-password-hash is not set, this
# is equivalent to "passwd -d root".
usermod -p "$(mdata_get_pi root-password-hash)" root
# Set or remove the root password. prepare-image:root-password-hash is only
# supported on those distros that support "usermod -p <hash> <user>".
local pw="$(mdata_get_pi root-password-hash)"
if [[ -n "$pw" ]]; then
usermod -p "$pw" root
else
passwd -d root
fi

# Clean up history, ssh keys, etc.
cleanup_homedir /root
Expand Down

0 comments on commit bbf7b89

Please sign in to comment.