CI/Docker: Add install-nuclei.sh script and improve inline comments

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2022-12-12 20:38:44 +01:00
parent 2a42308cae
commit 82367602fd
19 changed files with 53 additions and 29 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -2,7 +2,7 @@
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root
# Abort if not executed as root.
if [ $(id -u) != "0" ]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -2,7 +2,7 @@
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -3,7 +3,7 @@
# INITIALIZES CONTAINER PACKAGES AND PERMISSIONS
export PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts"
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -1,9 +1,9 @@
#!/usr/bin/env bash
# Installs Admin Tools on Linux
# This installs the "duf" and "muffet" admin tools on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-admin-tools.sh)
# abort if not executed as root
# Abort if not executed as root..
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
@ -11,6 +11,7 @@ fi
set -eux;
# Is Go installed?
if ! command -v go &> /dev/null
then
echo "Go must be installed to run this."
@ -23,7 +24,5 @@ GOBIN="/usr/local/bin" go install github.com/muesli/duf@latest
echo "Installing muffet, a fast website link checker..."
GOBIN="/usr/local/bin" go install github.com/raviqqe/muffet@latest
echo "Installing nuclei, a fast and customizable vulnerability scanner..."
GOBIN="/usr/local/bin" go install github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest
# Create a symbolic link for "duf" so that it is used instead of the original "df".
ln -sf /usr/local/bin/duf /usr/local/bin/df

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Installs Caddy on Linux
# This installs the Caddy web server on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-caddy.sh)
set -e

View file

@ -1,11 +1,11 @@
#!/usr/bin/env bash
# Installs Google Chrome on Linux
# This installs Google Chrome on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-chrome.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -1,11 +1,11 @@
#!/usr/bin/env bash
# Installs Darktable on Linux
# This installs Darktable on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-darktable.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -1,8 +1,10 @@
#!/usr/bin/env bash
# This installs the DavFS filesystem driver on Linux.
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Installs Docker on Ubuntu Linux
# This installs Docker on Ubuntu Linux
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-docker.sh)
echo "Installing Docker..."

View file

@ -1,11 +1,11 @@
#!/usr/bin/env bash
# Installs Go tools on Linux
# This installs Go tools on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-go-tools.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin:$PATH"
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -1,13 +1,13 @@
#!/usr/bin/env bash
# Installs latest Go on Linux
# This installs latest Go on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-go.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
DESTDIR=$(realpath "${1:-/usr/local}")
# Abort if not executed as root.
# Abort if not executed as root..
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -1,11 +1,11 @@
#!/usr/bin/env bash
# Installs GPU drivers on Linux
# This installs GPU drivers on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-gpu.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Error: Run ${0##*/} as root" 1>&2
exit 1

View file

@ -5,7 +5,7 @@
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# Abort if not executed as root.
# Abort if not executed as root..
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -9,7 +9,7 @@ DESTARCH=${DESTARCH:-$SYSTEM_ARCH}
. /etc/os-release
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]] && [[ $DESTDIR == "/usr" || $DESTDIR == "/usr/local" ]]; then
echo "Error: Run ${0##*/} as root to install in a system directory!" 1>&2
exit 1

View file

@ -1,11 +1,11 @@
#!/usr/bin/env bash
# Installs MariaDB on Linux
# This installs MariaDB on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-mariadb.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

View file

@ -1,11 +1,11 @@
#!/usr/bin/env bash
# Installs NodeJS, NPM and TestCafe on Linux
# This installs NodeJS, NPM and TestCafe on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-nodejs.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1

23
scripts/dist/install-nuclei.sh vendored Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
# This installs the Nuclei Vulnerability Scanner on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-nuclei.sh)
# Abort if not executed as root..
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
fi
set -eux;
# Is Go installed?
if ! command -v go &> /dev/null
then
echo "Go must be installed to run this."
exit 1
fi
# Install Nuclei via go install.
echo "Installing nuclei, a fast and customizable vulnerability scanner..."
GOBIN="/usr/local/bin" go install github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest

View file

@ -18,7 +18,7 @@ fi
TMPDIR=${TMPDIR:-/tmp}
# abort if not executed as root
# Abort if not executed as root.
if [[ $(id -u) != "0" ]] && [[ $DESTDIR == "/usr" || $DESTDIR == "/usr/local" ]]; then
echo "Error: Run ${0##*/} as root to install in a system directory!" 1>&2
exit 1