parent
134faa3139
commit
a206b65ed7
@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env expect
|
||||
|
||||
# Read the password string
|
||||
set pass [lindex $argv 0]
|
||||
|
||||
# Check if password was provided
|
||||
if { $pass == "" } {
|
||||
puts "Usage: $argv0 <password>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Disable output
|
||||
log_user 0
|
||||
|
||||
# Execute password hashing script
|
||||
spawn docker exec -it matrix-synapse /usr/local/bin/hash_password -c /data/homeserver.yaml
|
||||
expect "Password: "
|
||||
send "$pass\r"
|
||||
expect "Confirm password: "
|
||||
send "$pass\r"
|
||||
expect "%"
|
||||
|
||||
# Save the hash output to a variable
|
||||
set output $expect_out(buffer)
|
||||
|
||||
# Trim the whitespace
|
||||
regexp {\S+} $output passwordHash
|
||||
|
||||
# Output the password hash
|
||||
puts -nonewline stdout $passwordHash
|
||||
close stdout
|
Loading…
Reference in new issue