Skip to content

Commit

Permalink
5th attempt on OpenBSD + NetBSD compatibility
Browse files Browse the repository at this point in the history
Still debugging all of the issues. Please use stable release instead of cloning the repository in the meantime.
  • Loading branch information
burianvlastimil committed Oct 23, 2018
1 parent 3edc2df commit b80751d
Showing 1 changed file with 51 additions and 42 deletions.
93 changes: 51 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,42 @@ encrypt_script := encrypt-file-aes256
decrypt_script := decrypt-file-aes256
distrib_name := openssl-encryption

color_support_test1 := $$( command -v tput > /dev/null 2>&1 )
#color_support_test2 := $$( tput setaf 1 > /dev/null 2>&1 )
colors_supported := $$( [ $(color_support_test1) -eq 0 ] )
#colors_available :=
# ) ] && echo true || echo false)


platform_id = $$(uname -s)

platform_id = $$( uname -s )
platform = $$( \
if [ $(platform_id) = Linux ] || \
[ $(platform_id) = FreeBSD ] || \
[ $(platform_id) = OpenBSD ] || \
[ $(platform_id) = NetBSD ]; \
then echo $(platform_id); \
else echo Unrecognized; \
fi \
)


check: $(encrypt_script) $(decrypt_script)


case $(platform_id) in \
Linux | FreeBSD | OpenBSD | NetBSD ) echo $(platform_id) ;; \
* ) echo Unrecognized ;; \
esac )

# echo $(colors_supported)

@if [ $(platform) = Unrecognized ]; then echo This platform: $(platform_id) is currently not supported.; else echo $(platform); fi

exit 1
# if [ $(platform_id) = Linux ] || \
# [ $(platform_id) = FreeBSD ] || \
# [ $(platform_id) = OpenBSD ] || \
# [ $(platform_id) = NetBSD ]; \
# then
# else ; \
# fi






# echo $(color_support_test)

if [ $(colors_supported) = true ]; then echo I LOVE colors!; else echo I HATE colors!; fi
colors_supported != if command -v tput > /dev/null 2>&1 && tput setaf 1 > /dev/null 2>&1; then echo true; else echo false; fi
#header_color != if $(colors_supported); then tput bold && tput setaf 3; fi
#reset_colors != if $(colors_supported); then tput sgr0; fi

exit 1

check: $(encrypt_script) $(decrypt_script)

@echo; $(colors_supported) && ( tput bold; tput setaf 3 ) || true; echo Target: check; $(colors_supported) && tput sgr0 || true; echo


@echo $(platform); echo
@$$( exit 127 )




Expand All @@ -64,25 +56,42 @@ check: $(encrypt_script) $(decrypt_script)



@echo; if $(colors_supported); then tput bold; fi; $(colors_supported) && tput setaf 3; echo "Target: check"; $(colors_supported) && tput sgr0; echo

@if ( if [ -f SHA512SUM ]; then \
case $(platform) in \
Linux ) sha512sum -c SHA512SUM ;; \
FreeBSD ) shasum -a 512 -c SHA512SUM ;; \
OpenBSD | NetBSD ) cksum -a sha512 -C SHA512SUM ;; \
Unrecognized ) $(MAKE) SHA512SUM ;; \
esac \
fi ); \
then ( \
$(colors_supported) && ( tput bold; tput setaf 2 ) || true; \
echo; echo "Ok. You may use 'sudo make install' or '(sudo) make install PREFIX=SomeDir' command now."; \
$(colors_supported) && tput sgr0 || true \
) else ( \
$(colors_supported) && ( tput bold; tput setaf 1 ) || true; \
echo; echo "Error: Script files hash sum mismatch!" 1>&2; \
echo; $(colors_supported) && tput sgr0 || true; \
exit 1 \
); fi

@if [ -f SHA512SUM ]; then \
( \
if [ $(platform_id) = Linux ]; then sha512sum -c SHA512SUM; \
elif [ $(platform_id) = FreeBSD ]; then shasum -a 512 -c SHA512SUM; \
elif [ $(platform_id) = OpenBSD ] || [ $(platform_id) = NetBSD ]; then cksum -a sha512 -C SHA512SUM; \
fi && \
( $(colors_supported) && tput bold; $(colors_supported) && tput setaf 2; echo; echo "Ok. You may use 'sudo make install' or '(sudo) make install PREFIX=SomeDir' command now."; $(colors_supported) && tput sgr0 ) || \
( $(colors_supported) && tput bold; $(colors_supported) && tput setaf 1; echo; echo "Error: Script files hash sum mismatch!" 1>2; echo; $(colors_supported) && tput sgr0; exit 1 ) \
) \
else \
$(MAKE) SHA512SUM; \
fi
# && ( \
# $(colors_supported) && ( tput bold; tput setaf 2 ); \
# echo; echo "Ok. You may use 'sudo make install' or '(sudo) make install PREFIX=SomeDir' command now."; \
# $(colors_supported) && tput sgr0 \
# ) \
# || ( \
# $(colors_supported) && ( tput bold; tput setaf 1 ); \
# echo; echo "Error: Script files hash sum mismatch!" 1>&2; \
# echo; $(colors_supported) && tput sgr0; \
# exit 1 \
# )


install: check

@echo; $(colors_supported) && tput bold; $(colors_supported) && tput setaf 3; echo Target: install; $(colors_supported) && tput sgr0; echo
@echo; $(colors_supported) && tput bold && tput setaf 3; echo Target: install; $(colors_supported) && tput sgr0; echo

@[ $(PREFIX) = $(DEFAULT_PREFIX) ] || ( $(colors_supported) && tput bold; $(colors_supported) && tput setaf 4; echo "Information: Installing to non-standard location."; $(colors_supported) && tput sgr0; echo )

Expand Down

0 comments on commit b80751d

Please sign in to comment.