Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update webinterface-wifi to v2.0.0 #768

Merged
merged 7 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 43 additions & 12 deletions package/webinterface-wifi/package
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,70 @@
# Copyright (c) 2020 The Toltec Contributors
# SPDX-License-Identifier: MIT

pkgnames=(webinterface-wifi)
_pkgname="webinterface-wifi"
pkgnames=("$_pkgname")
pkgdesc="View the web interface if running, over wifi"
url="https://github.com/rM-self-serve/webinterface-wifi"
pkgver=1.0.2-1
timestamp=2023-02-06T12:23:17Z
url="https://github.com/rM-self-serve/$_pkgname"
pkgver=2.0.0-1
timestamp=2023-11-26T00:02:11Z
section="utils"
maintainer="rM-self-serve <[email protected]>"
license=MIT
image=rust:v3.1

image=rust:v2.3
_pkgalias="webint-wifi"
_configdir="/home/root/.config/$_pkgname"
_etcdir="/opt/etc/$_pkgname"

source=(
https://github.com/rM-self-serve/webinterface-wifi/archive/2e29855303a0806ee51e71bc836bc4b16204fa14.zip
webinterface-wifi-toltec.service
"$url/archive/4513d5cbc5e323f2959987f3bc9e300b0aaddb19.zip"
"$_pkgname-toltec.service"
)

sha256sums=(
629bab244a387086ce2a8f8118b8d1017cf993bf97b13da72573f52572ed526e
a23c05faf4ccaafea9222255399c8c3a121079dd07970c8768b4315606eb7834
SKIP
)

build() {
RUSTFLAGS="-Zcrate-attr=feature(const_fn_trait_bound)" cargo build --release
WIW_DATADIR="/opt/etc" cargo build --release
}

package() {
install -D -m 755 -t "$pkgdir"/opt/bin \
"$srcdir"/target/armv7-unknown-linux-gnueabihf/release/webinterface-wifi
install -D -m 644 "$srcdir"/webinterface-wifi-toltec.service "$pkgdir"/lib/systemd/system/webinterface-wifi.service
install -D -m 755 -t "$pkgdir/opt/bin" \
"$srcdir/target/armv7-unknown-linux-gnueabihf/release/$_pkgname"
ln -s "/opt/bin/$_pkgname" "$pkgdir/opt/bin/$_pkgalias"

install -D -m 644 "$srcdir/$_pkgname-toltec.service" \
"$pkgdir/lib/systemd/system/$_pkgname.service"

install -D -m 644 -t "$pkgdir""$_etcdir/docs" \
"$srcdir/README.MD" "$srcdir"/config/*.toml
install -D -m 644 -t "$pkgdir""$_etcdir/docs/config_examples" \
"$srcdir"/config/examples/*.toml
install -D -m 644 -t "$pkgdir""$_etcdir"/assets \
"$srcdir/assets/favicon.ico"
install -d "$pkgdir""$_etcdir/ssl" \
"$pkgdir""$_etcdir/auth" \
"$pkgdir""$_configdir"
}

configure() {
[[ -f "$_configdir/config.toml" ]] \
|| cp "$_etcdir/docs/config.default.toml" \
"$_configdir/config.toml"

systemctl daemon-reload

if is-active "$pkgname"; then
echo "Restarting $pkgname"
systemctl restart "$pkgname"
fi

echo ""
echo "Run '\$ $pkgname' for usage information and a link to"
echo "the documentation. You can also find the documentation locally"
echo "at /opt/etc/webinterface-wifi/docs/"
echo ""
echo "Run the following command to use $pkgname"
how-to-enable "$pkgname.service"
Expand All @@ -53,5 +83,6 @@ preremove() {
}

postremove() {
rmdir "$_etcdir"/*/* "$_etcdir"/* "$_etcdir" 2> /dev/null || true
systemctl daemon-reload
}
5 changes: 3 additions & 2 deletions package/webinterface-wifi/webinterface-wifi-toltec.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ StartLimitBurst=4
After=home.mount

[Service]
Environment=HOME=/home/root
Type=simple
ExecStart=/opt/bin/webinterface-wifi --run 80
Environment=HOME=/home/root
Environment=WEBINT_WIFI_RUN_ENV=DAEMON
ExecStart=/opt/bin/webinterface-wifi local-exec
Restart=on-failure

[Install]
Expand Down