diff --git a/README.md b/README.md index 79550db..3dcc46f 100644 --- a/README.md +++ b/README.md @@ -33,5 +33,11 @@ Usage is pretty straightforward, it is highly-recommended that you leave SSL ena `passwd` interactively prompts for the new password and password expiration date. `passwd` finally sends a prefilled ldapmodify to the server. +### `save` +`save` saves current directory connection settings (excepted `bindpass`) into an RC-file (`${HOME}/.ipa/freeipa-sam.rc`) +If the file exists, variable are automatically read at script startup, and updated in the file on script exit. +If the file does not exist when the script is started, nothing will be saved unless `save` is run manually. + + PRs and issues welcome, but support cannot be promised. Cheers! diff --git a/freeipa-sam.sh b/freeipa-sam.sh index 5631b81..c9597a6 100755 --- a/freeipa-sam.sh +++ b/freeipa-sam.sh @@ -1,10 +1,28 @@ #!/usr/bin/env bash +rcfile="${HOME}/.ipa/freeipa-sam.rc" +if [ -e "$rcfile" ]; then + source "$rcfile" + rcfile_on=true +fi ssleval=true prefix=ldaps passeval() { [ -z $bindpass ] && passeval="UNSET!" || passeval="SET!"; } ssleval() { [ "$prefix" == "ldaps" ] && ssleval="true" || ssleval="false"; } actionseval() { [ "$ldapserver" ] && [ "$binduser" ] && [ "$domain" ] && [ "$passeval" == "SET!" ] && actionseval="ready" || actionseval="conditions not yet met" && return 1; } +save() { + test -d "${HOME}/.ipa" || mkdir -p "${HOME}/.ipa" + cat > "${HOME}/.ipa/freeipa-sam.rc" <