2023-02-23 12:36:49 +00:00
|
|
|
#!/bin/sh
|
2022-07-17 08:42:12 +00:00
|
|
|
|
2023-02-23 12:36:49 +00:00
|
|
|
if [ -z "${GOPATH}" ]; then
|
2022-07-17 08:42:12 +00:00
|
|
|
echo GOPATH environment variable not set
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2023-02-23 12:36:49 +00:00
|
|
|
if [ ! -e "${GOPATH}/bin/2goarray" ]; then
|
2022-07-17 08:42:12 +00:00
|
|
|
echo "Installing 2goarray..."
|
2023-02-23 12:36:49 +00:00
|
|
|
if ! go get github.com/cratonica/2goarray; then
|
2022-07-17 08:42:12 +00:00
|
|
|
echo Failure executing go get github.com/cratonica/2goarray
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo Please specify a PNG file
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$1" ]; then
|
2023-02-23 12:36:49 +00:00
|
|
|
echo "${1} is not a valid file"
|
2022-07-17 08:42:12 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
OUTPUT=iconunix.go
|
2023-02-23 12:36:49 +00:00
|
|
|
echo "Generating ${OUTPUT}"
|
|
|
|
echo "//+build linux darwin" > "${OUTPUT}"
|
|
|
|
echo >> "${OUTPUT}"
|
|
|
|
if ! "${GOPATH}"/bin/2goarray DefaultBanner agent < "${1}" >> "${OUTPUT}"; then
|
|
|
|
echo Failure generating "${OUTPUT}"
|
2022-07-17 08:42:12 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
echo Finished
|