summarylogtreecommitdiffstats
path: root/duckcloud.install
blob: e71159723a296b0a9b9a8e60ba5bc4c3510822dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
post_install() {
  PASSWORDFILE="/etc/duckcloud/password.cred"
  TMPFILE="/tmp/password.txt "

  if [ -f "$PASSWORDFILE" ]; then
    echo "$PASSWORDFILE already exists, do nothing"
  else
    echo "Generate the password file at $PASSWORDFILE"
    openssl rand -hex 32 | head -n1 > $TMPFILE
    sudo systemd-creds encrypt --name=password $TMPFILE $PASSWORDFILE
    shred -u $TMPFILE
  fi
}