-
Notifications
You must be signed in to change notification settings - Fork 123
/
pkg.yaml
96 lines (90 loc) · 3.46 KB
/
pkg.yaml
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: nut-client
variant: scratch
shell: /toolchain/bin/bash
dependencies:
- stage: base
- image: "{{ .BUILD_ARG_PKGS_PREFIX }}/openssl:{{ .BUILD_ARG_PKGS }}"
- image: "{{ .BUILD_ARG_PKGS_PREFIX }}/util-linux:{{ .BUILD_ARG_PKGS }}"
steps:
- sources:
- url: https://github.com/networkupstools/nut/releases/download/v{{ .NUT_VERSION }}/nut-{{ .NUT_VERSION }}.tar.gz
destination: nut.tar.gz
sha256: e4b4b0cbe7dd39ba9097be7f7d787bb2fffbe35df64dff53b5fe393d659c597d
sha512: b6f8f22318e4a4fcb8073a63132b1cb083952c665191b82a7d6765a61b859575a4b0c2ba84ed17cfb8c88d34179876d64520dd2f75f02fe8707b406da2c0821c
prepare:
- |
sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml
- |
tar -xf nut.tar.gz --strip-components=1
- |
# no shell for you
patch -p1 < /pkg/patches/replace_system.patch
- |
mkdir -p /usr/bin
ln -sf /toolchain/bin/env /usr/bin/env
# Create symlinks for files used when building.
ln -s /toolchain/bin/pkg-config /usr/bin/pkg-config
ln -s /toolchain/bin/file /usr/bin/file
autoreconf -if
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
./configure \
--prefix=/usr/local \
--libexecdir=/usr/local/lib/nut \
--datadir=/usr/local/share/nut \
--sysconfdir=/usr/local/etc/nut \
--with-drvpath=/usr/local/lib/nut \
--with-statepath=/var/run/nut \
--with-altpidpath=/var/run/nut \
--with-udev-dir=/usr/lib/udev \
--with-systemdsystemunitdir=no \
--with-systemdshutdowndir=no \
--with-systemdtmpfilesdir=no \
--with-user=nut \
--with-group=nut \
--with-openssl \
--disable-static \
--without-avahi \
--without-cgi \
--without-freeipmi \
--without-ipmi \
--without-libltdl \
--without-modbus \
--without-neon \
--without-nss \
--without-powerman \
--without-serial \
--without-snmp \
--without-wrap \
--without-usb
build:
- |
make -j $(nproc) all
install:
- |
make DESTDIR=/rootfs install-exec
containerRoot=/rootfs/usr/local/lib/containers/nut-client
mkdir -p "$containerRoot"/{etc,sbin,usr/local/lib}
cp /rootfs/usr/local/sbin/upsmon "$containerRoot/upsmon"
mv /rootfs/usr/local/lib/lib* "$containerRoot/usr/local/lib/"
cp /pkg/files/* "$containerRoot/etc/"
# TODO replace /usr/bin/wall with either a wrapper for printk or a
# Go cmd to log to Talos Events
# cleanup
rm -rf /rootfs/usr/local/bin
rm -rf /rootfs/usr/local/etc
rm -rf /rootfs/usr/local/lib/nut
rm -rf /rootfs/usr/local/sbin
- |
mkdir -p /rootfs/usr/local/etc/containers
cp /pkg/nut-client.yaml /rootfs/usr/local/etc/containers/
test:
- |
mkdir -p /extensions-validator-rootfs
cp -r /rootfs/ /extensions-validator-rootfs/rootfs
cp /pkg/manifest.yaml /extensions-validator-rootfs/manifest.yaml
/extensions-validator validate --rootfs=/extensions-validator-rootfs --pkg-name="${PKG_NAME}"
finalize:
- from: /rootfs
to: /rootfs
- from: /pkg/manifest.yaml
to: /