Debian Codegraph @

LASTPASS-VERSION-GEN

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/bin/sh
2
3 # This file has been adopted from the git project
4 # You can find the original at https://github.com/git/git/blob/master/GIT-VERSION-GEN
5
6 LPVF=version.h
7 DEF_VER=v1.6.1.GIT
8
9 LF='
10 '
11
12 # First see if there is a version file (included in release tarballs),
13 # then try git-describe, then default.
14 if test -f version
15 then
16 VN=$(cat version) || VN="$DEF_VER"
17 elif test -d ${GIT_DIR:-.git} -o -f .git &&
18 VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
19 case "$VN" in
20 *$LF*) (exit 1) ;;
21 v[0-9]*)
22 git update-index -q --refresh
23 test -z "$(git diff-index --name-only HEAD --)" ||
24 VN="$VN-dirty" ;;
25 esac
26 then
27 VN=$(echo "$VN" | sed -e 's/-/./g');
28 else
29 VN="$DEF_VER"
30 fi
31
32 VN=$(expr "$VN" : v*'\(.*\)')
33
34 if test -r $LPVF
35 then
36 VC=$(sed -ne 's/^#define LASTPASS_CLI_VERSION "\(.*\)"/\1/p' <$LPVF)
37 else
38 VC=unset
39 fi
40 test "$VN" = "$VC" || {
41 echo >&2 "LASTPASS_CLI_VERSION =$VN"
42 echo "#define LASTPASS_CLI_VERSION \"$VN\"" >$LPVF
43 echo "#define LASTPASS_CLI_USERAGENT \"LastPass-CLI/\" LASTPASS_CLI_VERSION" >>$LPVF
44 }