Compatibility with official swift container images (#390)

* Compatibility with official swift container images

Sudo is not available in containers, running sudo breaks `make install`. Solve the issue by checking whether the user is root, and if he is, no need to use sudo.

* Indent fix

line 24 indentation should use tab

* ifneq, else and endif should not be indented in makefiles
This commit is contained in:
Jeffrey-de-Bruijn 2022-06-06 11:57:59 +02:00 committed by GitHub
parent cddcfa9b32
commit c515b616bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,9 +5,22 @@ build:
./build
rm ./build
install: build
# if uid does not equal 0
# user is not root and must use sudo
ifneq ($(shell id -u), 0)
sudo mv .build/release/vapor ${DEST}
sudo chmod 755 ${DEST}
# if uid is 0
# user is root and perhaps sudo is not available
else
mv .build/release/vapor ${DEST}
chmod 755 ${DEST}
endif
uninstall:
ifneq ($(shell id -u), 0)
sudo rm ${DEST}
else
rm ${DEST}
endif
clean:
rm -rf .build