diff --git a/README.md b/README.md index 79550db..d6e4b81 100644 --- a/README.md +++ b/README.md @@ -33,5 +33,10 @@ 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. +### `rcfile` +`rcfile` saves current directory connection settings (excepted `bindpass`) into a RC-file (stored into `${HOME}/.ipa/freeipa-sam.rc`) +If the file exists, variable are automatically read at script startup. +RC-file is also automatically written at normal exit (using `exit` command action) + PRs and issues welcome, but support cannot be promised. Cheers! diff --git a/freeipa-sam.sh b/freeipa-sam.sh index 5631b81..283a4d1 100755 --- a/freeipa-sam.sh +++ b/freeipa-sam.sh @@ -1,10 +1,30 @@ #!/usr/bin/env bash +rcfile="${HOME}/.ipa/freeipa-sam.rc" +if [ -e "$rcfile" ]; then + source "$rcfile" +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; } +savercfile() { + test -d "${HOME}/.ipa" || mkdir -p "${HOME}/.ipa" + cat > "${HOME}/.ipa/freeipa-sam.rc" <