CI: Improve scripts/dist/install-go.sh and add install-cli-tools.sh
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
f77f46b180
commit
4ab35c4dc7
3 changed files with 36 additions and 21 deletions
4
Makefile
4
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
|
||||
|
|
23
scripts/dist/install-cli-tools.sh
vendored
Normal file
23
scripts/dist/install-cli-tools.sh
vendored
Normal file
|
@ -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
|
30
scripts/dist/install-go-tools.sh
vendored
30
scripts/dist/install-go-tools.sh
vendored
|
@ -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."
|
||||
|
|
Loading…
Reference in a new issue