Skip to content

Instantly share code, notes, and snippets.

@bahamat bahamat/manta-pipasswd
Last active Jun 14, 2018

Embed
What would you like to do?
Get the default root password for platform images installed in Triton (manta-pipasswd, triton-pipasswd, pipasswd)
#!/bin/bash
# This will retrieve the default root password for platform images stored in Joyent's Manta service.
# Run this from your workstation.
# This only makes sense in the context of Joyent's cloud, because that's where the
# build artifacts are.
export MANTA_URL=https://us-east.manta.joyent.com/
if [[ -n "$TRACE" ]]; then
export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -o xtrace
fi
set -o errexit
set -o pipefail
pi=$(mfind -t o -n "platform-.*-${1}.tgz" /Joyent_Dev/public/builds/platform/)
if (( ${#pi} < 1 )); then
printf 'Cannot find platform in /Joyent_Dev/public/builds/platform/\n'
exit 1
fi
printf '%s' "$pi" | mjob create --close -q -o -m 'tar zxf $MANTA_INPUT_FILE --wildcards */root.password; cat platform*/root.password'
#!/bin/bash
# This will retrieve the default root password for platform images installed to the local Triton datacenter.
# Run this from your headnode.
if (( UID > 0 )); then
echo "You must elevate privileges."
exit 1
fi
usbkey_status=$(/opt/smartdc/bin/sdc-usbkey status)
passwd_file=/mnt/usbkey/private/root.password.$1
[[ "$usbkey_status" == "unmounted" ]] && /opt/smartdc/bin/sdc-usbkey mount > /dev/null
if [[ -f "$passwd_file" ]]; then
/usr/bin/cat "$passwd_file"
else
echo "Platform image $1 is not installed in this data center."
fi
[[ "$usbkey_status" == "unmounted" ]] && /opt/smartdc/bin/sdc-usbkey unmount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.