summarylogtreecommitdiffstats
path: root/docker-registry-git.install
blob: b612ae697435a7ba7123dfa05d95ac317648d2ba (plain)
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
post_install() {
  # We need to know uid and gid to create /var/lib/jenkins with proper
  # permissions. So keep systemd-sysusers invocation here despite having
  # pacman hooks.
  systemd-sysusers docker-registry.conf

  XHOME="var/lib/docker-registry"
  [[ -d $XHOME ]] || {
      install -dm 750 -o docker-registry -g docker-registry "$XHOME"

      ## Very-first run. Maybe to initialize dummy credentials in config?
      XHTPASSWD="etc/docker-registry/.htpasswd"
      [[ -f $XHTPASSWD ]] || {
	   mkdir -p `dirname "$XHTPASSWD"`
	   touch "$XHTPASSWD"
	   chown docker-registry:docker-registry "$XHTPASSWD"
	   chmod 600 "$XHTPASSWD"
           echo "*** Docker Registry"
           echo "*** Stub file initialized for credentials in '/$XHTPASSWD'"
           echo "*** You can add new registry users using:"
	   echo "***     htpasswd -B /$XHTPASSWD myuser"
      }
  }

  
}