Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
using a configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
iuridiniz committed Oct 15, 2021
1 parent 2c17c7d commit 64d35b8
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 66 deletions.
154 changes: 148 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pam-send-slack-message"
version = "0.1.2"
version = "0.2.0"
edition = "2018"
authors = ["Iuri Diniz <iuridiniz@gmail.com>"]
license = "MIT"
Expand All @@ -13,6 +13,13 @@ description = "pam helper that publishes messages on Slack based on ssh access"
extended-description = """\
pam-send-slack-message is a program that publishes messages on slack when the linux server is accessed through ssh."""
recommends = "openssh-server"
assets = [
["target/release/pam-send-slack-message", "/usr/bin/pam-send-slack-message", "755"],
["src/settings.default.toml", "etc/pam-send-slack-message.toml", "600"],
["README.md", "usr/share/doc/pam-send-slack-message/README", "644" ],
["LICENSE", "usr/share/doc/pam-send-slack-message/LICENSE", "644" ],
]
conf-files = ["etc/pam-send-slack-message.toml"]

[dependencies]
log = "0.4.14"
Expand All @@ -23,6 +30,8 @@ ellipse = "0.2.0"
chrono = "0.4.19"
chrono-tz = "0.6.0"
gethostname = "0.2.1"
config = "0.11.0"
serde = { version = "1.0.130", features = ["derive"] }

[profile.release]
lto = true
Expand Down
12 changes: 5 additions & 7 deletions Makefile
Expand Up @@ -13,14 +13,14 @@ CROSS_BINARIES=$(BINARY).x86_64.musl.upx $(BINARY).aarch64.musl.upx $(BINARY).i6
all: $(BINARY)
cross: $(CROSS_BINARIES)

$(BINARY): $(wildcard src/*.rs) Cargo.toml
$(BINARY): $(wildcard src/*) Cargo.toml
cargo build
cp target/debug/$(BINARY) $(BINARY)
strip $(BINARY)
du -hs target/debug/$(BINARY) $(BINARY)

# X86_64 musl
$(BINARY).x86_64.musl: $(wildcard src/*.rs) Cargo.toml
$(BINARY).x86_64.musl: $(wildcard src/*) Cargo.toml
make _cross TARGET_BINARY=$@ TARGET_TRIPLE=x86_64-unknown-linux-musl
x86_64-linux-gnu-strip $@
du -hs $@
Expand All @@ -29,7 +29,7 @@ $(BINARY).x86_64.musl.upx: $(BINARY).x86_64.musl
make _upx TARGET_BINARY=$@ SOURCE_BINARY=$<

# i686 musl
$(BINARY).i686.musl: $(wildcard src/*.rs) Cargo.toml
$(BINARY).i686.musl: $(wildcard src/*) Cargo.toml
make _cross TARGET_BINARY=$@ TARGET_TRIPLE=i686-unknown-linux-musl
i686-linux-gnu-strip $@
du -hs $@
Expand All @@ -38,7 +38,7 @@ $(BINARY).i686.musl.upx: $(BINARY).i686.musl
make _upx TARGET_BINARY=$@ SOURCE_BINARY=$<

# AARCH64 musl
$(BINARY).aarch64.musl: $(wildcard src/*.rs) Cargo.toml
$(BINARY).aarch64.musl: $(wildcard src/*) Cargo.toml
make _cross TARGET_BINARY=$@ TARGET_TRIPLE=aarch64-unknown-linux-musl
aarch64-linux-gnu-strip $@
du -hs $@
Expand Down Expand Up @@ -73,7 +73,7 @@ deb-i686: $(BINARY).i686.musl
cargo deb -o ./ --target i686-unknown-linux-musl --no-build

# requires nightly, rust-src, rust-std
# $(BINARY).musl-optz: $(wildcard src/*.rs) Cargo.toml
# $(BINARY).musl-optz: $(wildcard src/*) Cargo.toml
# RUSTFLAGS="$(RUSTFLAGS) -L/usr/lib/x86_64-linux-musl/ -Copt-level=z -Cpanic=abort" cargo +nightly build -v -Z unstable-options -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --release --target x86_64-unknown-linux-musl
# cp target/x86_64-unknown-linux-musl/release/$(BINARY) $(BINARY).musl-optz
# strip $(BINARY).musl-optz
Expand Down Expand Up @@ -111,8 +111,6 @@ fake-close-session: $(BINARY)

release: cross sha1sum.txt



sha1sum.txt: $(CROSS_BINARIES)
rm -f sha1sum.txt
sha1sum pam-send-slack-message.* | tee sha1sum.txt
Expand Down

0 comments on commit 64d35b8

Please sign in to comment.