github.com/ethersphere/bee/v2@v2.2.0/packaging/deb/preinst (about)

     1  #!/bin/sh -e
     2  
     3  if [ "$1" = "install" ]; then
     4      if ! getent passwd bee > /dev/null; then
     5          useradd -r -d /var/lib/bee -s /sbin/nologin -U bee
     6      fi
     7      if ! test -d /var/lib/bee; then
     8          mkdir -p /var/lib/bee
     9          chmod 0750 /var/lib/bee
    10          chown -R bee:bee /var/lib/bee
    11      fi
    12      if ! test -f /var/lib/bee/password; then
    13          < /dev/urandom tr -dc _A-Z-a-z-0-9 2> /dev/null | head -c32 > /var/lib/bee/password
    14          chmod 0600 /var/lib/bee/password
    15          chown bee:bee /var/lib/bee/password
    16      fi
    17  fi