blob: 7d828fb7875dd533c167f0653a158373d5865a9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# Maintainer: Brenek Harrison <brenekharrison @ gmail d0t com>
pkgname=smartreboot
pkgver=0.0.3
pkgrel=2
pkgdesc="Reboot a machine without interrupting ongoing work."
arch=("x86_64")
url="https://github.com/BrenekH/smartreboot#readme"
license=("GPL3")
depends=("glibc")
makedepends=("go")
source=("smartreboot-$pkgver.tar.gz"::"https://github.com/BrenekH/smartreboot/archive/$pkgver.tar.gz")
sha256sums=('f13c0fa0a389bd5314087bad957c7a7a0657f3da3f40e859a45a1c829ea6fad0')
prepare() {
# This is a temporary patch until a new version of Smart Reboot is cut
sed -i 's/\/usr\/sbin\/smartrebootd/\/usr\/bin\/smartrebootd/g' "smartreboot-$pkgver/Makefile" "smartreboot-$pkgver/resources/systemd.service"
}
build() {
cd "smartreboot-$pkgver"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
# Store go caches in temp dirs (for those times when the home directory is locked down)
export GOMODCACHE="$(mktemp -d)"
export GOCACHE="$(mktemp -d)"
go build \
-trimpath \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-ldflags "-X 'main.Version=$pkgver' -linkmode external -extldflags \"${LDFLAGS}\"" \
-o build/smartreboot cmd/cli/main.go
go build \
-trimpath \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \
-o build/smartrebootd cmd/daemon/main.go
# Clean up Go caches
go clean -modcache
go clean -cache
}
check() {
cd "smartreboot-$pkgver"
go test ./...
./build/smartreboot --version
}
package() {
cd "smartreboot-$pkgver"
make DESTDIR=$pkgdir install
# Remove unnecessary debian reboot required script
rm $pkgdir/etc/smartreboot/rebootchecks/00-debian-reboot-required
}
|