Skip to content

Commit

Permalink
Refactor launcher for per user instances
Browse files Browse the repository at this point in the history
Removes unnecessary variable define as well as follows freedesktop.org config directory convention with respect to the configuration file location.
  • Loading branch information
gs-kamnas committed Mar 6, 2024
1 parent 0642ee2 commit 091787a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions rpm/SOURCES/cntlm-user
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/bin/bash
# cNTLM per user launcher script
USERNAME="$(id -un)"
HOME="$(getent passwd "$(id -u)" | cut -d: -f6)"
USER_CONF_DIR="${HOME}/.cntlm"
USER_CONFIG_DIR="${XDG_CONFIG_HOME:-${HOME}/.config}"
CNTLM_CONFIG_LOC="${USER_CONFIG_DIR}/cntlm/cntlm.conf"

if [ ! -e "${USER_CONF_DIR}" ] ; then
echo "${USER_CONF_DIR} does not exist! Unable to run cNTLM for user ${USERNAME}."
if [ ! -e "${CNTLM_CONFIG_LOC}" ] ; then
echo "${CNTLM_CONFIG_LOC} does not exist! Unable to run cNTLM for user ${USER}."
exit 1
fi

exec /usr/sbin/cntlm -f -c "${USER_CONF_DIR}/cntlm.conf"
exec /usr/sbin/cntlm -f -c "${CNTLM_CONFIG_LOC}"

0 comments on commit 091787a

Please sign in to comment.