summarylogtreecommitdiffstats
path: root/install.erb
blob: cb0770285cfcde2e2e42449924835cdb6cbce907 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Warning: This file has syntactically significant, mixed whitespace.
# The heredoc bodies are indented with tabs up to the block level.
# The tabs are for block indentation in the source code.
# The spaces following the tabs are for indentation of the printed output.

## arg 1:  the new package version
post_install() {
    if [[ ! -e /var/lib/<%= pkgname %>/ircd.db ]]; then
        cat <<-EOF
			==> <%= pkgname %> needs to initialize the database and have
			    certificates made available prior to use.
		EOF
        mkcert_howto
    fi
}

## arg 1:  the new package version
## arg 2:  the old package version
post_upgrade() {
    if (( "$(vercmp "$2" 2.1.0)" < 0 )); then
        cat <<-EOF
			==> The tls certificate filenames in the default config have changed.
			    In /var/lib/<%= pkgname %>/:
			        tls.crt -> fullchain.pem
			        tls.key -> privkey.pem

			To generate new self-signed certificates:
		EOF
        mkcert_howto
    fi

    if (( "$(vercmp "$2" 2.7.0)" < 0 )); then
        cat <<-EOF
			==> The package name, filenames, paths, and system service user have changed.
			    /etc/oragono.conf -> /etc/<%= pkgname %>.conf
			    /var/lib/oragono/ -> /var/lib/<%= pkgname %>/
			    sysuser oragono -> <%= pkgname %>

			Please take care to migrate your config and data.
		EOF
    fi
}

mkcert_howto() {
    cat <<-EOF
		    cd /var/lib/<%= pkgname %>
		    sudo -u <%= pkgname %> /usr/bin/<%= pkgname %> mkcerts --conf /etc/<%= pkgname %>.conf
		    sudo -u <%= pkgname %> /usr/bin/<%= pkgname %> initdb --conf /etc/<%= pkgname %>.conf
	EOF
}