post_install() {
  if [ ! -f /usr/share/pwndrop/pwndrop.ini ]; then
    cd /usr/share/pwndrop

    echo ">"
    echo ">   Creating default configuration in /usr/share/pwndrop/pwndrop.ini"
    echo ">"


    cat > pwndrop.ini << EOF
[pwndrop]
listen_ip = "localhost"                     # the external IP of your pwndrop instance (must be set if you want to use the nameserver feature)
http_port = 80                              # listening port for HTTP and WebDAV
https_port = 443                            # listening port for HTTPS
data_dir = "./data"                         # directory path where data storage will reside (relative paths are from executable directory path)
admin_dir = "./admin"                       # directory path where the admin panel files reside (relative paths are from executable directory path)

[setup]                                     # optional: put in if you want to pre-configure pwndrop (section will be deleted from the config file on first run)
username = "admin"                          # username of the admin account
password = "secretpassword"                 # password of the admin account
redirect_url = ""                           # URL to which visitors will be redirected to if they supply a path, which doesn't point to any shared file (put blank if you want to return 404)
secret_path = "/pwndrop"                    # secret URL path, which upon visiting will allow your browser to access the login page of the admin panel (make sure to change the default value)
EOF
    echo ">"
    echo ">   Don't forget to change the values to your preferences."
    echo ">"
  fi
}

post_upgrade() {
  post_install "$@"

  echo ">"
  echo ">   pwndrop.ini configuration located in /usr/share/pwndrop"
  echo ">"
}
