diff options
author | George Rawlinson | 2022-12-10 10:08:05 +1300 |
---|---|---|
committer | George Rawlinson | 2022-12-10 10:29:00 +1300 |
commit | a11e2c6b035f25fb4fd7c5677f319ac5dab71134 (patch) | |
tree | e631bc8538009cbaf6752c35505c54c93b25ee0b | |
download | aur-melt.tar.gz |
addpkg: melt 0.5.0-1
-rw-r--r-- | .SRCINFO | 17 | ||||
-rw-r--r-- | PKGBUILD | 89 | ||||
-rw-r--r-- | change-binary-name.patch | 33 |
3 files changed, 139 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..407d1bf6586f --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,17 @@ +pkgbase = melt + pkgdesc = Backup and restore SSH private keys using memorizable seed phrases + pkgver = 0.5.0 + pkgrel = 1 + url = https://github.com/charmbracelet/melt + arch = x86_64 + license = MIT + makedepends = git + makedepends = go + depends = glibc + options = !lto + source = git+https://github.com/charmbracelet/melt.git#commit=794f87bdc1dd6db69642251bd36713c8e6b5bdd4 + source = change-binary-name.patch + b2sums = SKIP + b2sums = d8babc3fab8f0cb211217b05fd230c9eb64a81059a001746290575f3cf9c80aa18722ca8b01522f455ca2e2e8c694d7a0303a22cb3d846cb55015fa7ed494e0d + +pkgname = melt diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..eb417c42feb6 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,89 @@ +# Maintainer: George Rawlinson <grawlinson@archlinux.org> + +pkgname=melt +pkgver=0.5.0 +pkgrel=1 +pkgdesc='Backup and restore SSH private keys using memorizable seed phrases' +arch=('x86_64') +url='https://github.com/charmbracelet/melt' +license=('MIT') +depends=('glibc') +makedepends=('git' 'go') +options=('!lto') +_commit='794f87bdc1dd6db69642251bd36713c8e6b5bdd4' +source=( + "git+https://github.com/charmbracelet/melt.git#commit=$_commit" + 'change-binary-name.patch' +) +b2sums=('SKIP' + 'd8babc3fab8f0cb211217b05fd230c9eb64a81059a001746290575f3cf9c80aa18722ca8b01522f455ca2e2e8c694d7a0303a22cb3d846cb55015fa7ed494e0d') + +pkgver() { + cd melt + + git describe --tags | sed 's/^v//' +} + +prepare() { + cd melt + + # create directory for build output + mkdir build + + # download dependencies + go mod download + + # /usr/bin/melt is already used by the package extra/mlt + patch -p1 -i "$srcdir/change-binary-name.patch" +} + +build() { + cd melt + + # set Go flags + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + + go build -v \ + -trimpath \ + -buildmode=pie \ + -mod=readonly \ + -modcacherw \ + -ldflags "-linkmode external -extldflags $LDFLAGS" \ + -o build/melt-key \ + ./cmd/... + + # generate shell completion + for shell in bash fish zsh; do + ./build/melt-key completion "$shell" > "build/$shell.completion" + done + + # generate reproducible man page + local _commit_date=$(git show --no-patch --format=%cd --date=format:%Y-%m-%d) + ./build/melt-key man > build/melt-key.1 + sed -e "s/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/$_commit_date/" -i build/melt-key.1 +} + +package() { + cd melt + + # binary + install -vDm755 -t "$pkgdir/usr/bin" build/melt-key + + # shell completion + install -vDm644 build/bash.completion "$pkgdir/usr/share/bash-completion/completions/melt-key" + install -vDm644 build/fish.completion "$pkgdir/usr/share/fish/vendor_completions.d/melt-key.fish" + install -vDm644 build/zsh.completion "$pkgdir/usr/share/zsh/site-functions/_melt-key" + + # man page + install -vDm644 -t "$pkgdir/usr/share/man/man1" build/melt-key.1 + + # documentation + install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md + + # license + install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.md +} + +# vim:set ts=2 sw=2 et: diff --git a/change-binary-name.patch b/change-binary-name.patch new file mode 100644 index 000000000000..1f897d407d40 --- /dev/null +++ b/change-binary-name.patch @@ -0,0 +1,33 @@ +--- a/cmd/melt/main.go ++++ b/cmd/melt/main.go +@@ -49,13 +49,13 @@ var ( + language string + + rootCmd = &cobra.Command{ +- Use: "melt", +- Example: ` melt ~/.ssh/id_ed25519 +- melt ~/.ssh/id_ed25519 > seed +- melt restore --seed "seed phrase" ./restored_id25519 +- melt restore ./restored_id25519 < seed`, ++ Use: "melt-key", ++ Example: ` melt-key ~/.ssh/id_ed25519 ++ melt-key ~/.ssh/id_ed25519 > seed ++ melt-key restore --seed "seed phrase" ./restored_id25519 ++ melt-key restore ./restored_id25519 < seed`, + Short: "Generate a seed phrase from an SSH key", +- Long: `melt generates a seed phrase from an SSH key. That phrase can ++ Long: `melt-key generates a seed phrase from an SSH key. That phrase can + be used to rebuild your public and private keys.`, + Args: cobra.MaximumNArgs(1), + SilenceUsage: true, +@@ -116,8 +116,8 @@ be used to rebuild your public and private keys.`, + restoreCmd = &cobra.Command{ + Use: "restore", + Short: "Recreate a key using the given seed phrase", +- Example: ` melt restore --seed "seed phrase" ./restored_id25519 +- melt restore ./restored_id25519 < seed`, ++ Example: ` melt-key restore --seed "seed phrase" ./restored_id25519 ++ melt-key restore ./restored_id25519 < seed`, + Aliases: []string{"res", "r"}, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { |