-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-container
More file actions
executable file
·70 lines (54 loc) · 1.33 KB
/
setup-container
File metadata and controls
executable file
·70 lines (54 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
GIT_SSH_KEY=git-private-key
GIT_USER="User Name"
GIT_EMAIL=email@example.com
GIT_REPO=git:password-store.git
if [ -z "$SETUP" ]; then
podman volume rm passweb > /dev/null
podman run --rm \
-v passweb:/home/passweb \
-v ./setup-container:/usr/local/bin/setup \
-v ~/.gnupg:/gnupg:ro \
-v ~/.ssh:/ssh:ro \
-e SETUP=root \
passweb /usr/local/bin/setup
podman run --rm -it \
-v passweb:/home/passweb \
-v ./setup-container:/usr/local/bin/setup \
-e SETUP=user \
-u passweb \
passweb /usr/local/bin/setup
exit
fi
cd ~passweb
# root setup
if [ "$SETUP" = root ]; then
cp -r /gnupg .gnupg
mkdir .ssh
cp "/ssh/$GIT_SSH_KEY" .ssh/git
chown -R passweb:passweb .
# user setup
elif [ "$SETUP" = user ]; then
cat <<END > .gitconfig
[user]
name = $GIT_USER
email = $GIT_EMAIL
END
# add any extra ssh configuration for git below
cat <<END > .ssh/config
host git
IdentityFile ~/.ssh/git
END
cat <<END > .gnupg/gpg-agent.conf
max-cache-ttl 1
END
cat <<'END' > agent
#!/bin/sh
AGENT=/tmp/agent
ssh-agent > $AGENT
. $AGENT > /dev/null
ssh-add ~/.ssh/git
END
chmod +x agent
git clone $GIT_REPO
fi