diff --git a/Makefile b/Makefile index 8eac9c6b1..334299316 100644 --- a/Makefile +++ b/Makefile @@ -89,9 +89,7 @@ install: rm -rf --preserve-root $(DESTDIR)/include (cd $(DESTDIR) && mkdir -p bin sbin lib assets config config/examples) ./scripts/build.sh prod "$(DESTDIR)/bin/$(BINARY_NAME)" - [ -f "$(GOBIN)/gosu" ] || go install github.com/tianon/gosu@latest - cp $(GOBIN)/gosu $(DESTDIR)/sbin/gosu - [ ! -f "$(GOBIN)/exif-read-tool" ] || cp $(GOBIN)/exif-read-tool $(DESTDIR)/bin/exif-read-tool + GOBIN="$(DESTDIR)/sbin" go install github.com/tianon/gosu@latest rsync -r -l --safe-links --exclude-from=assets/.buildignore --chmod=a+r,u+rw ./assets/ $(DESTDIR)/assets wget -O $(DESTDIR)/assets/static/img/wallpaper/welcome.jpg https://cdn.photoprism.app/wallpaper/welcome.jpg wget -O $(DESTDIR)/assets/static/img/preview.jpg https://cdn.photoprism.app/img/preview.jpg diff --git a/scripts/dist/install-cli-tools.sh b/scripts/dist/install-cli-tools.sh new file mode 100644 index 000000000..2f3f98c4a --- /dev/null +++ b/scripts/dist/install-cli-tools.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Installs CLI Tools on Linux +# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-cli-tools.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; + +if ! command -v go &> /dev/null +then + echo "Go must be installed." + exit 1 +fi + +echo "Installing CLI Tools..." + +GOBIN="/usr/local/bin" go install github.com/muesli/duf@latest +ln -sf /usr/local/bin/duf /usr/local/bin/df \ No newline at end of file diff --git a/scripts/dist/install-go-tools.sh b/scripts/dist/install-go-tools.sh index f101a0ca7..fc7209f87 100755 --- a/scripts/dist/install-go-tools.sh +++ b/scripts/dist/install-go-tools.sh @@ -11,11 +11,6 @@ if [[ $(id -u) != "0" ]]; then exit 1 fi -if [[ -z "$GOPATH" ]] || [[ -z "$GOBIN" ]]; then - echo "\$GOPATH and \$GOBIN must be set" 1>&2 - exit 1 -fi - if [[ $PHOTOPRISM_ARCH ]]; then SYSTEM_ARCH=$PHOTOPRISM_ARCH else @@ -30,8 +25,13 @@ set -e mkdir -p "$GOPATH/src" "$GOBIN" -go install github.com/tianon/gosu@latest +# Install gosu in "/usr/local/sbin". +echo "Installing gosu in /usr/local/sbin..." +GOBIN="/usr/local/sbin" go install github.com/tianon/gosu@latest +chown root:root /usr/local/sbin/gosu +chmod 755 /usr/local/sbin/gosu +# Install remaining tools in "/usr/local/bin". case $DESTARCH in arm | ARM | aarch | armv7l | armhf) # no additional tools on ARMv7 to reduce build time @@ -39,21 +39,15 @@ case $DESTARCH in ;; *) - go install golang.org/x/tools/cmd/goimports@latest - go install github.com/psampaz/go-mod-outdated@latest - go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest - go install github.com/mikefarah/yq/v4@latest - - go install github.com/kyoh86/richgo@latest - cp "$GOBIN/richgo" /usr/local/bin/richgo + echo "Installing goimports, go-mod-outdated, exif-read-tool and richgo in /usr/local/bin..." + GOBIN="/usr/local/bin" go install golang.org/x/tools/cmd/goimports@latest + GOBIN="/usr/local/bin" go install github.com/psampaz/go-mod-outdated@latest + GOBIN="/usr/local/bin" go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest + GOBIN="/usr/local/bin" go install github.com/mikefarah/yq/v4@latest + GOBIN="/usr/local/bin" go install github.com/kyoh86/richgo@latest ;; esac chmod -R a+rwX "$GOPATH" -# install gosu in /usr/local/sbin -cp "$GOBIN/gosu" /usr/local/sbin/gosu -chown root:root /usr/local/sbin/gosu -chmod 755 /usr/local/sbin/gosu - echo "Done."