-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
class RusticScheduler < Formula | ||
desc "rustic scheduler - a client/server application to schedule regular backups on | ||
many clients to one identical repository controlled by a central scheduling | ||
server. | ||
" | ||
homepage "https://rustic.cli.rs/" | ||
version "0.2.0" | ||
if OS.mac? | ||
if Hardware::CPU.arm? | ||
url "https://github.com/rustic-rs/rustic_scheduler/releases/download/v0.2.0/rustic_scheduler-aarch64-apple-darwin.tar.xz" | ||
sha256 "cb769c0dc4126445b5a6f0b2bf4b95a01c347bdfb44aedf0df3e6c46a995ebdb" | ||
end | ||
if Hardware::CPU.intel? | ||
url "https://github.com/rustic-rs/rustic_scheduler/releases/download/v0.2.0/rustic_scheduler-x86_64-apple-darwin.tar.xz" | ||
sha256 "aa21b5cc269c2f15bdc4cdeb26d1908bc030b65dd3c7c5ee49698b01d11bf79e" | ||
end | ||
end | ||
if OS.linux? | ||
if Hardware::CPU.arm? | ||
url "https://github.com/rustic-rs/rustic_scheduler/releases/download/v0.2.0/rustic_scheduler-aarch64-unknown-linux-gnu.tar.xz" | ||
sha256 "3b251e6c4811d843c9eda552a1aef3a03d1565f167e798ba48adf6f4b3dac1ee" | ||
end | ||
if Hardware::CPU.intel? | ||
url "https://github.com/rustic-rs/rustic_scheduler/releases/download/v0.2.0/rustic_scheduler-x86_64-unknown-linux-gnu.tar.xz" | ||
sha256 "4a8245925981520361b7d531a9865ac1106f5287affcebe7e6c05d2202f7bca3" | ||
end | ||
end | ||
license any_of: ["Apache-2.0", "MIT"] | ||
|
||
BINARY_ALIASES = { | ||
"aarch64-apple-darwin": {}, | ||
"aarch64-unknown-linux-gnu": {}, | ||
"x86_64-apple-darwin": {}, | ||
"x86_64-pc-windows-gnu": {}, | ||
"x86_64-unknown-linux-gnu": {}, | ||
"x86_64-unknown-linux-musl-dynamic": {}, | ||
"x86_64-unknown-linux-musl-static": {}, | ||
}.freeze | ||
|
||
def target_triple | ||
cpu = Hardware::CPU.arm? ? "aarch64" : "x86_64" | ||
os = OS.mac? ? "apple-darwin" : "unknown-linux-gnu" | ||
|
||
"#{cpu}-#{os}" | ||
end | ||
|
||
def install_binary_aliases! | ||
BINARY_ALIASES[target_triple.to_sym].each do |source, dests| | ||
dests.each do |dest| | ||
bin.install_symlink bin/source.to_s => dest | ||
end | ||
end | ||
end | ||
|
||
def install | ||
bin.install "rustic-scheduler" if OS.mac? && Hardware::CPU.arm? | ||
bin.install "rustic-scheduler" if OS.mac? && Hardware::CPU.intel? | ||
bin.install "rustic-scheduler" if OS.linux? && Hardware::CPU.arm? | ||
bin.install "rustic-scheduler" if OS.linux? && Hardware::CPU.intel? | ||
|
||
install_binary_aliases! | ||
|
||
# Homebrew will automatically install these, so we don't need to do that | ||
doc_files = Dir["README.*", "readme.*", "LICENSE", "LICENSE.*", "CHANGELOG.*"] | ||
leftover_contents = Dir["*"] - doc_files | ||
|
||
# Install any leftover files in pkgshare; these are probably config or | ||
# sample files. | ||
pkgshare.install(*leftover_contents) unless leftover_contents.empty? | ||
end | ||
end |