diff --git a/packages/sun/build.sh b/packages/sun/build.sh new file mode 100644 index 000000000..016841b7d --- /dev/null +++ b/packages/sun/build.sh @@ -0,0 +1,24 @@ +TERMUX_PKG_HOMEPAGE=https://stand-up-notes.org +TERMUX_PKG_DESCRIPTION="A very simple note taking cli app" +TERMUX_PKG_LICENSE="BSD 2-Clause" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.0.0 +TERMUX_PKG_SRCURL=https://github.com/basbossink/sun/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=f0c90b8796caa66662dd82790449ca844708e20b39f7e81ef7f1cbce211d1412 +TERMUX_PKG_AUTO_UPDATE=true + +termux_step_make() { + termux_setup_golang + + export GOPATH=$TERMUX_PKG_BUILDDIR + mkdir -p "${TERMUX_PKG_BUILDDIR}"/src/github.com/basbossink/ + ln -sf "$TERMUX_PKG_SRCDIR" "$GOPATH"/src/github.com/basbossink/sun + + cd "$GOPATH"/src/github.com/basbossink/sun + go build -ldflags "-s -w -X main.Version=${TERMUX_PKG_VERSION}" . +} + +termux_step_make_install() { + install -Dm700 -t $TERMUX_PREFIX/bin \ + ${TERMUX_PKG_BUILDDIR}/src/github.com/basbossink/sun/sun +} diff --git a/packages/sun/timezone.patch b/packages/sun/timezone.patch new file mode 100644 index 000000000..5c5d70352 --- /dev/null +++ b/packages/sun/timezone.patch @@ -0,0 +1,39 @@ +diff --git a/main.go b/main.go +index 150776f..42e7ccc 100644 +--- a/main.go ++++ b/main.go +@@ -11,6 +11,7 @@ import ( + "io/ioutil" + "log" + "os" ++ "os/exec" + "path/filepath" + "sort" + "strings" +@@ -47,6 +48,18 @@ type entryReader struct { + toProcess []byte + } + ++func setTimezone() { ++ out, err := exec.Command("getprop", "persist.sys.timezone").Output() ++ if err != nil { ++ return ++ } ++ loc, err := time.LoadLocation(strings.TrimSpace(string(out))) ++ if err != nil { ++ return ++ } ++ time.Local = loc ++} ++ + func NewReader(r io.Reader) (*entryReader, error) { + buf, err := ioutil.ReadAll(r) + if err != nil { +@@ -301,6 +311,7 @@ func main() { + if err != nil { + log.Fatal(err) + } ++ setTimezone() + if len(os.Args) > 1 { + writeNewEntry(dataDir, os.Args[1:]) + } else {