mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-27 20:36:29 -04:00
Add initial packaging script (currently only for generating source PKGBUILD)
This commit is contained in:
@@ -2,3 +2,4 @@
|
||||
/mutn.exe
|
||||
/libmuttonserver
|
||||
/libmuttonserver.exe
|
||||
output
|
||||
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
# get version number from backend TODO embed Go code that reads the value of LibmuttonVersion
|
||||
version=$(grep 'LibmuttonVersion = "' ../src/backend/1globals.go | cut -c22-26)
|
||||
|
||||
# get revision number from user input, fallback to 1 if not provided
|
||||
if [ -z "$2" ]; then
|
||||
revision=1
|
||||
else
|
||||
revision="$2"
|
||||
fi
|
||||
|
||||
# ensure output directory exists
|
||||
mkdir -p ./output
|
||||
|
||||
case "$1" in
|
||||
pkgbuild-git-stable)
|
||||
. ./pkgbuild-git-stable.sh
|
||||
create_pkgbuild_git_stable
|
||||
;;
|
||||
*)
|
||||
printf '\nusage: package.sh [target] <revision>\n\ntargets: pkgbuild-git-stable\n\n'
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
create_pkgbuild_git_stable() {
|
||||
printf '\ngenerating PKGBUILD...\n'
|
||||
local source="git+https://github.com/rwinkhart/MUTN.git#tag=v\${pkgver}"
|
||||
printf "# Maintainer: Randall Winkhart <idgr at tutanota dot com>
|
||||
pkgname=mutn
|
||||
pkgver="$version"
|
||||
pkgrel="$revision"
|
||||
pkgdesc='A simple, self-hosted, SSH-synchronized password/note manager based on libmutton'
|
||||
arch=('x86_64' 'i686' 'i486' 'pentium4' 'aarch64' 'armv7h' 'riscv64')
|
||||
url='https://github.com/rwinkhart/MUTN'
|
||||
license=('MIT')
|
||||
makedepends=(go util-linux)
|
||||
optdepends=(
|
||||
'wl-clipboard: Wayland clipboard support'
|
||||
'xclip: X11 clipboard support'
|
||||
'bash-completion: Bash completion support'
|
||||
)
|
||||
source=(\""$source"\")
|
||||
sha512sums=(SKIP)
|
||||
|
||||
build() {
|
||||
# determine microarchitecture feature level
|
||||
case \$CARCH in
|
||||
'x86_64')
|
||||
lscpuOutput=\$(lscpu | grep Flags)
|
||||
if [ -z \"\$(echo \$lscpuOutput | grep avx512f)\" ]; then
|
||||
export GOAMD64=v4
|
||||
elif [ -z \"\$(echo \$lscpuOutput | grep avx2)\" ]; then
|
||||
export GOAMD64=v3
|
||||
elif [ -z \"\$(echo \$lscpuOutput | grep sse4_2)\" ]; then
|
||||
export GOAMD64=v2
|
||||
else
|
||||
export GOAMD64=v1
|
||||
fi
|
||||
;;
|
||||
# TODO check aarch64 feature level
|
||||
esac
|
||||
|
||||
cd \${srcdir}/MUTN
|
||||
CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath ./mutn.go
|
||||
}
|
||||
|
||||
package() {
|
||||
cd \${srcdir}/MUTN
|
||||
install -Dm755 ./mutn \${pkgdir}/usr/bin/mutn
|
||||
install -Dm644 ./LICENSE \${pkgdir}/usr/share/licenses/mutn/LICENSE
|
||||
install -Dm644 ./completions/zsh/_mutn \${pkgdir}/usr/share/zsh/site-functions/_mutn
|
||||
install -Dm644 ./completions/bash/mutn \${pkgdir}/usr/share/bash-completion/completions/mutn
|
||||
}
|
||||
" > output/PKGBUILD
|
||||
printf '\nPKGBUILD generated\n\n'
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
## Shell Completions Troubleshooting
|
||||
[Shell completions are provided for ZSH, Bash, and PowerShell 7+](https://github.com/rwinkhart/MUTN/tree/main/completions).
|
||||
### ZSH completions not working?
|
||||
Make sure your ~/.zshrc contains the following (if sourcing from default completions location, usually `/usr/share/zsh/functions/Completion/Unix/_mutn`):
|
||||
Make sure your ~/.zshrc contains the following (if sourcing from default completions location, usually `/usr/share/zsh/site-functions/_mutn`):
|
||||
```shell
|
||||
autoload -Uz compinit && compinit
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user