Skip to content

Commit

Permalink
Merge pull request #607 from indigo-dc/add-manpage-for-tokensh
Browse files Browse the repository at this point in the history
Add manpage for tokensh
  • Loading branch information
zachmann authored Oct 24, 2024
2 parents e9ee73b + 401867e commit b0fd5bc
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 6 deletions.
44 changes: 44 additions & 0 deletions .gitlab-ci-scripts/find-my-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

find_my_version() {
AVAILABLE_VERSIONS=$(git branch -vva \
| grep packaging/v[0-9] \
| awk '{ print $1 }' \
| awk -F/ '{ print $4 }' \
| sort -V \
| grep -v ^$ \
)
LATEST_VERSION=$(git branch -vva \
| grep packaging/v[0-9] \
| awk '{ print $1 }' \
| awk -F/ '{ print $4 }' \
| sort -V \
| tail -n 1 \
)
MY_VERSION="v$(cat VERSION)"
# MY_VERSION="v4.9.0"
# MY_VERSION="v5.0.0"
# MY_VERSION="v5.0.1"

# echo "My version: ${MY_VERSION}"
# echo "Available: ${AVAILABLE_VERSIONS}"
# echo "Latest: ${LATEST_VERSION}"

for VERSION in ${AVAILABLE_VERSIONS}; do
# echo ""
TESTVERSIONS="${VERSION} ${MY_VERSION}"
RESULTING_VERSION=$(for i in ${TESTVERSIONS}; do echo $i; done \
| sort -V \
| tail -n 1 \
)
# echo "Testing: ${VERSION} Result: ${RESULTING_VERSION}"
[[ "${RESULTING_VERSION}" == "${MY_VERSION}" ]] && {
VERSION_TO_USE=${VERSION}
# echo "Apparently: ${RESULTING_VERSION} == ${MY_VERSION}"
}
done

# echo -e "\n"
# echo "VERSION_TO_USE: ${VERSION_TO_USE}"
echo "${VERSION_TO_USE}"
}
12 changes: 10 additions & 2 deletions .gitlab-ci-scripts/local-before-script.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#!/bin/bash

FILES=""
OIDC_AGENT_REPO="http://codebase.helmholtz.cloud/m-team/oidc/oidc-agent.git"
PACKAGING_BRANCH="packaging"

echo "======== oidc-agent-local-before-script starting======="
export VERSION=`cat VERSION`
# clone the packages file of this repo:
# Try with VERSION
echo "Trying to use branch for packaging: ${PACKAGING_BRANCH}/latest"
git clone -b ${PACKAGING_BRANCH}/latest http://codebase.helmholtz.cloud/m-team/oidc/oidc-agent.git delme || {

MY_PACKAGING_VERSION="latest"
[ -e .gitlab-ci-scripts/find-my-version.sh ] && {
. .gitlab-ci-scripts/find-my-version.sh
MY_PACKAGING_VERSION=$(find_my_version)
}

echo "Trying to use branch for packaging: ${PACKAGING_BRANCH}/${MY_PACKAGING_VERSION}"
git clone -b ${PACKAGING_BRANCH}/${MY_PACKAGING_VERSION} ${OIDC_AGENT_REPO} delme || {
exit 10
}

Expand Down
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,4 @@ trigger-win-installer:




13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ install_bash: $(BASH_COMPLETION_PATH)/$(AGENT) $(BASH_COMPLETION_PATH)/$(GEN) $(
@echo "Installed bash completion"

.PHONY: install_man
install_man: $(MAN_PATH)/man1/$(AGENT).1 $(MAN_PATH)/man1/$(GEN).1 $(MAN_PATH)/man1/$(ADD).1 $(MAN_PATH)/man1/$(CLIENT).1 $(MAN_PATH)/man1/$(AGENT_SERVICE).1 $(MAN_PATH)/man1/$(KEYCHAIN).1 $(PROMPT_MAN_PATH)/man1/$(PROMPT).1
install_man: $(MAN_PATH)/man1/$(AGENT).1 $(MAN_PATH)/man1/$(GEN).1 $(MAN_PATH)/man1/$(ADD).1 $(MAN_PATH)/man1/$(CLIENT).1 $(MAN_PATH)/man1/$(AGENT_SERVICE).1 $(MAN_PATH)/man1/$(KEYCHAIN).1 $(PROMPT_MAN_PATH)/man1/$(PROMPT).1 $(MAN_PATH)/man1/$(TOKENSH).1
@echo "Installed man pages!"

.PHONY: install_lib
Expand Down Expand Up @@ -718,6 +718,8 @@ $(MAN_PATH)/man1/$(KEYCHAIN).1: $(MANDIR)/$(KEYCHAIN).1 $(MAN_PATH)/man1
@install -p -m 644 $< $@
$(PROMPT_MAN_PATH)/man1/$(PROMPT).1: $(MANDIR)/$(PROMPT).1 $(PROMPT_MAN_PATH)/man1
@install -p -m 644 $< $@
$(MAN_PATH)/man1/$(TOKENSH).1: $(MANDIR)/$(TOKENSH).1 $(MAN_PATH)/man1
@install -p -m 644 $< $@

## Tmpfiles
$(TMPFILES_PATH)/oidc-agent.conf: $(CONFDIR)/tmpfiles.d/oidc-agent.conf
Expand Down Expand Up @@ -804,6 +806,7 @@ uninstall_man:
@$(rm) $(MAN_PATH)/man1/$(CLIENT).1
@$(rm) $(MAN_PATH)/man1/$(AGENT_SERVICE).1
@$(rm) $(MAN_PATH)/man1/$(KEYCHAIN).1
@$(rm) $(MAN_PATH)/man1/$(TOKENSH).1
@$(rm) $(PROMPT_MAN_PATH)/man1/$(PROMPT).1
@echo "Uninstalled man pages!"

Expand Down Expand Up @@ -858,7 +861,7 @@ uninstall_xsession_script:
# Man pages

.PHONY: create_man
create_man: $(MANDIR)/$(AGENT).1 $(MANDIR)/$(GEN).1 $(MANDIR)/$(ADD).1 $(MANDIR)/$(CLIENT).1 $(MANDIR)/$(AGENT_SERVICE).1 $(MANDIR)/$(KEYCHAIN).1 $(MANDIR)/$(PROMPT).1
create_man: $(MANDIR)/$(AGENT).1 $(MANDIR)/$(GEN).1 $(MANDIR)/$(ADD).1 $(MANDIR)/$(CLIENT).1 $(MANDIR)/$(AGENT_SERVICE).1 $(MANDIR)/$(KEYCHAIN).1 $(MANDIR)/$(PROMPT).1 $(MANDIR)/$(TOKENSH).1
@echo "Created man pages"

$(MANDIR)/$(AGENT).1: $(MANDIR) $(BINDIR)/$(AGENT) $(SRCDIR)/h2m/$(AGENT).h2m
Expand All @@ -882,6 +885,9 @@ $(MANDIR)/$(KEYCHAIN).1: $(MANDIR) $(BINDIR)/$(KEYCHAIN) $(SRCDIR)/h2m/$(KEYCHAI
$(MANDIR)/$(PROMPT).1: $(MANDIR) $(BINDIR)/$(PROMPT) $(SRCDIR)/h2m/$(PROMPT).h2m
@help2man $(BINDIR)/$(PROMPT) -o $(MANDIR)/$(PROMPT).1 -s 1 -N -i $(SRCDIR)/h2m/$(PROMPT).h2m --no-discard-stderr

$(MANDIR)/$(TOKENSH).1: $(MANDIR) $(BINDIR)/$(TOKENSH) $(SRCDIR)/h2m/$(TOKENSH).h2m
@help2man $(BINDIR)/$(TOKENSH) -o $(MANDIR)/$(TOKENSH).1 -s 1 -N -i $(SRCDIR)/h2m/$(TOKENSH).h2m

endif

# Library
Expand Down Expand Up @@ -1081,8 +1087,9 @@ test: $(TESTBINDIR)/test
@$<

.PHONY: testdocu
testdocu: $(BINDIR)/$(AGENT) $(BINDIR)/$(GEN) $(BINDIR)/$(ADD) $(BINDIR)/$(CLIENT) gitbook/$(GEN)/options.md gitbook/$(AGENT)/options.md gitbook/$(ADD)/options.md gitbook/$(CLIENT)/options.md
testdocu: $(BINDIR)/$(AGENT) $(BINDIR)/$(GEN) $(BINDIR)/$(ADD) $(BINDIR)/$(CLIENT) gitbook/$(GEN)/options.md gitbook/$(AGENT)/options.md gitbook/$(ADD)/options.md gitbook/$(CLIENT)/options.md gitbook/$(TOKENSH)/options.md
@$(BINDIR)/$(AGENT) -h | grep "^[[:space:]]*-" | grep -v "debug" | grep -v "verbose" | grep -v "usage" | grep -v "help" | grep -v "version" | sed 's/\s*--/--/' | sed 's/[^\s]*,--/--/' | sed 's/\s.*//' | sed 's/\[.*//' | sed 's/,.*//' | sed 's/=.*//' | xargs -I {} sh -c 'grep -c -- ^###.*{} gitbook/$(AGENT)/options.md>/dev/null || echo "In gitbook/$(AGENT)/options.md: {} not documented"'
@$(BINDIR)/$(GEN) -h | grep "^[[:space:]]*-" | grep -v "debug" | grep -v "verbose" | grep -v "usage" | grep -v "help" | grep -v "version" | sed 's/\s*--/--/' | sed 's/[^\s]*,--/--/' | sed 's/\s.*//' | sed 's/\[.*//' | sed 's/,.*//' | sed 's/=.*//' | xargs -I {} sh -c 'grep -c -- ^###.*{} gitbook/$(GEN)/options.md>/dev/null || echo "In gitbook/$(GEN)/options.md: {} not documented"'
@$(BINDIR)/$(ADD) -h | grep "^[[:space:]]*-" | grep -v "debug" | grep -v "verbose" | grep -v "usage" | grep -v "help" | grep -v "version" | sed 's/\s*--/--/' | sed 's/[^\s]*,--/--/' | sed 's/\s.*//' | sed 's/\[.*//' | sed 's/,.*//' | sed 's/=.*//' | xargs -I {} sh -c 'grep -c -- ^###.*{} gitbook/$(ADD)/options.md>/dev/null || echo "In gitbook/$(ADD)/options.md: {} not documented"'
@$(BINDIR)/$(CLIENT) -h | grep "^[[:space:]]*-" | grep -v "debug" | grep -v "verbose" | grep -v "usage" | grep -v "help" | grep -v "version" | sed 's/\s*--/--/' | sed 's/[^\s]*,--/--/' | sed 's/\s.*//' | sed 's/\[.*//' | sed 's/,.*//' | sed 's/=.*//' | xargs -I {} sh -c 'grep -c -- ^###.*{} gitbook/$(CLIENT)/options.md>/dev/null || echo "In gitbook/$(CLIENT)/options.md: {} not documented"'
@$(BINDIR)/$(TOKENSH) -h | grep "^[[:space:]]*-" | grep -v "debug" | grep -v "verbose" | grep -v "usage" | grep -v "help" | grep -v "version" | sed 's/\s*--/--/' | sed 's/[^\s]*,--/--/' | sed 's/\s.*//' | sed 's/\[.*//' | sed 's/,.*//' | sed 's/=.*//' | xargs -I {} sh -c 'grep -c -- ^###.*{} gitbook/$(TOKENSH)/options.md>/dev/null || echo "In gitbook/$(TOKENSH)/options.md: {} not documented"'
3 changes: 3 additions & 0 deletions gitbook/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
* [oidc-token](oidc-token/oidc-token.md)
* [General Usage](oidc-token/general.md)
* [Detailed Information About All Options](oidc-token/options.md)
* [oidc-tokensh](oidc-token/oidc-tokensh.md)
* [General Usage](oidc-tokensh/general.md)
* [Detailed Information About All Options](oidc-tokensh/options.md)
* [Other Applications Using oidc-agent](agent-clients.md)
* [Tips](tips.md)
* [oidc-agent-server](oidc-agent-server/oidc-agent-server.md)
Expand Down
17 changes: 17 additions & 0 deletions src/h2m/oidc-tokensh.h2m
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[NAME]
oidc-tokensh \- Ensure that valid Access Tokens are always available

oidc-tokensh starts a new shell within which oidc-agent is available. It
prompts for a password to unlock an account configuration, when necessary.

Access Tokens are automatically renewed for the specified account, before
they expire.

[FILES]
$XDG_RUNTIME_DIR/bt_u$ID, /tmp/bt_u$ID, or $BEARER_TOKEN_FILE
[SEE ALSO]
oidc-agent(1), oidc-add(1), oidc-token(1)
.PP
Low-traffic mailing list with updates such as critical security incidents and new releases: https://www.lists.kit.edu/sympa/subscribe/oidc-agent-user
.PP
Full documentation can be found at https://indigo-dc.gitbooks.io/oidc-agent/user/oidc-tokensh
2 changes: 1 addition & 1 deletion src/oidc-tokensh/oidc-tokensh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ usage()
echo " -v|--verbose show debug output"
echo ""
echo "command defaults to \$SHELL"
} >&2
}

# if [ $# = 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
# echo "[${LINENO}] You ran: $0 $*"
Expand Down

0 comments on commit b0fd5bc

Please sign in to comment.